Skip to content

Commit

Permalink
v3.4.0: Update plugin to 1.20.x
Browse files Browse the repository at this point in the history
- Updated the plugin to support Minecraft version 1.20.x.
- Removed banlist patch to fix mistake from older versions.
- Fixed the FREEZE death cause to not work.
- Added the KILL death cause for /kill command.
- Added the SONIC_BOOM death cause for death by warden.
- Added the WORLD_BORDER death cause for death by the world border.
  • Loading branch information
NathanCollaert committed Sep 8, 2023
1 parent c2709d1 commit 894b24c
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 52 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.backtobedrock</groupId>
<artifactId>AugmentedHardcore</artifactId>
<version>3.3.8</version>
<version>3.4.0</version>
<packaging>jar</packaging>
<properties>
<java.version>8</java.version>
Expand Down Expand Up @@ -75,7 +75,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
<version>1.20.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -87,7 +87,7 @@
<dependency>
<groupId>net.wesjd</groupId>
<artifactId>anvilgui</artifactId>
<version>1.6.3-SNAPSHOT</version>
<version>1.9.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
Expand All @@ -110,7 +110,7 @@
<dependency>
<groupId>com.tchristofferson</groupId>
<artifactId>ConfigUpdater</artifactId>
<version>2.0-SNAPSHOT</version>
<version>2.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.backtobedrock.augmentedhardcore.utilities.Metrics;
import com.backtobedrock.augmentedhardcore.utilities.placeholderAPI.PlaceholdersAugmentedHardcore;
import com.tchristofferson.configupdater.ConfigUpdater;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -59,11 +58,6 @@ public class AugmentedHardcore extends JavaPlugin implements Listener {
public void onEnable() {
this.initialize();

//unban patch
BanList banListName = Bukkit.getBanList(BanList.Type.NAME), banListIP = Bukkit.getBanList(BanList.Type.IP);
banListName.getBanEntries().stream().filter(e -> e.getSource().equals(this.getDescription().getName())).forEach(e -> banListName.pardon(e.getTarget()));
banListIP.getBanEntries().stream().filter(e -> e.getSource().equals(this.getDescription().getName())).forEach(e -> banListIP.pardon(e.getTarget()));

//update checker
this.updateChecker = new UpdateChecker();
this.updateChecker.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.backtobedrock.augmentedhardcore.utilities.ConfigUtils;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.plugin.java.JavaPlugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,135 +10,140 @@ public enum DamageCause {
"blew up",
"got caught in an explosion"
)
), //works
),
CONTACT(4320,
Arrays.asList(
"were pricked to death",
"were poked to death"
)
), //works
),
CRAMMING(4320,
Arrays.asList(
"were squished too much",
"were flattened"
)
), //works
),
DRAGON_BREATH(2880,
Collections.singletonList(
"were roasted in dragon breath"
)
), //unable to replicate in vanilla
),
DROWNING(4320,
Arrays.asList(
"drowned",
"weren't able to find air"
)
), //works
),
ENTITY_ATTACK(2880,
Arrays.asList(
"were slain",
"were doomed"
)
), //works
),
PLAYER_ENTITY_ATTACK(7200,
Arrays.asList(
"were slain",
"were doomed"
)
), //can't test solo
),
ENTITY_EXPLOSION(2880,
Arrays.asList(
"blew up",
"got caught in an explosion",
"went off with a bang"
)
), //works
),
PLAYER_ENTITY_EXPLOSION(7200,
Arrays.asList(
"blew up",
"got caught in an explosion",
"went off with a bang"
)
), //can't test solo
),
ENTITY_SWEEP_ATTACK(2880,
Arrays.asList(
"were slain during a sweep attack",
"were caught in a sweep attack"
)
), //Can't test
),
PLAYER_ENTITY_SWEEP_ATTACK(7200,
Arrays.asList(
"were slain during a sweep attack",
"were caught in a sweep attack"
)
), //can't test solo
),
FALL(4320,
Arrays.asList(
"hit the ground too hard",
"fell from a high place",
"fell too far"
)
), //works
),
FALLING_BLOCK(4320,
Arrays.asList(
"were squashed",
"were crushed",
"were shattered"
)
), //works
),
FIRE(4320,
Arrays.asList(
"went up in flames",
"walked into fire"
)
), //works
),
FIRE_TICK(4320,
Arrays.asList(
"burned to death",
"burned to a crisp"
)
), //works
),
FLY_INTO_WALL(4320,
Collections.singletonList(
"experienced kinetic energy"
)
), //works
FREEZING(4320,
),
FREEZE(4320,
Collections.singletonList("froze to death")
),//works
),
HOT_FLOOR(4320,
Arrays.asList(
"discovered the floor was %killer% and hot",
"walked into %killer% and melted"
)
), //works
),
KILL(0,
Arrays.asList(
"died",
"was killed"
)),
LAVA(4320,
Arrays.asList(
"tried to swim in lava",
"lost the floor is lava game"
)
), //works
),
LIGHTNING(4320,
Collections.singletonList(
"were struck by"
)
), //works
),
MAGIC(2880,
Collections.singletonList(
"were killed with magic"
)
), //works
),
PLAYER_MAGIC(7200,
Collections.singletonList(
"were killed with magic"
)
), //works
),
POISON(4320,
Arrays.asList(
"drank the wrong potion",
"got injected by poison"
)
), //unable to replicate in vanilla
),
PROJECTILE(2880,
Arrays.asList(
"were shot",
Expand All @@ -150,25 +155,30 @@ public enum DamageCause {
"were shot",
"were impaled"
)
), //works
),
SONIC_BOOM(2880,
Collections.singletonList(
"was obliterated by a sonically-charged shriek"
)
),
STARVATION(4320,
Arrays.asList(
"starved to death",
"couldn't find food"
)
), //works
),
SUFFOCATION(4320,
Arrays.asList(
"suffocated",
"were too soft for this world"
)
), //works
),
SUICIDE(0,
Arrays.asList(
"died",
"committed suicide"
)
), //works
),
THORNS(2880,
Collections.singletonList(
"were killed due to deflected damage"
Expand All @@ -178,34 +188,39 @@ public enum DamageCause {
Collections.singletonList(
"were killed due to deflected damage"
)
), //works
),
VOID(4320,
Arrays.asList(
"fell out of the world",
"didn't want to live in this world anymore",
"were sucked into the void"
)
), //works
),
WITHER(2880,
Collections.singletonList(
"withered away"
)
), //works
),
WORLD_BORDER(0,
Collections.singletonList(
"left the confines of this world"
)
),
COMBAT_LOG(2880,
Collections.singletonList(
"combat logged"
)
), //works
),
PLAYER_COMBAT_LOG(7200,
Collections.singletonList(
"combat logged"
)
), //works
),
REVIVE(7200,
Collections.singletonList(
"revived"
)
); //can't test solo
);

