mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-31 11:41:20 +01:00
Clean up
This commit is contained in:
parent
8f8deac241
commit
a28ad6c815
@ -16,14 +16,8 @@ public class DropUtils {
|
|||||||
|
|
||||||
if (drop.getItemStack() != null)
|
if (drop.getItemStack() != null)
|
||||||
dropItems(entity, Collections.singletonList(drop.getItemStack()));
|
dropItems(entity, Collections.singletonList(drop.getItemStack()));
|
||||||
if (drop.getCommand() != null) {
|
if (drop.getCommand() != null)
|
||||||
String command = drop.getCommand();
|
runCommands(entity, Collections.singletonList(drop.getCommand()));
|
||||||
if (entity.getKiller() != null) {
|
|
||||||
command = command.replace("%player%", entity.getKiller().getName());
|
|
||||||
}
|
|
||||||
if (!command.contains("%player%"))
|
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void processStackedDrop(LivingEntity entity, List<Drop> drops) {
|
public static void processStackedDrop(LivingEntity entity, List<Drop> drops) {
|
||||||
@ -46,10 +40,9 @@ public class DropUtils {
|
|||||||
if (!success)
|
if (!success)
|
||||||
items.add(droppedItem);
|
items.add(droppedItem);
|
||||||
}
|
}
|
||||||
if (drop.getCommand() != null) {
|
if (drop.getCommand() != null)
|
||||||
commands.add(drop.getCommand());
|
commands.add(drop.getCommand());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (!items.isEmpty())
|
if (!items.isEmpty())
|
||||||
dropItems(entity, items);
|
dropItems(entity, items);
|
||||||
else if (!commands.isEmpty())
|
else if (!commands.isEmpty())
|
||||||
@ -63,9 +56,8 @@ public class DropUtils {
|
|||||||
|
|
||||||
private static void runCommands(LivingEntity entity, List<String> commands) {
|
private static void runCommands(LivingEntity entity, List<String> commands) {
|
||||||
for (String command : commands) {
|
for (String command : commands) {
|
||||||
if (entity.getKiller() != null) {
|
if (entity.getKiller() != null)
|
||||||
command = command.replace("%player%", entity.getKiller().getName());
|
command = command.replace("%player%", entity.getKiller().getName());
|
||||||
}
|
|
||||||
if (!command.contains("%player%"))
|
if (!command.contains("%player%"))
|
||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user