forked from kaboomserver/extras
Use consistent equals style
This commit is contained in:
parent
ce538c940d
commit
177d2ce452
11 changed files with 19 additions and 23 deletions
|
@ -19,9 +19,6 @@ public final class CommandClearChat implements CommandExecutor {
|
|||
}
|
||||
onlinePlayer.sendMessage(ChatColor.DARK_GREEN + "The chat has been cleared");
|
||||
}
|
||||
//for (final Chunk chunk : ((Player)sender).getWorld().getLoadedChunks()) {
|
||||
// ((Player)sender).getWorld().regenerateChunk(chunk.getX(), chunk.getZ());
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ public final class CommandDestroyEntities implements CommandExecutor {
|
|||
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
for (Entity entity : world.getEntities()) {
|
||||
if (entity.getType() != EntityType.PLAYER) {
|
||||
if (!EntityType.PLAYER.equals(entity.getType())) {
|
||||
entity.remove();
|
||||
entityCount++;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public final class CommandEnchantAll implements CommandExecutor {
|
|||
final Player player = (Player) sender;
|
||||
final ItemStack item = player.getInventory().getItemInMainHand();
|
||||
|
||||
if (item.getType() == Material.AIR) {
|
||||
if (Material.AIR.equals(item.getType())) {
|
||||
player.sendMessage("Please hold an item in your hand to enchant it");
|
||||
} else {
|
||||
for (Enchantment enchantment : Enchantment.values()) {
|
||||
|
|
|
@ -30,7 +30,7 @@ public final class CommandPrefix implements CommandExecutor {
|
|||
try {
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <prefix|off>");
|
||||
} else if (args[0].equalsIgnoreCase("off")) {
|
||||
} else if ("off".equalsIgnoreCase(args[0])) {
|
||||
prefixConfig.set(player.getUniqueId().toString(), null);
|
||||
prefixConfig.save(configFile);
|
||||
player.sendMessage("You no longer have a tag");
|
||||
|
|
|
@ -34,8 +34,8 @@ public final class CommandSpidey implements CommandExecutor {
|
|||
);
|
||||
|
||||
while (blockIterator.hasNext()
|
||||
&& (blockIterator.next().getType() == Material.AIR
|
||||
|| blockIterator.next().getType() == Material.CAVE_AIR)) {
|
||||
&& (Material.AIR.equals(blockIterator.next().getType())
|
||||
|| Material.CAVE_AIR.equals(blockIterator.next().getType()))) {
|
||||
blockIterator.next().setType(Material.COBWEB);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ public final class CommandUsername implements CommandExecutor {
|
|||
final String name = nameColor.substring(0, Math.min(16, nameColor.length()));
|
||||
|
||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
|
||||
if (onlinePlayer.getName().equals(name)) {
|
||||
if (name.equals(onlinePlayer.getName())) {
|
||||
player.sendMessage("A player with that username is already logged in");
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -53,10 +53,10 @@ public class EntitySpawn implements Listener {
|
|||
final int worldDragonCount = world.getEntitiesByClass(EnderDragon.class).size();
|
||||
final int worldDragonCountLimit = 24;
|
||||
|
||||
if ((!entityType.equals(EntityType.PLAYER) &&
|
||||
if ((!EntityType.PLAYER.equals(entityType) &&
|
||||
isEntityLimitReached(chunkEntityCount, chunkEntityCountLimit, isAddToWorldEvent)) ||
|
||||
|
||||
(entityType.equals(EntityType.ENDER_DRAGON) &&
|
||||
(EntityType.ENDER_DRAGON.equals(entityType) &&
|
||||
isEntityLimitReached(worldDragonCount, worldDragonCountLimit, isAddToWorldEvent))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ public class EntitySpawn implements Listener {
|
|||
|
||||
if (worldEntityCount > 1024) {
|
||||
for (Entity entity : world.getEntities()) {
|
||||
if (!entity.getType().equals(EntityType.PLAYER)) {
|
||||
if (!EntityType.PLAYER.equals(entity.getType())) {
|
||||
entity.remove();
|
||||
}
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ public class EntitySpawn implements Listener {
|
|||
}
|
||||
|
||||
private void limitSpawner(CreatureSpawner spawner) {
|
||||
if (spawner.getSpawnedType().equals(EntityType.MINECART_MOB_SPAWNER)) {
|
||||
if (EntityType.MINECART_MOB_SPAWNER.equals(spawner.getSpawnedType())) {
|
||||
spawner.setSpawnedType(EntityType.MINECART);
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ public class EntitySpawn implements Listener {
|
|||
final boolean isAddToWorldEvent = true;
|
||||
|
||||
if (checkEntityLimits(entityType, chunk, world, isAddToWorldEvent)
|
||||
&& !entity.getType().equals(EntityType.PLAYER)) {
|
||||
&& !EntityType.PLAYER.equals(entity.getType())) {
|
||||
entity.remove();
|
||||
return;
|
||||
}
|
||||
|
@ -224,7 +224,6 @@ public class EntitySpawn implements Listener {
|
|||
|
||||
@EventHandler
|
||||
void onEntitySpawn(EntitySpawnEvent event) {
|
||||
System.out.println(event.getEntityType());
|
||||
final double X = event.getLocation().getX();
|
||||
final double Y = event.getLocation().getY();
|
||||
final double Z = event.getLocation().getZ();
|
||||
|
@ -293,7 +292,7 @@ public class EntitySpawn implements Listener {
|
|||
|
||||
@EventHandler
|
||||
void onSpawnerSpawn(SpawnerSpawnEvent event) {
|
||||
if (event.getEntityType().equals(EntityType.FALLING_BLOCK)) {
|
||||
if (EntityType.FALLING_BLOCK.equals(event.getEntityType())) {
|
||||
if (((FallingBlock) event.getEntity()).getBlockData().getMaterial().equals(Material.SPAWNER)) {
|
||||
event.setCancelled(true);
|
||||
event.getSpawner().setSpawnedType(EntityType.FALLING_BLOCK);
|
||||
|
@ -304,7 +303,7 @@ public class EntitySpawn implements Listener {
|
|||
@EventHandler
|
||||
void onTNTPrime(TNTPrimeEvent event) {
|
||||
if (event.getBlock().getWorld().getEntitiesByClass(TNTPrimed.class).size() > 120) {
|
||||
if (event.getReason().equals(PrimeReason.EXPLOSION)) {
|
||||
if (PrimeReason.EXPLOSION.equals(event.getReason())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class PlayerCommand implements Listener {
|
|||
final String checkedCommand = ServerCommand.checkCommand(sender, command, isConsoleCommand);
|
||||
|
||||
if (checkedCommand != null) {
|
||||
if (checkedCommand.equals("cancel")) {
|
||||
if ("cancel".equals(checkedCommand)) {
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
event.setMessage(checkedCommand);
|
||||
|
|
|
@ -48,7 +48,7 @@ public final class PlayerConnection implements Listener {
|
|||
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "Your username can't be longer than 16 characters");
|
||||
} else {
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
if (player.getName().equals(event.getName())) {
|
||||
if (event.getName().equals(player.getName())) {
|
||||
event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "A player with that username is already logged in");
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public final class PlayerConnection implements Listener {
|
|||
event.allow();
|
||||
}
|
||||
|
||||
if (event.getResult() == Result.KICK_FULL
|
||||
if (Result.KICK_FULL.equals(event.getResult())
|
||||
&& JavaPlugin.getPlugin(Main.class).getConfig().getBoolean("allowJoinOnFullServer")) {
|
||||
event.allow();
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.bukkit.inventory.ItemStack;
|
|||
public final class PlayerDamage implements Listener {
|
||||
@EventHandler
|
||||
void onEntityDamage(final EntityDamageEvent event) {
|
||||
if (event.getEntityType() == EntityType.PLAYER) {
|
||||
if (event.getCause() == DamageCause.VOID
|
||||
if (EntityType.PLAYER.equals(event.getEntityType())) {
|
||||
if (DamageCause.VOID.equals(event.getCause())
|
||||
&& event.getDamage() == Float.MAX_VALUE) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ public final class ServerCommand implements Listener {
|
|||
final String checkedCommand = checkCommand(sender, command, isConsoleCommand);
|
||||
|
||||
if (checkedCommand != null) {
|
||||
if (checkedCommand.equals("cancel")) {
|
||||
if ("cancel".equals(checkedCommand)) {
|
||||
event.setCancelled(true);
|
||||
} else {
|
||||
event.setCommand(checkedCommand);
|
||||
|
|
Loading…
Reference in a new issue