SteamWar/BauSystem
Archiviert
13
0

Merge branch 'master' into CommandFramework

Dieser Commit ist enthalten in:
yoyosource 2021-04-01 20:23:44 +02:00
Commit dd69df8d09

Datei anzeigen

@ -84,7 +84,14 @@ public class Detonator implements Listener {
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).clear(); PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).clear();
PLAYER_LOCS.get(player).add(detoloader); PLAYER_LOCS.get(player).add(detoloader);
return item; return item;
}, 12), new VersionedCallable<>(() -> pushLocToDetonator(clearDetonator(item), detoloader), 15)); }, 12), new VersionedCallable<>(() -> {
try {
return pushLocToDetonator(clearDetonator(item), detoloader);
}catch (SecurityException e){
player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage());
return item;
}
}, 15));
} }
public static ItemStack toggleLocation(ItemStack item, Player player, Detoloader detoloader, Location location) { public static ItemStack toggleLocation(ItemStack item, Player player, Detoloader detoloader, Location location) {
@ -103,12 +110,26 @@ public class Detonator implements Listener {
return VersionedCallable.call(new VersionedCallable<>(() -> { return VersionedCallable.call(new VersionedCallable<>(() -> {
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(location)); PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(location));
return item; return item;
}, 12), new VersionedCallable<>(() -> pushLocToDetonator(item, new Detoloader.DetonatorActivation(location)), 15)); }, 12), new VersionedCallable<>(() -> {
try {
return pushLocToDetonator(item, new Detoloader.DetonatorActivation(location));
}catch (SecurityException e){
player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage());
return item;
}
}, 15));
else else
return VersionedCallable.call(new VersionedCallable<>(() -> { return VersionedCallable.call(new VersionedCallable<>(() -> {
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(detoloader.getActivation(), location)); PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(detoloader.getActivation(), location));
return item; return item;
}, 12), new VersionedCallable<>(() -> pushLocToDetonator(item, new Detoloader.DetonatorActivation(detoloader.getActivation(), location)), 15)); }, 12), new VersionedCallable<>(() -> {
try {
return pushLocToDetonator(item, new Detoloader.DetonatorActivation(detoloader.getActivation(), location));
}catch (SecurityException e){
player.sendMessage(BauSystem.PREFIX + "§c" + e.getMessage());
return item;
}
}, 15));
} }
} }
@ -208,7 +229,7 @@ public class Detonator implements Listener {
public static ItemStack pushLocToDetonator(ItemStack item, Detoloader.DetonatorActivation detoloader) { public static ItemStack pushLocToDetonator(ItemStack item, Detoloader.DetonatorActivation detoloader) {
int slot = getFreeSlot(item); int slot = getFreeSlot(item);
if (slot == -1) if (slot == -1)
throw new SecurityException("Ein Fehler ist aufgetreten"); throw new SecurityException("Mit dem Detonator stimmt etwas nicht. Nimm dir einen neuen mit /dt wand. Wenn es dann immer nicht nicht tut, wende dich an einen Developer");
ItemMeta meta = item.getItemMeta(); ItemMeta meta = item.getItemMeta();
Location block = detoloader.location; Location block = detoloader.location;
meta.getPersistentDataContainer().set(new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + slot), PersistentDataType.INTEGER_ARRAY, new int[] meta.getPersistentDataContainer().set(new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + slot), PersistentDataType.INTEGER_ARRAY, new int[]