Removed some null checks and fixed some variable names

Dieser Commit ist enthalten in:
MattBDev 2019-05-22 14:40:56 -04:00
Ursprung e4c1ba3edf
Commit 6b0fcc8712
9 geänderte Dateien mit 27 neuen und 49 gelöschten Zeilen

Datei anzeigen

@ -110,8 +110,8 @@ public class FaweBukkit implements IFawe, Listener {
}
try {
Fawe.get().setChatManager(new BukkitChatManager());
} catch (Throwable ignore) {
ignore.printStackTrace();
} catch (Throwable throwable) {
throwable.printStackTrace();
}
} catch (final Throwable e) {
MainUtil.handleError(e);
@ -226,11 +226,7 @@ public class FaweBukkit implements IFawe, Listener {
@Override
public void debug(final String s) {
ConsoleCommandSender console = Bukkit.getConsoleSender();
if (console != null) {
console.sendMessage(BBC.color(s));
} else {
Bukkit.getLogger().info(BBC.color(s));
}
}
@Override
@ -266,7 +262,7 @@ public class FaweBukkit implements IFawe, Listener {
Player player = (Player) obj;
FawePlayer existing = Fawe.get().getCachedPlayer(player.getName());
return existing != null ? existing : new BukkitPlayer(player);
} else if (obj != null && obj.getClass().getName().contains("EntityPlayer")) {
} else if (obj.getClass().getName().contains("EntityPlayer")) {
try {
Method method = obj.getClass().getDeclaredMethod("getBukkitEntity");
return wrap(method.invoke(obj));
@ -314,7 +310,6 @@ public class FaweBukkit implements IFawe, Listener {
@Override
public String getDebugInfo() {
StringBuilder msg = new StringBuilder();
List<String> pl = new ArrayList<>();
msg.append("server.version: " + Bukkit.getVersion() + "\n");
msg.append("Plugins: \n");
for (Plugin p : Bukkit.getPluginManager().getPlugins()) {
@ -350,7 +345,7 @@ public class FaweBukkit implements IFawe, Listener {
}
try {
return getQueue(world);
} catch (Throwable ignore) {
} catch (Throwable throwable) {
// Disable incompatible settings
Settings.IMP.QUEUE.PARALLEL_THREADS = 1; // BukkitAPI placer is too slow to parallel thread at the chunk level
Settings.IMP.HISTORY.COMBINE_STAGES = false; // Performing a chunk copy (if possible) wouldn't be faster using the BukkitAPI
@ -365,7 +360,7 @@ public class FaweBukkit implements IFawe, Listener {
debug("Download the version of FAWE for your platform");
debug(" - http://ci.athion.net/job/FastAsyncWorldEdit/lastSuccessfulBuild/artifact/target");
debug("=======================================");
ignore.printStackTrace();
throwable.printStackTrace();
debug("=======================================");
TaskManager.IMP.laterAsync(
() -> MainUtil.sendAdmin("&cNo NMS placer found, see console!"), 1);
@ -398,11 +393,11 @@ public class FaweBukkit implements IFawe, Listener {
} catch (Throwable ignore) {
}
}
Throwable error = null;
Throwable error;
try {
return getQueue(world);
} catch (Throwable ignore) {
error = ignore;
} catch (Throwable throwable) {
error = throwable;
}
// Disable incompatible settings
Settings.IMP.QUEUE.PARALLEL_THREADS = 1; // BukkitAPI placer is too slow to parallel thread at the chunk level
@ -598,7 +593,7 @@ public class FaweBukkit implements IFawe, Listener {
BukkitQueue_0.checkVersion(v.name());
this.version = tmp = v;
break;
} catch (IllegalStateException e) {}
} catch (IllegalStateException ignored) {}
}
}
return tmp;

Datei anzeigen

@ -40,10 +40,6 @@ public final class Reflection {
*/
public synchronized static String getVersion() {
if (_versionString == null) {
if (Bukkit.getServer() == null) {
// The server hasn't started, static initializer call?
return null;
}
String name = Bukkit.getServer().getClass().getPackage().getName();
_versionString = name.substring(name.lastIndexOf('.') + 1) + ".";
}

Datei anzeigen

@ -153,8 +153,7 @@ public class BukkitImageListener implements Listener {
ImageViewer viewer = generator.getImageViewer();
if (!(viewer instanceof BukkitImageViewer)) return null;
BukkitImageViewer biv = (BukkitImageViewer) viewer;
return biv;
return (BukkitImageViewer) viewer;
}
private void handleInteract(PlayerEvent event, Entity entity, boolean primary) {
@ -189,7 +188,6 @@ public class BukkitImageListener implements Listener {
return;
}
if (tool == null) return;
BrushSettings context = primary ? tool.getPrimary() : tool.getSecondary();
Brush brush = context.getBrush();
if (brush == null) return;

Datei anzeigen

@ -89,7 +89,7 @@ public class CFIPacketListener implements Listener {
EnumWrappers.Hand enumHand = hands.isEmpty() ? EnumWrappers.Hand.MAIN_HAND : hands.get(0);
PlayerInventory inv = plr.getInventory();
ItemStack hand = enumHand == EnumWrappers.Hand.MAIN_HAND ? inv.getItemInMainHand() : inv.getItemInOffHand();
if (hand != null && hand.getType().isBlock()) {
if (hand.getType().isBlock()) {
Material type = hand.getType();
if (!type.isEmpty()) {
BlockStateHolder block = BukkitAdapter.asBlockState(hand);
@ -281,8 +281,7 @@ public class CFIPacketListener implements Listener {
BlockPosition loc = position.readSafely(0);
if (loc == null) return null;
BlockVector3 origin = generator.getOrigin().toBlockPoint();
BlockVector3 pt = BlockVector3.at(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
return pt;
return BlockVector3.at(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
}
private void handleBlockEvent(PacketEvent event, boolean relative, RunnableVal3<PacketEvent, VirtualWorld, BlockVector3> task) {

Datei anzeigen

@ -14,13 +14,12 @@ import org.bukkit.plugin.Plugin;
public class FactionsFeature extends BukkitMaskManager implements Listener {
FaweBukkit plugin;
Plugin factions;
private Plugin factions;
public FactionsFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
super(factionsPlugin.getName());
this.factions = factionsPlugin;
this.plugin = p3;
BoardColl.get();
}
@Override
@ -45,7 +44,7 @@ public class FactionsFeature extends BukkitMaskManager implements Listener {
}
}
else if (fac.getOnlinePlayers().contains(player)) {
if (fac.getComparisonName().equals("wilderness") == false) {
if (!fac.getComparisonName().equals("wilderness")) {
final Chunk chunk = loc.getChunk();
final Location pos1 = new Location(loc.getWorld(), chunk.getX() * 16, 0, chunk.getZ() * 16);
final Location pos2 = new Location(loc.getWorld(), (chunk.getX() * 16) + 15, 156, (chunk.getZ() * 16) + 15);

Datei anzeigen

@ -120,8 +120,8 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
fieldRegionMap = ReflectionUtils.findField(classRegionFileCache, Map.class);
fieldRegionRAF = ReflectionUtils.findField(classRegionFile, RandomAccessFile.class);
} catch (Throwable ignore) {
ignore.printStackTrace();
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}

Datei anzeigen

@ -337,7 +337,6 @@ public abstract class ChunkListener implements Listener {
if (elem == null) return;
String className = elem.getClassName();
int len = className.length();
if (className != null) {
if (len > 15 && className.charAt(len - 15) == 'E' && className.endsWith("EntityFireworks")) {
for (Entity ent : world.getEntities()) {
if (ent.getType() == EntityType.FIREWORK) {
@ -353,7 +352,6 @@ public abstract class ChunkListener implements Listener {
}
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onItemSpawn(ItemSpawnEvent event) {

Datei anzeigen

@ -1,6 +1,5 @@
package com.boydti.fawe.bukkit.wrapper;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.bukkit.wrapper.state.AsyncSign;
import com.boydti.fawe.object.FaweQueue;
import com.boydti.fawe.util.TaskManager;

Datei anzeigen

@ -410,9 +410,7 @@ public enum BBC {
*/
BBC(final String d, final boolean prefix, final String cat) {
this.d = d;
if (this.s == null) {
this.s = d;
}
this.prefix = prefix;
this.cat = cat.toLowerCase();
}
@ -559,11 +557,7 @@ public enum BBC {
Method method = actor.getClass().getMethod("print", String.class);
method.setAccessible(true);
method.invoke(actor, (PREFIX.isEmpty() ? "" : PREFIX.s() + " ") + this.format(args));
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
e.printStackTrace();
}
}