SteamWar/BauSystem
Archiviert
13
0

Merge pull request 'Backwards Detonator' (#212) from backwards-message into master

Reviewed-on: #212
Reviewed-by: YoyoNow <jwsteam@nidido.de>
Dieser Commit ist enthalten in:
YoyoNow 2021-04-01 20:22:44 +02:00
Commit 56a4db93f5

Datei anzeigen

@ -84,7 +84,14 @@ public class Detonator implements Listener {
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).clear();
PLAYER_LOCS.get(player).add(detoloader);
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) {
@ -103,12 +110,26 @@ public class Detonator implements Listener {
return VersionedCallable.call(new VersionedCallable<>(() -> {
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(location));
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
return VersionedCallable.call(new VersionedCallable<>(() -> {
PLAYER_LOCS.computeIfAbsent(player, player1 -> new HashSet<>()).add(new Detoloader.DetonatorActivation(detoloader.getActivation(), location));
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) {
int slot = getFreeSlot(item);
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();
Location block = detoloader.location;
meta.getPersistentDataContainer().set(new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + slot), PersistentDataType.INTEGER_ARRAY, new int[]