diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index ce4708e4c..48c3fc6fd 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -6,7 +6,7 @@ com.intellectualcrafters PlotSquared - 2.5.4 + 2.5.5 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index 4bf999aae..9f71e556d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -57,6 +57,7 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.generator.ChunkGenerator; @@ -765,6 +766,7 @@ import java.util.concurrent.TimeUnit; config.set("version", config_ver); final Map options = new HashMap<>(); options.put("auto_update", false); + options.put("plotme-alias", Settings.USE_PLOTME_ALIAS); options.put("plotme-convert.enabled", Settings.CONVERT_PLOTME); options.put("claim.max-auto-area", Settings.MAX_AUTO_SIZE); options.put("UUID.offline", Settings.OFFLINE_MODE); @@ -798,6 +800,7 @@ import java.util.concurrent.TimeUnit; sendConsoleSenderMessage(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off."); } Settings.TELEPORT_ON_LOGIN = config.getBoolean("teleport.on_login"); + Settings.USE_PLOTME_ALIAS = config.getBoolean("plotme-alias"); Settings.CONVERT_PLOTME = config.getBoolean("plotme-convert.enabled"); Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs"); Settings.WORLDGUARD = config.getBoolean("worldguard.enabled"); @@ -843,6 +846,24 @@ import java.util.concurrent.TimeUnit; } } + @EventHandler + public void PlayerCommand(PlayerCommandPreprocessEvent event) { + String message = event.getMessage(); + if (message.toLowerCase().startsWith("/plotme")) { + Plugin plotme = Bukkit.getPluginManager().getPlugin("PlotMe"); + if (plotme == null) { + Player player = event.getPlayer(); + if (Settings.USE_PLOTME_ALIAS) { + player.performCommand(message.replace("/plotme", "plots")); + } + else { + PlayerFunctions.sendMessage(player, C.NOT_USING_PLOTME); + } + event.setCancelled(true); + } + } + } + @EventHandler public static void worldLoad(WorldLoadEvent event) { if (!UUIDHandler.CACHED) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java index c4cc0356a..6d4232c6b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -312,6 +312,10 @@ public enum C { * Left */ LEFT_PLOT("&cYou left a plot"), + /* + * PlotMe + */ + NOT_USING_PLOTME("&cThis server uses the &6PlotSquared &cplot management system. Please use the &6/plots &cinstead"), /* * Wait */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java index 11589cd00..59bbe87d4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -38,7 +38,8 @@ public class Settings { /** * */ - public static boolean CONVERT_PLOTME = true; + public static boolean CONVERT_PLOTME = true; + public static boolean USE_PLOTME_ALIAS = false; /** * */