private final int defaultBantime;
private final List<String> defaultDisplayMessages;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
import net.wesjd.anvilgui.AnvilGUI;
import org.bukkit.entity.Player;

import java.util.Collections;

public class ClickActionOpenPlayerSelectionAnvilGui extends AbstractClickAction {
@Override
public void execute(Player player) {
new AnvilGUI.Builder()
.onComplete((playerComplete, text) -> {
new CommandRevive(playerComplete, new String[]{text}).run();
return AnvilGUI.Response.text("");
.onClick((slot, stateSnapshot) -> {
if (slot != AnvilGUI.Slot.OUTPUT) {
return Collections.emptyList();
}

new CommandRevive(stateSnapshot.getPlayer(), new String[]{stateSnapshot.getText()}).run();
return Collections.singletonList(AnvilGUI.ResponseAction.close());
})
.text("Player Name")
.title("Who needs a revive?")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
import com.backtobedrock.augmentedhardcore.AugmentedHardcore;
import com.backtobedrock.augmentedhardcore.domain.enums.*;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.entity.EntityType;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.List;
import java.util.logging.Level;
import java.util.stream.Collectors;

public class ConfigUtils {
public static int checkMin(String id, int value, int min) {
Expand Down
19 changes: 19 additions & 0 deletions src/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,13 @@ BanTimes:
- "discovered the floor was %killer% and hot"
- "walked into %killer% and melted"

#Death caused by /kill command
KILL:
BanTime: 0
DisplayMessages:
- "died"
- "was killed"

#Death caused by direct exposure to lava
LAVA:
BanTime: 4320
Expand Down Expand Up @@ -308,6 +315,12 @@ BanTimes:
- "were shot"
- "were impaled"

#Death caused by the Sonic Boom attack from Warden
SONIC_BOOM:
BanTime: 2880
DisplayMessages:
- "was obliterated by a sonically-charged shriek"

#Death caused by starving due to having an empty hunger bar
STARVATION:
BanTime: 4320
Expand Down Expand Up @@ -355,6 +368,12 @@ BanTimes:
DisplayMessages:
- "withered away"

#Death caused by the World Border
WORLD_BORDER:
BanTime: 0
DisplayMessages:
- "left the confines of this world"

#Death caused by combat logging from a monster
COMBAT_LOG:
BanTime: 2880
Expand Down

0 comments on commit 894b24c

Please sign in to comment.