diff --git a/src/main/java/com/flemmli97/flan/api/PermissionRegistry.java b/src/main/java/com/flemmli97/flan/api/PermissionRegistry.java index 7b2f7bf..051b453 100644 --- a/src/main/java/com/flemmli97/flan/api/PermissionRegistry.java +++ b/src/main/java/com/flemmli97/flan/api/PermissionRegistry.java @@ -1,12 +1,12 @@ package com.flemmli97.flan.api; import com.flemmli97.flan.config.ConfigHandler; -import com.google.common.collect.Lists; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.Identifier; import net.minecraft.village.raid.Raid; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; @@ -102,7 +102,7 @@ public class PermissionRegistry { } public static List getPerms() { - return Lists.newArrayList(permissions.values()); + return new ArrayList<>(permissions.values()); } public static Collection globalPerms() { diff --git a/src/main/java/com/flemmli97/flan/claim/Claim.java b/src/main/java/com/flemmli97/flan/claim/Claim.java index 8849639..2299093 100644 --- a/src/main/java/com/flemmli97/flan/claim/Claim.java +++ b/src/main/java/com/flemmli97/flan/claim/Claim.java @@ -6,7 +6,6 @@ import com.flemmli97.flan.api.PermissionRegistry; import com.flemmli97.flan.config.ConfigHandler; import com.flemmli97.flan.player.PlayerClaimData; import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -426,7 +425,7 @@ public class Claim implements IPermissionContainer { } public List groups() { - List l = Lists.newArrayList(this.permissions.keySet()); + List l = new ArrayList<>(this.permissions.keySet()); l.sort(null); return l; } @@ -579,7 +578,7 @@ public class Claim implements IPermissionContainer { for (Map.Entry e : this.playersGroups.entrySet()) { GameProfile pgroup = player.getServer().getUserCache().getByUuid(e.getKey()); if (prof != null) { - nameToGroup.merge(e.getValue(), Lists.newArrayList(pgroup.getName()), (old, val) -> { + nameToGroup.merge(e.getValue(), new ArrayList<>(pgroup.getName()), (old, val) -> { old.add(pgroup.getName()); return old; }); diff --git a/src/main/java/com/flemmli97/flan/claim/ClaimStorage.java b/src/main/java/com/flemmli97/flan/claim/ClaimStorage.java index 524797a..60cb685 100644 --- a/src/main/java/com/flemmli97/flan/claim/ClaimStorage.java +++ b/src/main/java/com/flemmli97/flan/claim/ClaimStorage.java @@ -9,8 +9,6 @@ import com.flemmli97.flan.player.EnumDisplayType; import com.flemmli97.flan.player.EnumEditMode; import com.flemmli97.flan.player.PlayerClaimData; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -import com.google.common.collect.Sets; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import it.unimi.dsi.fastutil.longs.Long2ObjectArrayMap; @@ -201,13 +199,13 @@ public class ClaimStorage { int[] pos = getChunkPos(claim); for (int x = pos[0]; x <= pos[1]; x++) for (int z = pos[2]; z <= pos[3]; z++) { - this.claims.merge(ChunkPos.toLong(x, z), Lists.newArrayList(claim), (old, val) -> { + this.claims.merge(ChunkPos.toLong(x, z), new ArrayList<>(claim), (old, val) -> { old.add(claim); return old; }); } this.claimUUIDMap.put(claim.getClaimID(), claim); - this.playerClaimMap.merge(claim.getOwner(), Sets.newHashSet(claim), (old, val) -> { + this.playerClaimMap.merge(claim.getOwner(), new HashSet<>((claim), (old, val) -> { old.add(claim); return old; }); @@ -222,7 +220,7 @@ public class ClaimStorage { }); this.dirty.add(claim.getOwner()); claim.transferOwner(newOwner); - this.playerClaimMap.merge(claim.getOwner(), Sets.newHashSet(claim), (old, val) -> { + this.playerClaimMap.merge(claim.getOwner(), new HashSet<>((claim), (old, val) -> { old.add(claim); return old; }); @@ -365,7 +363,7 @@ public class ClaimStorage { Map values = yml.load(reader); if (!values.get("Parent Claim ID").equals(-1)) { subClaimMap.merge(intFileMap.get(Integer.valueOf(values.get("Parent Claim ID").toString())) - , Lists.newArrayList(f), (key, val) -> { + , new ArrayList<>(f), (key, val) -> { key.add(f); return key; }); @@ -405,7 +403,7 @@ public class ClaimStorage { } private static Set complementOf(ClaimPermission... perms) { - Set set = Sets.newHashSet(PermissionRegistry.getPerms()); + Set set = new HashSet<>((PermissionRegistry.getPerms()); for (ClaimPermission perm : perms) set.remove(perm); return set; diff --git a/src/main/java/com/flemmli97/flan/event/ItemInteractEvents.java b/src/main/java/com/flemmli97/flan/event/ItemInteractEvents.java index a17d59d..c5d6d97 100644 --- a/src/main/java/com/flemmli97/flan/event/ItemInteractEvents.java +++ b/src/main/java/com/flemmli97/flan/event/ItemInteractEvents.java @@ -12,7 +12,6 @@ import com.flemmli97.flan.config.ConfigHandler; import com.flemmli97.flan.player.EnumDisplayType; import com.flemmli97.flan.player.EnumEditMode; import com.flemmli97.flan.player.PlayerClaimData; -import com.google.common.collect.Sets; import com.mojang.authlib.GameProfile; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -36,6 +35,7 @@ import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.HashSet; import java.util.Set; public class ItemInteractEvents { @@ -73,7 +73,7 @@ public class ItemInteractEvents { return TypedActionResult.pass(stack); } - private static final Set blackListedItems = Sets.newHashSet(Items.COMPASS, Items.FILLED_MAP, Items.FIREWORK_ROCKET); + private static final Set blackListedItems = new HashSet<>((Items.COMPASS, Items.FILLED_MAP, Items.FIREWORK_ROCKET); public static ActionResult onItemUseBlock(ItemUsageContext context) { //Check for Fakeplayer. Since there is no api for that directly check the class diff --git a/src/main/java/com/flemmli97/flan/gui/PermissionScreenHandler.java b/src/main/java/com/flemmli97/flan/gui/PermissionScreenHandler.java index 2f2c71b..1921131 100644 --- a/src/main/java/com/flemmli97/flan/gui/PermissionScreenHandler.java +++ b/src/main/java/com/flemmli97/flan/gui/PermissionScreenHandler.java @@ -4,7 +4,6 @@ import com.flemmli97.flan.api.ClaimPermission; import com.flemmli97.flan.api.PermissionRegistry; import com.flemmli97.flan.claim.Claim; import com.flemmli97.flan.claim.PermHelper; -import com.google.common.collect.Lists; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.Inventory; @@ -20,6 +19,7 @@ import net.minecraft.text.Style; import net.minecraft.text.Text; import net.minecraft.util.Formatting; +import java.util.ArrayList; import java.util.List; public class PermissionScreenHandler extends ServerOnlyScreenHandler { @@ -67,7 +67,7 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler { @Override protected void fillInventoryWith(PlayerEntity player, Inventory inv, Object... additionalData) { - List perms = Lists.newArrayList(PermissionRegistry.getPerms()); + List perms = new ArrayList<>(PermissionRegistry.getPerms()); if (this.group != null) perms.removeAll(PermissionRegistry.globalPerms()); for (int i = 0; i < 54; i++) { @@ -96,7 +96,7 @@ public class PermissionScreenHandler extends ServerOnlyScreenHandler { } private void flipPage() { - List perms = Lists.newArrayList(PermissionRegistry.getPerms()); + List perms = new ArrayList<>(PermissionRegistry.getPerms()); if (this.group != null) perms.removeAll(PermissionRegistry.globalPerms()); int maxPages = perms.size() / 28;