This commit is contained in:
asofold 2014-11-29 14:19:39 +01:00
parent 02ea246ebb
commit 3cc5aef282
9 changed files with 400 additions and 399 deletions

View File

@ -24,166 +24,166 @@ import fr.neatmonster.nocheatplus.utilities.BlockCache;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil; import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
public class MCAccessCBDev implements MCAccess{ 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() { * Constructor to let it fail.
// 1_8_R1 */
return "1.8"; 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 @Override
public String getServerVersionTag() { public String getMCVersion() {
return "Spigot-CB-1.8-DEV"; // 1_8_R1
} return "1.8";
}
@Override @Override
public CommandMap getCommandMap() { public String getServerVersionTag() {
return ((CraftServer) Bukkit.getServer()).getCommandMap(); return "Spigot-CB-1.8-DEV";
} }
@Override @Override
public BlockCache getBlockCache(final World world) { public CommandMap getCommandMap() {
return new BlockCacheCBDev(world); return ((CraftServer) Bukkit.getServer()).getCommandMap();
} }
@Override @Override
public double getHeight(final Entity entity) { public BlockCache getBlockCache(final World world) {
final net.minecraft.server.v1_8_R1.Entity mcEntity = ((CraftEntity) entity).getHandle(); return new BlockCacheCBDev(world);
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 @Override
public AlmostBoolean isBlockSolid(final int id) { public double getHeight(final Entity entity) {
final Block block = Block.getById(id); final net.minecraft.server.v1_8_R1.Entity mcEntity = ((CraftEntity) entity).getHandle();
if (block == null || block.getMaterial() == null) { AxisAlignedBB boundingBox = mcEntity.getBoundingBox();
return AlmostBoolean.MAYBE; final double entityHeight = Math.max(mcEntity.length, Math.max(mcEntity.getHeadHeight(), boundingBox.e - boundingBox.b));
} if (entity instanceof LivingEntity) {
else { return Math.max(((LivingEntity) entity).getEyeHeight(), entityHeight);
return AlmostBoolean.match(block.getMaterial().isSolid()); } else return entityHeight;
} }
}
@Override @Override
public AlmostBoolean isBlockLiquid(final int id) { public AlmostBoolean isBlockSolid(final int id) {
final Block block = Block.getById(id); final Block block = Block.getById(id);
if (block == null || block.getMaterial() == null) { if (block == null || block.getMaterial() == null) {
return AlmostBoolean.MAYBE; return AlmostBoolean.MAYBE;
} }
else { else {
return AlmostBoolean.match(block.getMaterial().isLiquid()); return AlmostBoolean.match(block.getMaterial().isSolid());
} }
} }
@Override @Override
public double getWidth(final Entity entity) { public AlmostBoolean isBlockLiquid(final int id) {
return ((CraftEntity) entity).getHandle().width; final Block block = Block.getById(id);
} if (block == null || block.getMaterial() == null) {
return AlmostBoolean.MAYBE;
}
else {
return AlmostBoolean.match(block.getMaterial().isLiquid());
}
}
@Override @Override
public AlmostBoolean isIllegalBounds(final Player player) { public double getWidth(final Entity entity) {
final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle(); return ((CraftEntity) entity).getHandle().width;
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 @Override
public double getJumpAmplifier(final Player player) { public AlmostBoolean isIllegalBounds(final Player player) {
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); final EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
if (mcPlayer.hasEffect(MobEffectList.JUMP)) { if (entityPlayer.dead) {
return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier(); return AlmostBoolean.NO;
} }
else { // TODO: Does this need a method call for the "real" box? Might be no problem during moving events, though.
return Double.NEGATIVE_INFINITY; 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 @Override
public double getFasterMovementAmplifier(final Player player) { public double getJumpAmplifier(final Player player) {
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
if (mcPlayer.hasEffect(MobEffectList.FASTER_MOVEMENT)) { if (mcPlayer.hasEffect(MobEffectList.JUMP)) {
return mcPlayer.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier(); return mcPlayer.getEffect(MobEffectList.JUMP).getAmplifier();
} }
else { else {
return Double.NEGATIVE_INFINITY; return Double.NEGATIVE_INFINITY;
} }
} }
@Override @Override
public int getInvulnerableTicks(final Player player) { public double getFasterMovementAmplifier(final Player player) {
return ((CraftPlayer) player).getHandle().invulnerableTicks; 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 @Override
public void setInvulnerableTicks(final Player player, final int ticks) { public int getInvulnerableTicks(final Player player) {
((CraftPlayer) player).getHandle().invulnerableTicks = ticks; return ((CraftPlayer) player).getHandle().invulnerableTicks;
} }
@Override @Override
public void dealFallDamage(final Player player, final double damage) { public void setInvulnerableTicks(final Player player, final int ticks) {
((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage); ((CraftPlayer) player).getHandle().invulnerableTicks = ticks;
} }
@Override @Override
public boolean isComplexPart(final Entity entity) { public void dealFallDamage(final Player player, final double damage) {
return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart; ((CraftPlayer) player).getHandle().damageEntity(DamageSource.FALL, (float) damage);
} }
@Override @Override
public boolean shouldBeZombie(final Player player) { public boolean isComplexPart(final Entity entity) {
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); return ((CraftEntity) entity).getHandle() instanceof EntityComplexPart;
return !mcPlayer.dead && mcPlayer.getHealth() <= 0.0f ; }
}
@Override @Override
public void setDead(final Player player, final int deathTicks) { public boolean shouldBeZombie(final Player player) {
final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); 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.deathTicks = deathTicks;
mcPlayer.dead = true; mcPlayer.dead = true;
} }
@Override @Override
public boolean hasGravity(final Material mat) { public boolean hasGravity(final Material mat) {
// TODO: Test/check. // TODO: Test/check.
return mat.hasGravity(); return mat.hasGravity();
} }
// @Override // @Override
// public void correctDirection(final Player player) { // public void correctDirection(final Player player) {
// final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle(); // final EntityPlayer mcPlayer = ((CraftPlayer) player).getHandle();
// // Main direction. // // Main direction.
// mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw); // mcPlayer.yaw = LocUtil.correctYaw(mcPlayer.yaw);
// mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch); // mcPlayer.pitch = LocUtil.correctPitch(mcPlayer.pitch);
// // Consider setting the lastYaw here too. // // Consider setting the lastYaw here too.
// } // }
} }

View File

@ -19,40 +19,41 @@ import fr.neatmonster.nocheatplus.config.ConfigManager;
* *
*/ */
public class ModUtil { public class ModUtil {
private static final ClientMOTD[] motdS = new ClientMOTD[]{
new ReiMOTD(),
new ZombeMOTD(),
new SmartMovingMOTD(),
new CJBMOTD(),
new MCAutoMapMOTD(),
new JourneyMapMOTD()
};
/** // TODO: Consider to register individual codes in a generic way, detect conflicts (+tests?).
* Send block codes to the player according to allowed or disallowed client-mods or client-mod features. private static final ClientMOTD[] motdS = new ClientMOTD[]{
* @param player new ReiMOTD(),
*/ new ZombeMOTD(),
public static void motdOnJoin(final Player player) { new SmartMovingMOTD(),
final ConfigFile config = ConfigManager.getConfigFile(); new CJBMOTD(),
if (!config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ACTIVE)){ new MCAutoMapMOTD(),
// No message is to be sent. new JourneyMapMOTD()
return; };
}
// TODO: Somebody test this all ! /**
// TODO: add feature to check world specific (!). * Send block codes to the player according to allowed or disallowed client-mods or client-mod features.
* @param player
// Check if we allow all the client mods. */
final boolean allowAll = config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ALLOWALL); public static void motdOnJoin(final Player player) {
final ConfigFile config = ConfigManager.getConfigFile();
String message = ""; if (!config.getBoolean(ConfPaths.PROTECT_CLIENTS_MOTD_ACTIVE)){
for (int i = 0; i < motdS.length; i++){ // No message is to be sent.
message = motdS[i].onPlayerJoin(message, player, allowAll); return;
} }
// TODO: Somebody test this all !
if (!message.isEmpty()){ // TODO: add feature to check world specific (!).
player.sendMessage(message);
} // 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);
}
}
} }

View File

@ -6,40 +6,40 @@ import fr.neatmonster.nocheatplus.permissions.Permissions;
public class CJBMOTD extends ClientMOTD { public class CJBMOTD extends ClientMOTD {
@Override @Override
public String onPlayerJoin(String message, Player player, boolean allowAll) { public String onPlayerJoin(String message, Player player, boolean allowAll) {
if (allowAll){ if (allowAll){
return message; return message;
} }
String cjb = ""; String cjb = "";
// TODO: Is there a compact version (just one prefix)? // TODO: Is there a compact version (just one prefix)?
// TODO: Fly and xray removed ? // TODO: Fly and xray removed ?
// Disable CJB's fly mod. // Disable CJB's fly mod.
if (!player.hasPermission(Permissions.CJB_FLY)){ if (!player.hasPermission(Permissions.CJB_FLY)){
cjb += "§3 §9 §2 §0 §0 §1"; cjb += "§3 §9 §2 §0 §0 §1";
} }
// Disable CJB's xray. // Disable CJB's xray.
if (!player.hasPermission(Permissions.CJB_XRAY)){ if (!player.hasPermission(Permissions.CJB_XRAY)){
cjb += "§3 §9 §2 §0 §0 §2"; cjb += "§3 §9 §2 §0 §0 §2";
} }
// Disable CJB's radar. // Disable CJB's radar.
if (!player.hasPermission(Permissions.CJB_RADAR)){ if (!player.hasPermission(Permissions.CJB_RADAR)){
cjb += "§3 §9 §2 §0 §0 §3"; cjb += "§3 §9 §2 §0 §0 §3";
} }
if (cjb.isEmpty()){ if (cjb.isEmpty()){
return message; return message;
} }
else{ else{
return message + cjb; return message + cjb;
} }
} }
} }

View File

@ -8,13 +8,13 @@ import org.bukkit.entity.Player;
* *
*/ */
public abstract class ClientMOTD { public abstract class ClientMOTD {
/** /**
* Extend / manipulate the message based on permissions and the allowAll setting. * Extend / manipulate the message based on permissions and the allowAll setting.
* @param message * @param message
* @param player * @param player
* @param allowAll * @param allowAll
* @return The message to send / process further. * @return The message to send / process further.
*/ */
public abstract String onPlayerJoin(String message, Player player, boolean allowAll); public abstract String onPlayerJoin(String message, Player player, boolean allowAll);
} }

View File

@ -8,27 +8,27 @@ public class JourneyMapMOTD extends ClientMOTD {
@Override @Override
public String onPlayerJoin(String message, Player player, boolean allowAll) { public String onPlayerJoin(String message, Player player, boolean allowAll) {
if (allowAll) { if (allowAll) {
return message; return message;
} }
String journeyMap = ""; String journeyMap = "";
// Disable JourneyMap's Radar. // Disable JourneyMap's Radar.
if (!player.hasPermission(Permissions.JOURNEY_RADAR)) { if (!player.hasPermission(Permissions.JOURNEY_RADAR)) {
journeyMap += "§3 §6 §3 §6 §3 §6 §e"; journeyMap += "§3 §6 §3 §6 §3 §6 §e";
} }
// Disable JourneyMap's CaveMap. // Disable JourneyMap's CaveMap.
if (!player.hasPermission(Permissions.JOURNEY_CAVE)) { if (!player.hasPermission(Permissions.JOURNEY_CAVE)) {
journeyMap += "§3 §6 §3 §6 §3 §6 §d"; journeyMap += "§3 §6 §3 §6 §3 §6 §d";
} }
if (journeyMap.isEmpty()) { if (journeyMap.isEmpty()) {
return message; return message;
} else { } else {
return message + journeyMap; return message + journeyMap;
} }
} }
} }

View File

@ -6,38 +6,38 @@ import fr.neatmonster.nocheatplus.permissions.Permissions;
public class MCAutoMapMOTD extends ClientMOTD { public class MCAutoMapMOTD extends ClientMOTD {
@Override @Override
public String onPlayerJoin(String message, Player player, boolean allowAll) { public String onPlayerJoin(String message, Player player, boolean allowAll) {
if (allowAll){ if (allowAll){
return message; return message;
} }
String mcAutoMap = ""; String mcAutoMap = "";
// TODO: Is there a compact version (just one prefix)? // TODO: Is there a compact version (just one prefix)?
// Disable Minecraft AutoMap's ores. // Disable Minecraft AutoMap's ores.
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_ORES)){ if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_ORES)){
mcAutoMap += "§0§0§1§f§e"; mcAutoMap += "§0§0§1§f§e";
} }
// Disable Minecraft AutoMap's cave mode. // Disable Minecraft AutoMap's cave mode.
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_CAVE)){ if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_CAVE)){
mcAutoMap += "§0§0§2§f§e"; mcAutoMap += "§0§0§2§f§e";
} }
// Disable Minecraft AutoMap's radar. // Disable Minecraft AutoMap's radar.
if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_RADAR)){ if (!player.hasPermission(Permissions.MINECRAFTAUTOMAP_RADAR)){
mcAutoMap += "§0§0§3§4§5§6§7§8§f§e"; mcAutoMap += "§0§0§3§4§5§6§7§8§f§e";
} }
if (mcAutoMap.isEmpty()){ if (mcAutoMap.isEmpty()){
return message; return message;
} }
else{ else{
return message + mcAutoMap; return message + mcAutoMap;
} }
} }
} }

