Skip to content

Commit

Permalink
Update 4.3.1: Fixed plugin not starting on 1.7 and below, and disable…
Browse files Browse the repository at this point in the history
…d /setmaxhealth on 1.3 because it does not work.
  • Loading branch information
Calcilore committed Jun 22, 2024
1 parent ccb2f90 commit 4fc2c3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.serble.EsTools</groupId>
<artifactId>EsTools</artifactId>
<version>4.3.1</version>
<version>4.3.2</version>
<packaging>jar</packaging>

<name>EsTools</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
import java.util.ArrayList;

public class GameModeCommand extends MultiPlayerCommand {
private final GameMode gameMode;
private GameMode gameMode;

public GameModeCommand(GameMode gameMode) {
this.gameMode = gameMode;
public GameModeCommand(String gameMode) {
// If it's an old version it will throw when trying to get Enum Value, so we ignore it.
try {
this.gameMode = GameMode.valueOf(gameMode);
} catch (IllegalArgumentException ignored) {}
}

@Override
Expand Down
11 changes: 5 additions & 6 deletions src/main/java/net/serble/estools/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.bstats.bukkit.Metrics;
import org.bstats.charts.SimplePie;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.command.PluginCommand;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
Expand Down Expand Up @@ -75,10 +74,10 @@ public void onEnable() {
}

// Commands
sc("gms", "gamemode.survival", new GameModeCommand(GameMode.SURVIVAL));
sc("gmc", "gamemode.creative", new GameModeCommand(GameMode.CREATIVE));
sc("gma", "gamemode.adventure", new GameModeCommand(GameMode.ADVENTURE), 3);
sc("gmsp", "gamemode.spectator", new GameModeCommand(GameMode.SPECTATOR), 8);
sc("gms", "gamemode.survival", new GameModeCommand("SURVIVAL"));
sc("gmc", "gamemode.creative", new GameModeCommand("CREATIVE"));
sc("gma", "gamemode.adventure", new GameModeCommand("ADVENTURE"), 3);
sc("gmsp", "gamemode.spectator", new GameModeCommand("SPECTATOR"), 8);
sc("tphere", "tp", new TpHere());
sc("tpall", "tp", new TpAll());
sc("feed", "feed", new Feed());
Expand Down Expand Up @@ -124,7 +123,7 @@ public void onEnable() {
sc("heal", "heal", new Heal());
sc("suicide", "suicide", new Suicide());
sc("sethealth", "sethealth", new SetHealth());
sc("setmaxhealth", "setmaxhealth", new SetMaxHealth(), 3);
sc("setmaxhealth", "setmaxhealth", new SetMaxHealth(), 4);
sc("getinfo", "getinfo", new GetInfo());

sc("editsign", "editsign", new EditSign());
Expand Down

0 comments on commit 4fc2c3b

Please sign in to comment.