Cleanup a little bit more code.

This commit is contained in:
Matthew Miller
2018-08-06 19:08:15 +10:00
parent 526aa6cf49
commit 5f4cc3e694
21 changed files with 103 additions and 268 deletions

View File

@ -39,7 +39,7 @@ class ForgeBiomeRegistry implements BiomeRegistry {
@Override
public List<BaseBiome> getBiomes() {
List<BaseBiome> list = new ArrayList<BaseBiome>();
List<BaseBiome> list = new ArrayList<>();
for (Biome biome : Biome.REGISTRY) {
list.add(new BaseBiome(Biome.getIdForBiome(biome)));
}

View File

@ -85,7 +85,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
@Override
public List<? extends com.sk89q.worldedit.world.World> getWorlds() {
WorldServer[] worlds = DimensionManager.getWorlds();
List<com.sk89q.worldedit.world.World> ret = new ArrayList<com.sk89q.worldedit.world.World>(worlds.length);
List<com.sk89q.worldedit.world.World> ret = new ArrayList<>(worlds.length);
for (WorldServer world : worlds) {
ret.add(new ForgeWorld(world));
}
@ -164,7 +164,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
@Override
public Map<Capability, Preference> getCapabilities() {
Map<Capability, Preference> capabilities = new EnumMap<Capability, Preference>(Capability.class);
Map<Capability, Preference> capabilities = new EnumMap<>(Capability.class);
capabilities.put(Capability.CONFIGURATION, Preference.PREFER_OTHERS);
capabilities.put(Capability.WORLDEDIT_CUI, Preference.NORMAL);
capabilities.put(Capability.GAME_HOOKS, Preference.NORMAL);
@ -176,7 +176,7 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
@Override
public Collection<Actor> getConnectedUsers() {
List<Actor> users = new ArrayList<Actor>();
List<Actor> users = new ArrayList<>();
PlayerList scm = server.getPlayerList();
for (EntityPlayerMP entity : scm.getPlayers()) {
if (entity != null) {

View File

@ -205,7 +205,7 @@ final class NBTConverter {
public static ListTag fromNative(NBTTagList other) {
other = other.copy();
List<Tag> list = new ArrayList<Tag>();
List<Tag> list = new ArrayList<>();
Class<? extends Tag> listClass = StringTag.class;
int tags = other.tagCount();
for (int i = 0; i < tags; i++) {
@ -243,7 +243,7 @@ final class NBTConverter {
public static CompoundTag fromNative(NBTTagCompound other) {
Set<String> tags = other.getKeySet();
Map<String, Tag> map = new HashMap<String, Tag>();
Map<String, Tag> map = new HashMap<>();
for (String tagName : tags) {
map.put(tagName, fromNative(other.getTag(tagName)));
}

View File

@ -55,7 +55,7 @@ public class ThreadSafeCache {
long now = System.currentTimeMillis();
if (now - lastRefresh > REFRESH_DELAY) {
Set<UUID> onlineIds = new HashSet<UUID>();
Set<UUID> onlineIds = new HashSet<>();
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
if (server == null || server.getPlayerList() == null) {
@ -67,7 +67,7 @@ public class ThreadSafeCache {
}
}
this.onlineIds = new CopyOnWriteArraySet<UUID>(onlineIds);
this.onlineIds = new CopyOnWriteArraySet<>(onlineIds);
lastRefresh = now;
}

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.forge.net;
package com.sk89q.worldedit.forge.net;
import com.sk89q.worldedit.forge.ForgeWorldEdit;
import io.netty.buffer.ByteBuf;
@ -32,13 +32,8 @@ public class LeftClickAirEventMessage implements IMessage {
@Override
public IMessage onMessage(LeftClickAirEventMessage message, final MessageContext ctx) {
ctx.getServerHandler().player.mcServer.addScheduledTask(new Runnable() {
@Override
public void run() {
ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(ctx.getServerHandler().player));
}
});
ctx.getServerHandler().player.mcServer.addScheduledTask(
() -> ForgeWorldEdit.inst.onPlayerInteract(new PlayerInteractEvent.LeftClickEmpty(ctx.getServerHandler().player)));
return null;
}