View File

@ -24,59 +24,59 @@ import fr.neatmonster.nocheatplus.permissions.Permissions;
*/ */
public class ReiMOTD extends ClientMOTD { public class ReiMOTD extends ClientMOTD {
@Override @Override
public String onPlayerJoin(String message, Player player, boolean allowAll) { public String onPlayerJoin(String message, Player player, boolean allowAll) {
String rei = ""; 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";
}
// Allow Rei's Minimap's animal radar // Allow Rei's Minimap's cave mode.
if (allowAll || player.hasPermission(Permissions.REI_RADAR_ANIMAL)){ if (allowAll || player.hasPermission(Permissions.REI_CAVE)){
rei += "§3"; rei += "§1";
} }
// Allow Rei's Minimap's mob radar // Allow Rei's Minimap's radar.
if (allowAll || player.hasPermission(Permissions.REI_RADAR_MOB)){ if (allowAll || player.hasPermission(Permissions.REI_RADAR)){
rei += "§4"; // 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 // Allow Rei's Minimap's animal radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_SLIME)){ if (allowAll || player.hasPermission(Permissions.REI_RADAR_ANIMAL)){
rei += "§5"; rei += "§3";
} }
// Allow Rei's Minimap's squid radar // Allow Rei's Minimap's mob radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_SQUID)){ if (allowAll || player.hasPermission(Permissions.REI_RADAR_MOB)){
rei += "§6"; rei += "§4";
} }
// Allow Rei's Minimap's other radar // Allow Rei's Minimap's slime radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_OTHER)){ if (allowAll || player.hasPermission(Permissions.REI_RADAR_SLIME)){
rei += "§7"; rei += "§5";
} }
}
// Allow Rei's Minimap's squid radar
if (rei.isEmpty()){ if (allowAll || player.hasPermission(Permissions.REI_RADAR_SQUID)){
return message; rei += "§6";
} }
else{
rei = "§0§0" + rei + "§e§f"; // Allow Rei's Minimap's other radar
return message + rei; 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;
}
}
} }

