Minor code cleanup

Plus an optimization
This commit is contained in:
MattBDev
2016-03-29 17:00:07 -04:00
parent 6007f040cd
commit 31d346a587
63 changed files with 950 additions and 1083 deletions

View File

@ -123,7 +123,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void onEnable() {
THIS = this;
BukkitMain.THIS = this;
new PS(this, "Bukkit");
}
@ -131,12 +131,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
public void onDisable() {
PS.get().disable();
Bukkit.getScheduler().cancelTasks(this);
THIS = null;
BukkitMain.THIS = null;
}
@Override
public void log(String message) {
if (THIS != null) {
if (BukkitMain.THIS != null) {
try {
message = C.color(message);
if (!Settings.CONSOLE_COLOR) {
@ -153,7 +153,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void disable() {
if (THIS != null) {
if (BukkitMain.THIS != null) {
onDisable();
}
}
@ -224,10 +224,9 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
case LIGHTNING:
case WITHER_SKULL:
case UNKNOWN:
case PLAYER: {
case PLAYER:
// non moving / unmovable
continue;
}
case THROWN_EXP_BOTTLE:
case SPLASH_POTION:
case SNOWBALL:
@ -235,15 +234,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
case SPECTRAL_ARROW:
case TIPPED_ARROW:
case ENDER_PEARL:
case ARROW: {
case ARROW:
// managed elsewhere | projectile
continue;
}
case ARMOR_STAND:
case ITEM_FRAME:
case PAINTING: {
case PAINTING:
// TEMPORARILY CLASSIFY AS VEHICLE
}
case MINECART:
case MINECART_CHEST:
case MINECART_COMMAND:
@ -278,15 +275,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
case SMALL_FIREBALL:
case FIREBALL:
case DRAGON_FIREBALL:
case DROPPED_ITEM: {
case DROPPED_ITEM:
// dropped item
continue;
}
case PRIMED_TNT:
case FALLING_BLOCK: {
case FALLING_BLOCK:
// managed elsewhere
continue;
}
case BAT:
case BLAZE:
case CAVE_SPIDER:
@ -320,7 +315,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
case WOLF:
case ZOMBIE:
case SHULKER:
default: {
default:
if (!Settings.KILL_ROAD_MOBS) {
continue;
}
@ -332,7 +327,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
entity.remove();
}
}
}
}
}
} catch (Throwable e) {
@ -383,7 +377,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public boolean initWorldEdit() {
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
BukkitMain.worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
getServer().getPluginManager().registerEvents(new WEListener(), this);
return true;
}