Code cleaning

Most notable change: Remove redundant type parameters and replaced with <>. This is a small step to bring us closer to upstream parity.
This commit is contained in:
matt
2019-02-15 21:46:10 -05:00
parent 3236bdd78e
commit 85bfd16d7c
82 changed files with 1417 additions and 1406 deletions

View File

@ -43,7 +43,7 @@ public class Metrics {
/**
* All of the custom graphs to submit to metrics.
*/
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<>());
/**
* Unique server id.
*/
@ -581,4 +581,4 @@ public class Metrics {
return plotter.name.equals(this.name) && plotter.getValue() == getValue();
}
}
}
}

View File

@ -29,7 +29,7 @@ final class JsonString implements JsonRepresentedObject, ConfigurationSerializab
}
public Map<String, Object> serialize() {
HashMap<String, Object> theSingleValue = new HashMap<String, Object>();
HashMap<String, Object> theSingleValue = new HashMap<>();
theSingleValue.put("stringValue", _value);
return theSingleValue;
}

View File

@ -177,12 +177,12 @@ public final class Reflection {
*/
public synchronized static Method getMethod(Class<?> clazz, String name, Class<?>... args) {
if (!_loadedMethods.containsKey(clazz)) {
_loadedMethods.put(clazz, new HashMap<String, Map<ArrayWrapper<Class<?>>, Method>>());
_loadedMethods.put(clazz, new HashMap<>());
}
Map<String, Map<ArrayWrapper<Class<?>>, Method>> loadedMethodNames = _loadedMethods.get(clazz);
if (!loadedMethodNames.containsKey(name)) {
loadedMethodNames.put(name, new HashMap<ArrayWrapper<Class<?>>, Method>());
loadedMethodNames.put(name, new HashMap<>());
}
Map<ArrayWrapper<Class<?>>, Method> loadedSignatures = loadedMethodNames.get(name);

View File

@ -72,7 +72,7 @@ public class BukkitImageListener implements Listener {
String name = player.getName().toLowerCase();
if (!event.getMessage().toLowerCase().contains(name)) {
ArrayDeque<String> buffered = fp.getMeta("CFIBufferedMessages");
if (buffered == null) fp.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<String>());
if (buffered == null) fp.setMeta("CFIBufferedMessaged", buffered = new ArrayDeque<>());
String full = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
buffered.add(full);
iter.remove();
@ -280,4 +280,4 @@ public class BukkitImageListener implements Listener {
}
}
}
}
}

View File

@ -69,7 +69,7 @@ public class ItemUtil {
if (nativeTag != null) return (CompoundTag) nativeTag;
}
Tag nativeTag = BukkitQueue_0.toNative(nmsTag);
map.put(nmsTag.hashCode(), new WeakReference<Tag>(nativeTag));
map.put(nmsTag.hashCode(), new WeakReference<>(nativeTag));
return null;
}
} catch (Throwable e) {

View File

@ -154,7 +154,7 @@ public class BukkitQueue_All extends BukkitQueue_0<ChunkSnapshot, ChunkSnapshot,
Object nmsChunk = methodGetHandleChunk.invoke(chunk);
boolean mustSave = saveChunks && (boolean) methodNeedsSaving.invoke(nmsChunk, false);
chunk.unload(mustSave, false);
if (unloaded == null) unloaded = new ArrayDeque<Chunk>();
if (unloaded == null) unloaded = new ArrayDeque<>();
unloaded.add(chunk);
}
}