change some collection init
This commit is contained in:
parent
623a47d877
commit
45ba4c185f
@ -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<ClaimPermission> getPerms() {
|
||||
return Lists.newArrayList(permissions.values());
|
||||
return new ArrayList<>(permissions.values());
|
||||
}
|
||||
|
||||
public static Collection<ClaimPermission> globalPerms() {
|
||||
|
@ -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<String> groups() {
|
||||
List<String> l = Lists.newArrayList(this.permissions.keySet());
|
||||
List<String> l = new ArrayList<>(this.permissions.keySet());
|
||||
l.sort(null);
|
||||
return l;
|
||||
}
|
||||
@ -579,7 +578,7 @@ public class Claim implements IPermissionContainer {
|
||||
for (Map.Entry<UUID, String> 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;
|
||||
});
|
||||
|
@ -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<String, Object> 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<ClaimPermission> complementOf(ClaimPermission... perms) {
|
||||
Set<ClaimPermission> set = Sets.newHashSet(PermissionRegistry.getPerms());
|
||||
Set<ClaimPermission> set = new HashSet<>((PermissionRegistry.getPerms());
|
||||
for (ClaimPermission perm : perms)
|
||||
set.remove(perm);
|
||||
return set;
|
||||
|
@ -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<Item> blackListedItems = Sets.newHashSet(Items.COMPASS, Items.FILLED_MAP, Items.FIREWORK_ROCKET);
|
||||
private static final Set<Item> 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
|
||||
|
@ -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<ClaimPermission> perms = Lists.newArrayList(PermissionRegistry.getPerms());
|
||||
List<ClaimPermission> 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<ClaimPermission> perms = Lists.newArrayList(PermissionRegistry.getPerms());
|
||||
List<ClaimPermission> perms = new ArrayList<>(PermissionRegistry.getPerms());
|
||||
if (this.group != null)
|
||||
perms.removeAll(PermissionRegistry.globalPerms());
|
||||
int maxPages = perms.size() / 28;
|
||||
|
Loading…
Reference in New Issue
Block a user