From 247d2560823b6d2635e926e0fdd07a961ba94008 Mon Sep 17 00:00:00 2001 From: Youri Kersten Date: Fri, 28 Nov 2014 16:20:00 +0100 Subject: [PATCH] Block JourneyMap radar and cavemappings http://minecraft.curseforge.com/mc-mods/225341-journeymap-server --- .gitignore | 7 ++++ .../nocheatplus/clients/ModUtil.java | 4 ++- .../clients/motd/JourneyMapMOTD.java | 34 +++++++++++++++++++ .../nocheatplus/permissions/Permissions.java | 5 ++- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/JourneyMapMOTD.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..0db70f67 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.class + +# Package Files # +*.jar +*.war +*.ear +*/target/ \ No newline at end of file diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/ModUtil.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/ModUtil.java index 8ab2c4b8..e562b543 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/ModUtil.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/ModUtil.java @@ -4,6 +4,7 @@ import org.bukkit.entity.Player; import fr.neatmonster.nocheatplus.clients.motd.CJBMOTD; import fr.neatmonster.nocheatplus.clients.motd.ClientMOTD; +import fr.neatmonster.nocheatplus.clients.motd.JourneyMapMOTD; import fr.neatmonster.nocheatplus.clients.motd.MCAutoMapMOTD; import fr.neatmonster.nocheatplus.clients.motd.ReiMOTD; import fr.neatmonster.nocheatplus.clients.motd.SmartMovingMOTD; @@ -24,7 +25,8 @@ public class ModUtil { new ZombeMOTD(), new SmartMovingMOTD(), new CJBMOTD(), - new MCAutoMapMOTD() + new MCAutoMapMOTD(), + new JourneyMapMOTD() }; /** diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/JourneyMapMOTD.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/JourneyMapMOTD.java new file mode 100644 index 00000000..05335c7e --- /dev/null +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/JourneyMapMOTD.java @@ -0,0 +1,34 @@ +package fr.neatmonster.nocheatplus.clients.motd; + +import fr.neatmonster.nocheatplus.permissions.Permissions; +import org.bukkit.entity.Player; + +public class JourneyMapMOTD extends ClientMOTD { + + @Override + public String onPlayerJoin(String message, Player player, boolean allowAll) { + + if (allowAll) { + return message; + } + + String journeyMap = ""; + + // Disable JourneyMap's Radar. + if (!player.hasPermission(Permissions.JOURNEY_RADAR)) { + journeyMap += "§3 §6 §3 §6 §3 §6 §e"; + } + + // Disable JourneyMap's CaveMap. + if (!player.hasPermission(Permissions.JOURNEY_CAVE)) { + journeyMap += "§3 §6 §3 §6 §3 §6 §d"; + } + + if (journeyMap.isEmpty()) { + return message; + } else { + return message + journeyMap; + } + } + +} diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/permissions/Permissions.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/permissions/Permissions.java index b052b148..1bbcfc83 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/permissions/Permissions.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/permissions/Permissions.java @@ -161,5 +161,8 @@ public class Permissions { public static final String ZOMBE_CHEAT = ZOMBE + ".cheat"; public static final String ZOMBE_FLY = ZOMBE + ".fly"; public static final String ZOMBE_NOCLIP = ZOMBE + ".noclip"; - + + private static final String JOURNEY = MODS + ".journey"; + public static final String JOURNEY_RADAR = JOURNEY + ".radar"; + public static final String JOURNEY_CAVE = JOURNEY + ".cavemap"; }