SteamWar/BauSystem
Archiviert
13
0

Adding Message for old Detonator

Dieser Commit ist enthalten in:
Chaoscaot 2021-03-30 12:23:52 +02:00
Ursprung 26648e3dee
Commit db2dc1eab4

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("Ein Fehler ist aufgetreten, Hohle dir einen neuen Detonator mit §8/§edt wand");
ItemMeta meta = item.getItemMeta();
Location block = detoloader.location;
meta.getPersistentDataContainer().set(new NamespacedKey(BauSystem.getPlugin(), DETO_PREFIX + slot), PersistentDataType.INTEGER_ARRAY, new int[]