diff --git a/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/MCAccessCBDev.java b/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/MCAccessCBDev.java index 039b7591..21ccd77d 100644 --- a/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/MCAccessCBDev.java +++ b/NCPCompatCBDev/src/main/java/fr/neatmonster/nocheatplus/compat/cbdev/MCAccessCBDev.java @@ -24,166 +24,166 @@ import fr.neatmonster.nocheatplus.utilities.BlockCache; import fr.neatmonster.nocheatplus.utilities.ReflectionUtil; public class MCAccessCBDev implements MCAccess{ - - /** - * Constructor to let it fail. - */ - public MCAccessCBDev() { - getCommandMap(); - ReflectionUtil.checkMembers("net.minecraft.server.v1_8_R1.", new String[] {"Entity" , "dead"}); - // block bounds, original: minX, maxX, minY, maxY, minZ, maxZ - ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_8_R1.Block.class, - new String[]{"z", "A", "B", "C", "D", "E"}, double.class); - // TODO: Nail it down further. - } - @Override - public String getMCVersion() { - // 1_8_R1 - return "1.8"; - } + /** + * Constructor to let it fail. + */ + public MCAccessCBDev() { + getCommandMap(); + ReflectionUtil.checkMembers("net.minecraft.server.v1_8_R1.", new String[] {"Entity" , "dead"}); + // block bounds, original: minX, maxX, minY, maxY, minZ, maxZ + ReflectionUtil.checkMethodReturnTypesNoArgs(net.minecraft.server.v1_8_R1.Block.class, + new String[]{"z", "A", "B", "C", "D", "E"}, double.class); + // TODO: Nail it down further. + } - @Override - public String getServerVersionTag() { - return "Spigot-CB-1.8-DEV"; - } + @Override + public String getMCVersion() { + // 1_8_R1 + return "1.8"; + } - @Override - public CommandMap getCommandMap() { - return ((CraftServer) Bukkit.getServer()).getCommandMap(); - } + @Override + public String getServerVersionTag() { + return "Spigot-CB-1.8-DEV"; + } - @Override - public BlockCache getBlockCache(final World world) { - return new BlockCacheCBDev(world); - } + @Override + public CommandMap getCommandMap() { + return ((CraftServer) Bukkit.getServer()).getCommandMap(); + } - @Override - public double getHeight(final Entity entity) { - final net.minecraft.server.v1_8_R1.Entity mcEntity = ((CraftEntity) entity).getHandle(); - AxisAlignedBB boundingBox = mcEntity.getBoundingBox(); - final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.getHeadHeight(), boundingBox.e - boundingBox.b)); - if (entity instanceof LivingEntity) { - return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight); - } else return entityHeight; - } + @Override + public BlockCache getBlockCache(final World world) { + return new BlockCacheCBDev(world); + } - @Override - public AlmostBoolean isBlockSolid(final int id) { - final Block block = Block.getById(id); - if (block == null || block.getMaterial() == null) { - return AlmostBoolean.MAYBE; - } - else { - return AlmostBoolean.match(block.getMaterial().isSolid()); - } - } + @Override + public double getHeight(final Entity entity) { + final net.minecraft.server.v1_8_R1.Entity mcEntity = ((CraftEntity) entity).getHandle(); + AxisAlignedBB boundingBox = mcEntity.getBoundingBox(); + final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.getHeadHeight(), boundingBox.e - boundingBox.b)); + if (entity instanceof LivingEntity) { + return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight); + } else return entityHeight; + } - @Override - public AlmostBoolean isBlockLiquid(final int id) { - final Block block = Block.getById(id); - if (block == null || block.getMaterial() == null) { - return AlmostBoolean.MAYBE; - } - else { - return AlmostBoolean.match(block.getMaterial().isLiquid()); - } - } + @Override + public AlmostBoolean isBlockSolid(final int id) { + final Block block = Block.getById(id); + if (block == null || block.getMaterial() == null) { + return AlmostBoolean.MAYBE; + } + else { + return AlmostBoolean.match(block.getMaterial().isSolid()); + } + } - @Override - public double getWidth(final Entity entity) { - return ((CraftEntity) entity).getHandle().width; - } + @Override + public AlmostBoolean isBlockLiquid(final int id) { + final Block block = Block.getById(id); + if (block == null || block.getMaterial() == null) { + return AlmostBoolean.MAYBE; + } + else { + return AlmostBoolean.match(block.getMaterial().isLiquid()); + } + } - @Override - public AlmostBoolean isIllegalBounds(final Player player) { - final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); - if (entityPlayer.dead) { - return AlmostBoolean.NO; - } - // TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though. - final AxisAlignedBB box = entityPlayer.getBoundingBox(); - if (!entityPlayer.isSleeping()) { - // This can not really test stance but height of bounding box. - final double dY = Math.abs(box.e - box.b); - if (dY > 1.8) { - return AlmostBoolean.YES; // dY > 1.65D || - } - if (dY < 0.1D && entityPlayer.length >= 0.1) { - return AlmostBoolean.YES; - } - } - return AlmostBoolean.MAYBE; - } + @Override + public double getWidth(final Entity entity) { + return ((CraftEntity) entity).getHandle().width; + } - @Override - public double getJumpAmplifier(final Player player) { - final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); - if (mcPlayer.hasEffect(MobEffectList.JUMP)) { - return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier(); - } - else { - return Double.NEGATIVE_INFINITY; - } - } + @Override + public AlmostBoolean isIllegalBounds(final Player player) { + final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); + if (entityPlayer.dead) { + return AlmostBoolean.NO; + } + // TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though. + final AxisAlignedBB box = entityPlayer.getBoundingBox(); + if (!entityPlayer.isSleeping()) { + // This can not really test stance but height of bounding box. + final double dY = Math.abs(box.e - box.b); + if (dY > 1.8) { + return AlmostBoolean.YES; // dY > 1.65D || + } + if (dY < 0.1D && entityPlayer.length >= 0.1) { + return AlmostBoolean.YES; + } + } + return AlmostBoolean.MAYBE; + } - @Override - public double getFasterMovementAmplifier(final Player player) { - final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); - if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) { - return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier(); - } - else { - return Double.NEGATIVE_INFINITY; - } - } + @Override + public double getJumpAmplifier(final Player player) { + final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); + if (mcPlayer.hasEffect(MobEffectList.JUMP)) { + return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier(); + } + else { + return Double.NEGATIVE_INFINITY; + } + } - @Override - public int getInvulnerableTicks(final Player player) { - return ((CraftPlayer) player).getHandle().invulnerableTicks; - } + @Override + public double getFasterMovementAmplifier(final Player player) { + final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); + if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) { + return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier(); + } + else { + return Double.NEGATIVE_INFINITY; + } + } - @Override - public void setInvulnerableTicks(final Player player, final int ticks) { - ((CraftPlayer) player).getHandle().invulnerableTicks = ticks; - } + @Override + public int getInvulnerableTicks(final Player player) { + return ((CraftPlayer) player).getHandle().invulnerableTicks; + } - @Override - public void dealFallDamage(final Player player, final double damage) { - ((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage); - } + @Override + public void setInvulnerableTicks(final Player player, final int ticks) { + ((CraftPlayer) player).getHandle().invulnerableTicks = ticks; + } - @Override - public boolean isComplexPart(final Entity entity) { - return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart; - } + @Override + public void dealFallDamage(final Player player, final double damage) { + ((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage); + } - @Override - public boolean shouldBeZombie(final Player player) { - final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); - return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ; - } + @Override + public boolean isComplexPart(final Entity entity) { + return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart; + } - @Override - public void setDead(final Player player, final int deathTicks) { - final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); + @Override + public boolean shouldBeZombie(final Player player) { + final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); + return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ; + } + + @Override + public void setDead(final Player player, final int deathTicks) { + final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); mcPlayer.deathTicks = deathTicks; mcPlayer.dead = true; - } - - @Override - public boolean hasGravity(final Material mat) { - // TODO: Test/check. - return mat.hasGravity(); - } - -// @Override -// public void correctDirection(final Player player) { -// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); -// // Main direction. -// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw); -// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch); -// // Consider setting the lastYaw here too. -// } - + } + + @Override + public boolean hasGravity(final Material mat) { + // TODO: Test/check. + return mat.hasGravity(); + } + + // @Override + // public void correctDirection(final Player player) { + // final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); + // // Main direction. + // mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw); + // mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch); + // // Consider setting the lastYaw here too. + // } + } 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 e562b543..8fe3478b 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/ModUtil.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/ModUtil.java @@ -19,40 +19,41 @@ import fr.neatmonster.nocheatplus.config.ConfigManager; * */ public class ModUtil { - - private static final ClientMOTD[] motdS = new ClientMOTD[]{ - new ReiMOTD(), - new ZombeMOTD(), - new SmartMovingMOTD(), - new CJBMOTD(), - new MCAutoMapMOTD(), - new JourneyMapMOTD() - }; - /** - * Send block codes to the player according to allowed or disallowed client-mods or client-mod features. - * @param player - */ - public static void motdOnJoin(final Player player) { - final ConfigFile config = ConfigManager.getConfigFile(); - if (!config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ACTIVE)){ - // No message is to be sent. - return; - } - // TODO: Somebody test this all ! - // TODO: add feature to check world specific (!). - - // Check if we allow all the client mods. - final boolean allowAll = config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ALLOWALL); - - String message = ""; - for (int i = 0; i < motdS.length; i++){ - message = motdS[i].onPlayerJoin(message, player, allowAll); - } - - if (!message.isEmpty()){ - player.sendMessage(message); - } - } + // TODO: Consider to register individual codes in a generic way, detect conflicts (+tests?). + private static final ClientMOTD[] motdS = new ClientMOTD[]{ + new ReiMOTD(), + new ZombeMOTD(), + new SmartMovingMOTD(), + new CJBMOTD(), + new MCAutoMapMOTD(), + new JourneyMapMOTD() + }; + + /** + * Send block codes to the player according to allowed or disallowed client-mods or client-mod features. + * @param player + */ + public static void motdOnJoin(final Player player) { + final ConfigFile config = ConfigManager.getConfigFile(); + if (!config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ACTIVE)){ + // No message is to be sent. + return; + } + // TODO: Somebody test this all ! + // TODO: add feature to check world specific (!). + + // Check if we allow all the client mods. + final boolean allowAll = config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ALLOWALL); + + String message = ""; + for (int i = 0; i < motdS.length; i++){ + message = motdS[i].onPlayerJoin(message, player, allowAll); + } + + if (!message.isEmpty()){ + player.sendMessage(message); + } + } } diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/CJBMOTD.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/CJBMOTD.java index 7ecd135a..fb107c6f 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/CJBMOTD.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/CJBMOTD.java @@ -6,40 +6,40 @@ import fr.neatmonster.nocheatplus.permissions.Permissions; public class CJBMOTD extends ClientMOTD { - @Override - public String onPlayerJoin(String message, Player player, boolean allowAll) { - - if (allowAll){ - return message; - } - - String cjb = ""; - - // TODO: Is there a compact version (just one prefix)? - - // TODO: Fly and xray removed ? - - // Disable CJB's fly mod. - if (!player.hasPermission(Permissions.CJB_FLY)){ - cjb += "§3 §9 §2 §0 §0 §1"; - } - - // Disable CJB's xray. - if (!player.hasPermission(Permissions.CJB_XRAY)){ - cjb += "§3 §9 §2 §0 §0 §2"; - } - - // Disable CJB's radar. - if (!player.hasPermission(Permissions.CJB_RADAR)){ - cjb += "§3 §9 §2 §0 §0 §3"; - } - - if (cjb.isEmpty()){ - return message; - } - else{ - return message + cjb; - } - } + @Override + public String onPlayerJoin(String message, Player player, boolean allowAll) { + + if (allowAll){ + return message; + } + + String cjb = ""; + + // TODO: Is there a compact version (just one prefix)? + + // TODO: Fly and xray removed ? + + // Disable CJB's fly mod. + if (!player.hasPermission(Permissions.CJB_FLY)){ + cjb += "§3 §9 §2 §0 §0 §1"; + } + + // Disable CJB's xray. + if (!player.hasPermission(Permissions.CJB_XRAY)){ + cjb += "§3 §9 §2 §0 §0 §2"; + } + + // Disable CJB's radar. + if (!player.hasPermission(Permissions.CJB_RADAR)){ + cjb += "§3 §9 §2 §0 §0 §3"; + } + + if (cjb.isEmpty()){ + return message; + } + else{ + return message + cjb; + } + } } diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ClientMOTD.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ClientMOTD.java index c4368549..62f80877 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ClientMOTD.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ClientMOTD.java @@ -8,13 +8,13 @@ import org.bukkit.entity.Player; * */ public abstract class ClientMOTD { - - /** - * Extend / manipulate the message based on permissions and the allowAll setting. - * @param message - * @param player - * @param allowAll - * @return The message to send / process further. - */ - public abstract String onPlayerJoin(String message, Player player, boolean allowAll); + + /** + * Extend / manipulate the message based on permissions and the allowAll setting. + * @param message + * @param player + * @param allowAll + * @return The message to send / process further. + */ + public abstract String onPlayerJoin(String message, Player player, boolean allowAll); } 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 index 05335c7e..8e183d58 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/JourneyMapMOTD.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/JourneyMapMOTD.java @@ -8,27 +8,27 @@ public class JourneyMapMOTD extends ClientMOTD { @Override public String onPlayerJoin(String message, Player player, boolean allowAll) { - if (allowAll) { - return message; - } + if (allowAll) { + return message; + } - String journeyMap = ""; + String journeyMap = ""; - // Disable JourneyMap's Radar. - if (!player.hasPermission(Permissions.JOURNEY_RADAR)) { - journeyMap += "§3 §6 §3 §6 §3 §6 §e"; - } + // 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"; - } + // 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; - } - } + if (journeyMap.isEmpty()) { + return message; + } else { + return message + journeyMap; + } + } } diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/MCAutoMapMOTD.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/MCAutoMapMOTD.java index 6ae0fe51..b315ce96 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/MCAutoMapMOTD.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/MCAutoMapMOTD.java @@ -6,38 +6,38 @@ import fr.neatmonster.nocheatplus.permissions.Permissions; public class MCAutoMapMOTD extends ClientMOTD { - @Override - public String onPlayerJoin(String message, Player player, boolean allowAll) { + @Override + public String onPlayerJoin(String message, Player player, boolean allowAll) { - if (allowAll){ - return message; - } - - String mcAutoMap = ""; - - // TODO: Is there a compact version (just one prefix)? - - // Disable Minecraft AutoMap's ores. - if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_ORES)){ - mcAutoMap += "§0§0§1§f§e"; - } - - // Disable Minecraft AutoMap's cave mode. - if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_CAVE)){ - mcAutoMap += "§0§0§2§f§e"; - } - - // Disable Minecraft AutoMap's radar. - if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_RADAR)){ - mcAutoMap += "§0§0§3§4§5§6§7§8§f§e"; - } - - if (mcAutoMap.isEmpty()){ - return message; - } - else{ - return message + mcAutoMap; - } - } + if (allowAll){ + return message; + } + + String mcAutoMap = ""; + + // TODO: Is there a compact version (just one prefix)? + + // Disable Minecraft AutoMap's ores. + if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_ORES)){ + mcAutoMap += "§0§0§1§f§e"; + } + + // Disable Minecraft AutoMap's cave mode. + if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_CAVE)){ + mcAutoMap += "§0§0§2§f§e"; + } + + // Disable Minecraft AutoMap's radar. + if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_RADAR)){ + mcAutoMap += "§0§0§3§4§5§6§7§8§f§e"; + } + + if (mcAutoMap.isEmpty()){ + return message; + } + else{ + return message + mcAutoMap; + } + } } diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ReiMOTD.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ReiMOTD.java index d4e734cc..3c8a6145 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ReiMOTD.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ReiMOTD.java @@ -24,59 +24,59 @@ import fr.neatmonster.nocheatplus.permissions.Permissions; */ public class ReiMOTD extends ClientMOTD { - @Override - public String onPlayerJoin(String message, Player player, boolean allowAll) { - String rei = ""; - - // Allow Rei's Minimap's cave mode. - if (allowAll || player.hasPermission(Permissions.REI_CAVE)){ - rei += "§1"; - } - - // Allow Rei's Minimap's radar. - if (allowAll || player.hasPermission(Permissions.REI_RADAR)){ - // TODO: Does this allow all radar features? - rei += "§2§3§4§5§6§7"; - } - else{ - // Allow Rei's Minimap's player radar - if (allowAll || player.hasPermission(Permissions.REI_RADAR_PLAYER)){ - rei += "§2"; - } + @Override + public String onPlayerJoin(String message, Player player, boolean allowAll) { + String rei = ""; - // Allow Rei's Minimap's animal radar - if (allowAll || player.hasPermission(Permissions.REI_RADAR_ANIMAL)){ - rei += "§3"; - } + // Allow Rei's Minimap's cave mode. + if (allowAll || player.hasPermission(Permissions.REI_CAVE)){ + rei += "§1"; + } - // Allow Rei's Minimap's mob radar - if (allowAll || player.hasPermission(Permissions.REI_RADAR_MOB)){ - rei += "§4"; - } + // Allow Rei's Minimap's radar. + if (allowAll || player.hasPermission(Permissions.REI_RADAR)){ + // TODO: Does this allow all radar features? + rei += "§2§3§4§5§6§7"; + } + else{ + // Allow Rei's Minimap's player radar + if (allowAll || player.hasPermission(Permissions.REI_RADAR_PLAYER)){ + rei += "§2"; + } - // Allow Rei's Minimap's slime radar - if (allowAll || player.hasPermission(Permissions.REI_RADAR_SLIME)){ - rei += "§5"; - } + // Allow Rei's Minimap's animal radar + if (allowAll || player.hasPermission(Permissions.REI_RADAR_ANIMAL)){ + rei += "§3"; + } - // Allow Rei's Minimap's squid radar - if (allowAll || player.hasPermission(Permissions.REI_RADAR_SQUID)){ - rei += "§6"; - } + // Allow Rei's Minimap's mob radar + if (allowAll || player.hasPermission(Permissions.REI_RADAR_MOB)){ + rei += "§4"; + } - // Allow Rei's Minimap's other radar - if (allowAll || player.hasPermission(Permissions.REI_RADAR_OTHER)){ - rei += "§7"; - } - } - - if (rei.isEmpty()){ - return message; - } - else{ - rei = "§0§0" + rei + "§e§f"; - return message + rei; - } - } + // Allow Rei's Minimap's slime radar + if (allowAll || player.hasPermission(Permissions.REI_RADAR_SLIME)){ + rei += "§5"; + } + + // Allow Rei's Minimap's squid radar + if (allowAll || player.hasPermission(Permissions.REI_RADAR_SQUID)){ + rei += "§6"; + } + + // Allow Rei's Minimap's other radar + if (allowAll || player.hasPermission(Permissions.REI_RADAR_OTHER)){ + rei += "§7"; + } + } + + if (rei.isEmpty()){ + return message; + } + else{ + rei = "§0§0" + rei + "§e§f"; + return message + rei; + } + } } diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/SmartMovingMOTD.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/SmartMovingMOTD.java index 1fcac36e..f3e6272e 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/SmartMovingMOTD.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/SmartMovingMOTD.java @@ -6,53 +6,53 @@ import fr.neatmonster.nocheatplus.permissions.Permissions; public class SmartMovingMOTD extends ClientMOTD { - @Override - public String onPlayerJoin(String message, Player player, boolean allowAll) { - - if (allowAll){ - return message; - } - - String smartMoving = ""; - - // TODO: Is there a compact version (just one prefix)? - - // Disable Smart Moving's climbing. - if (!player.hasPermission(Permissions.SMARTMOVING_CLIMBING)){ - smartMoving += "§0§1§0§1§2§f§f"; - } - - // Disable Smart Moving's climbing. - if (!player.hasPermission(Permissions.SMARTMOVING_SWIMMING)){ - smartMoving += "§0§1§3§4§f§f"; - } - - // Disable Smart Moving's climbing. - if (!player.hasPermission(Permissions.SMARTMOVING_CRAWLING)){ - smartMoving += "§0§1§5§f§f"; - } - - // Disable Smart Moving's climbing. - if (!player.hasPermission(Permissions.SMARTMOVING_SLIDING)){ - smartMoving += "§0§1§6§f§f"; - } - - // Disable Smart Moving's climbing. - if (!player.hasPermission(Permissions.SMARTMOVING_JUMPING)){ - smartMoving += "§0§1§8§9§a§b§f§f"; - } - - // Disable Smart Moving's climbing. - if (!player.hasPermission(Permissions.SMARTMOVING_FLYING)){ - smartMoving += "§0§1§7§f§f"; - } - - if (smartMoving.isEmpty()){ - return message; - } - else{ - return message + smartMoving; - } - } + @Override + public String onPlayerJoin(String message, Player player, boolean allowAll) { + + if (allowAll){ + return message; + } + + String smartMoving = ""; + + // TODO: Is there a compact version (just one prefix)? + + // Disable Smart Moving's climbing. + if (!player.hasPermission(Permissions.SMARTMOVING_CLIMBING)){ + smartMoving += "§0§1§0§1§2§f§f"; + } + + // Disable Smart Moving's climbing. + if (!player.hasPermission(Permissions.SMARTMOVING_SWIMMING)){ + smartMoving += "§0§1§3§4§f§f"; + } + + // Disable Smart Moving's climbing. + if (!player.hasPermission(Permissions.SMARTMOVING_CRAWLING)){ + smartMoving += "§0§1§5§f§f"; + } + + // Disable Smart Moving's climbing. + if (!player.hasPermission(Permissions.SMARTMOVING_SLIDING)){ + smartMoving += "§0§1§6§f§f"; + } + + // Disable Smart Moving's climbing. + if (!player.hasPermission(Permissions.SMARTMOVING_JUMPING)){ + smartMoving += "§0§1§8§9§a§b§f§f"; + } + + // Disable Smart Moving's climbing. + if (!player.hasPermission(Permissions.SMARTMOVING_FLYING)){ + smartMoving += "§0§1§7§f§f"; + } + + if (smartMoving.isEmpty()){ + return message; + } + else{ + return message + smartMoving; + } + } } diff --git a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ZombeMOTD.java b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ZombeMOTD.java index 986ad38b..65e0b59c 100644 --- a/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ZombeMOTD.java +++ b/NCPCore/src/main/java/fr/neatmonster/nocheatplus/clients/motd/ZombeMOTD.java @@ -6,36 +6,36 @@ import fr.neatmonster.nocheatplus.permissions.Permissions; public class ZombeMOTD extends ClientMOTD { - @Override - public String onPlayerJoin(String message, Player player, boolean allowAll) { - - String zombe = ""; - - // TODO: Is there a compact version (just one prefix)? - - // Disable Zombe's noclip. - if (allowAll || player.hasPermission(Permissions.ZOMBE_NOCLIP)){ - zombe += "§f §f §4 §0 §9 §6"; - } - - if (!allowAll){ - // Disable Zombe's fly mod. - if (!player.hasPermission(Permissions.ZOMBE_FLY)){ - zombe += "§f §f §1 §0 §2 §4"; - } - - // Disable Zombe's cheat. - if (!player.hasPermission(Permissions.ZOMBE_CHEAT)){ - zombe += "§f §f §2 §0 §4 §8"; - } - } - - if (zombe.isEmpty()){ - return message; - } - else{ - return message + zombe; - } - } + @Override + public String onPlayerJoin(String message, Player player, boolean allowAll) { + + String zombe = ""; + + // TODO: Is there a compact version (just one prefix)? + + // Disable Zombe's noclip. + if (allowAll || player.hasPermission(Permissions.ZOMBE_NOCLIP)){ + zombe += "§f §f §4 §0 §9 §6"; + } + + if (!allowAll){ + // Disable Zombe's fly mod. + if (!player.hasPermission(Permissions.ZOMBE_FLY)){ + zombe += "§f §f §1 §0 §2 §4"; + } + + // Disable Zombe's cheat. + if (!player.hasPermission(Permissions.ZOMBE_CHEAT)){ + zombe += "§f §f §2 §0 §4 §8"; + } + } + + if (zombe.isEmpty()){ + return message; + } + else{ + return message + zombe; + } + } }