Notify on attempted use of "plotme"

- Users are now notified that the server is using PlotSquared rather
than PlotMe when they attempt to use the /plotme command

(The developers over at PlotMe have complained that having the alias is
confusing, so this should clear things up)
This commit is contained in:
boy0001 2015-01-10 13:19:39 +11:00
parent 496f8a3284
commit e2c665a732
4 changed files with 28 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<groupId>com.intellectualcrafters</groupId> <groupId>com.intellectualcrafters</groupId>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.5.4</version> <version>2.5.5</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -57,6 +57,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.server.PluginEnableEvent; import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.generator.ChunkGenerator; import org.bukkit.generator.ChunkGenerator;
@ -765,6 +766,7 @@ import java.util.concurrent.TimeUnit;
config.set("version", config_ver); config.set("version", config_ver);
final Map<String, Object> options = new HashMap<>(); final Map<String, Object> options = new HashMap<>();
options.put("auto_update", false); options.put("auto_update", false);
options.put("plotme-alias", Settings.USE_PLOTME_ALIAS);
options.put("plotme-convert.enabled", Settings.CONVERT_PLOTME); options.put("plotme-convert.enabled", Settings.CONVERT_PLOTME);
options.put("claim.max-auto-area", Settings.MAX_AUTO_SIZE); options.put("claim.max-auto-area", Settings.MAX_AUTO_SIZE);
options.put("UUID.offline", Settings.OFFLINE_MODE); 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."); 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.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.CONVERT_PLOTME = config.getBoolean("plotme-convert.enabled");
Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs"); Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs");
Settings.WORLDGUARD = config.getBoolean("worldguard.enabled"); 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 @EventHandler
public static void worldLoad(WorldLoadEvent event) { public static void worldLoad(WorldLoadEvent event) {
if (!UUIDHandler.CACHED) { if (!UUIDHandler.CACHED) {

View File

@ -312,6 +312,10 @@ public enum C {
* Left * Left
*/ */
LEFT_PLOT("&cYou left a plot"), 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 * Wait
*/ */

View File

@ -39,6 +39,7 @@ public class Settings {
* *
*/ */
public static boolean CONVERT_PLOTME = true; public static boolean CONVERT_PLOTME = true;
public static boolean USE_PLOTME_ALIAS = false;
/** /**
* *
*/ */