View File

@ -6,53 +6,53 @@ import fr.neatmonster.nocheatplus.permissions.Permissions;
public class SmartMovingMOTD extends ClientMOTD { public class SmartMovingMOTD extends ClientMOTD {
@Override @Override
public String onPlayerJoin(String message, Player player, boolean allowAll) { public String onPlayerJoin(String message, Player player, boolean allowAll) {
if (allowAll){ if (allowAll){
return message; return message;
} }
String smartMoving = ""; String smartMoving = "";
// TODO: Is there a compact version (just one prefix)? // TODO: Is there a compact version (just one prefix)?
// Disable Smart Moving's climbing. // Disable Smart Moving's climbing.
if (!player.hasPermission(Permissions.SMARTMOVING_CLIMBING)){ if (!player.hasPermission(Permissions.SMARTMOVING_CLIMBING)){
smartMoving += "§0§1§0§1§2§f§f"; smartMoving += "§0§1§0§1§2§f§f";
} }
// Disable Smart Moving's climbing. // Disable Smart Moving's climbing.
if (!player.hasPermission(Permissions.SMARTMOVING_SWIMMING)){ if (!player.hasPermission(Permissions.SMARTMOVING_SWIMMING)){
smartMoving += "§0§1§3§4§f§f"; smartMoving += "§0§1§3§4§f§f";
} }
// Disable Smart Moving's climbing. // Disable Smart Moving's climbing.
if (!player.hasPermission(Permissions.SMARTMOVING_CRAWLING)){ if (!player.hasPermission(Permissions.SMARTMOVING_CRAWLING)){
smartMoving += "§0§1§5§f§f"; smartMoving += "§0§1§5§f§f";
} }
// Disable Smart Moving's climbing. // Disable Smart Moving's climbing.
if (!player.hasPermission(Permissions.SMARTMOVING_SLIDING)){ if (!player.hasPermission(Permissions.SMARTMOVING_SLIDING)){
smartMoving += "§0§1§6§f§f"; smartMoving += "§0§1§6§f§f";
} }
// Disable Smart Moving's climbing. // Disable Smart Moving's climbing.
if (!player.hasPermission(Permissions.SMARTMOVING_JUMPING)){ if (!player.hasPermission(Permissions.SMARTMOVING_JUMPING)){
smartMoving += "§0§1§8§9§a§b§f§f"; smartMoving += "§0§1§8§9§a§b§f§f";
} }
// Disable Smart Moving's climbing. // Disable Smart Moving's climbing.
if (!player.hasPermission(Permissions.SMARTMOVING_FLYING)){ if (!player.hasPermission(Permissions.SMARTMOVING_FLYING)){
smartMoving += "§0§1§7§f§f"; smartMoving += "§0§1§7§f§f";
} }
if (smartMoving.isEmpty()){ if (smartMoving.isEmpty()){
return message; return message;
} }
else{ else{
return message + smartMoving; return message + smartMoving;
} }
} }
} }

View File

@ -6,36 +6,36 @@ import fr.neatmonster.nocheatplus.permissions.Permissions;
public class ZombeMOTD extends ClientMOTD { public class ZombeMOTD extends ClientMOTD {
@Override @Override
public String onPlayerJoin(String message, Player player, boolean allowAll) { public String onPlayerJoin(String message, Player player, boolean allowAll) {
String zombe = ""; String zombe = "";
// TODO: Is there a compact version (just one prefix)? // TODO: Is there a compact version (just one prefix)?
// Disable Zombe's noclip. // Disable Zombe's noclip.
if (allowAll || player.hasPermission(Permissions.ZOMBE_NOCLIP)){ if (allowAll || player.hasPermission(Permissions.ZOMBE_NOCLIP)){
zombe += "§f §f §4 §0 §9 §6"; zombe += "§f §f §4 §0 §9 §6";
} }
if (!allowAll){ if (!allowAll){
// Disable Zombe's fly mod. // Disable Zombe's fly mod.
if (!player.hasPermission(Permissions.ZOMBE_FLY)){ if (!player.hasPermission(Permissions.ZOMBE_FLY)){
zombe += "§f §f §1 §0 §2 §4"; zombe += "§f §f §1 §0 §2 §4";
} }
// Disable Zombe's cheat. // Disable Zombe's cheat.
if (!player.hasPermission(Permissions.ZOMBE_CHEAT)){ if (!player.hasPermission(Permissions.ZOMBE_CHEAT)){
zombe += "§f §f §2 §0 §4 §8"; zombe += "§f §f §2 §0 §4 §8";
} }
} }
if (zombe.isEmpty()){ if (zombe.isEmpty()){
return message; return message;
} }
else{ else{
return message + zombe; return message + zombe;
} }
} }
} }