Clean
This commit is contained in:
parent
0d2b013a3f
commit
080faad85f
|
@ -248,3 +248,5 @@ target/classes/com/songoda/ultimatemoderation/utils/gui/Range\.class
|
||||||
target/classes/com/songoda/ultimatemoderation/utils/MySQLDatabase\.class
|
target/classes/com/songoda/ultimatemoderation/utils/MySQLDatabase\.class
|
||||||
|
|
||||||
target/classes/com/songoda/ultimatemoderation/utils/version/NMSUtil\.class
|
target/classes/com/songoda/ultimatemoderation/utils/version/NMSUtil\.class
|
||||||
|
|
||||||
|
target/classes/com/songoda/ultimatemoderation/gui/GUIPunishments\$PunishmentHolder\.class
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.songoda.ultimatemoderation.UltimateModeration;
|
||||||
import com.songoda.ultimatemoderation.command.AbstractCommand;
|
import com.songoda.ultimatemoderation.command.AbstractCommand;
|
||||||
import com.songoda.ultimatemoderation.listeners.DeathListener;
|
import com.songoda.ultimatemoderation.listeners.DeathListener;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
@ -12,8 +13,6 @@ import java.util.*;
|
||||||
|
|
||||||
public class CommandRevive extends AbstractCommand {
|
public class CommandRevive extends AbstractCommand {
|
||||||
|
|
||||||
private static List<UUID> frozen = new ArrayList<>();
|
|
||||||
|
|
||||||
public CommandRevive() {
|
public CommandRevive() {
|
||||||
super(true, true, "Revive");
|
super(true, true, "Revive");
|
||||||
}
|
}
|
||||||
|
@ -30,21 +29,7 @@ public class CommandRevive extends AbstractCommand {
|
||||||
return ReturnType.FAILURE;
|
return ReturnType.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ItemStack> drops = DeathListener.getLastDrop(player);
|
if (!(revive(player, sender))) return ReturnType.FAILURE;
|
||||||
|
|
||||||
if (drops == null) {
|
|
||||||
sender.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.revive.noloot"));
|
|
||||||
return ReturnType.FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack[] dropArr = new ItemStack[drops.size()];
|
|
||||||
dropArr = drops.toArray(dropArr);
|
|
||||||
|
|
||||||
HashMap<Integer, ItemStack> leftOver = player.getInventory().addItem(dropArr);
|
|
||||||
|
|
||||||
for (ItemStack item : leftOver.values()) {
|
|
||||||
player.getWorld().dropItemNaturally(player.getLocation(), item);
|
|
||||||
}
|
|
||||||
|
|
||||||
player.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.revive.revived"));
|
player.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.revive.revived"));
|
||||||
sender.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.revive.success", player.getName()));
|
sender.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.revive.success", player.getName()));
|
||||||
|
@ -63,6 +48,26 @@ public class CommandRevive extends AbstractCommand {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean revive(Player player, CommandSender sender) {
|
||||||
|
UltimateModeration instance = UltimateModeration.getInstance();
|
||||||
|
List<ItemStack> drops = DeathListener.getLastDrop(player);
|
||||||
|
|
||||||
|
if (drops == null) {
|
||||||
|
sender.sendMessage(instance.getReferences().getPrefix() + instance.getLocale().getMessage("command.revive.noloot"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack[] dropArr = new ItemStack[drops.size()];
|
||||||
|
dropArr = drops.toArray(dropArr);
|
||||||
|
|
||||||
|
HashMap<Integer, ItemStack> leftOver = player.getInventory().addItem(dropArr);
|
||||||
|
|
||||||
|
for (ItemStack item : leftOver.values()) {
|
||||||
|
player.getWorld().dropItemNaturally(player.getLocation(), item);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPermissionNode() {
|
public String getPermissionNode() {
|
||||||
return "um.revive";
|
return "um.revive";
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.songoda.ultimatemoderation.gui;
|
||||||
|
|
||||||
import com.songoda.ultimatemoderation.UltimateModeration;
|
import com.songoda.ultimatemoderation.UltimateModeration;
|
||||||
import com.songoda.ultimatemoderation.command.commands.CommandFreeze;
|
import com.songoda.ultimatemoderation.command.commands.CommandFreeze;
|
||||||
|
import com.songoda.ultimatemoderation.command.commands.CommandRevive;
|
||||||
import com.songoda.ultimatemoderation.command.commands.CommandSpy;
|
import com.songoda.ultimatemoderation.command.commands.CommandSpy;
|
||||||
import com.songoda.ultimatemoderation.utils.gui.AbstractGUI;
|
import com.songoda.ultimatemoderation.utils.gui.AbstractGUI;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -26,44 +27,40 @@ public class GUIModerate extends AbstractGUI {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void constructGUI() {
|
protected void constructGUI() {
|
||||||
ItemStack head = new ItemStack(Material.PLAYER_HEAD);
|
|
||||||
SkullMeta meta = ((SkullMeta) head.getItemMeta());
|
|
||||||
meta.setOwningPlayer(toModerate);
|
|
||||||
head.setItemMeta(meta);
|
|
||||||
|
|
||||||
createButton(13, head, "&7&l" + toModerate.getName());
|
|
||||||
|
|
||||||
createButton(8, Material.OAK_DOOR, "Back");
|
createButton(8, Material.OAK_DOOR, "Back");
|
||||||
|
|
||||||
createButton(28, Material.BLUE_ICE, "&6&lFreeze", "&7Stop a player from moving.", "", "&7Currently:&6 " + (CommandFreeze.isFrozen(toModerate) ? "Frozen" : "Unfrozen"));
|
createButton(10, Material.BLUE_ICE, "&6&lFreeze", "&7Stop this player from moving.", "", "&7Currently:&6 " + (CommandFreeze.isFrozen(toModerate) ? "Frozen" : "Unfrozen"));
|
||||||
createButton(30, Material.SADDLE, "&6&lSpy", "&7Spy on a player");
|
createButton(12, Material.SADDLE, "&6&lSpy", "&7Spy on this player");
|
||||||
createButton(32, Material.CHEST, "&c&lInventory", "&7Access this users Inventory.");
|
createButton(14, Material.CHEST, "&c&lInventory", "&7Access this players Inventory.");
|
||||||
createButton(34, Material.ENDER_CHEST, "&a&lEnderchest", "&7Access this users Enderchest");
|
createButton(16, Material.ENDER_CHEST, "&a&lEnderchest", "&7Access this players Enderchest");
|
||||||
|
|
||||||
|
createButton(28, Material.SPLASH_POTION, "&c&lRevive", "&7Freeze this player.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerClickables() {
|
protected void registerClickables() {
|
||||||
registerClickable(8, ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(8, ((player1, inventory1, cursor, slot, type) ->
|
||||||
new GUIPlayer(plugin, toModerate, player1);
|
new GUIPlayer(plugin, toModerate, player1)));
|
||||||
}));
|
|
||||||
|
|
||||||
registerClickable(28, ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(10, ((player1, inventory1, cursor, slot, type) -> {
|
||||||
CommandFreeze.freeze(toModerate, player);
|
CommandFreeze.freeze(toModerate, player);
|
||||||
constructGUI();
|
constructGUI();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
registerClickable(30, ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(12, ((player1, inventory1, cursor, slot, type) -> {
|
||||||
CommandSpy.spy(toModerate, player);
|
CommandSpy.spy(toModerate, player);
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
registerClickable(32, ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(14, ((player1, inventory1, cursor, slot, type) ->
|
||||||
player.openInventory(player.getInventory());
|
player.openInventory(toModerate.getPlayer().getInventory())));
|
||||||
}));
|
|
||||||
|
|
||||||
registerClickable(34, ((player1, inventory1, cursor, slot, type) -> {
|
registerClickable(16, ((player1, inventory1, cursor, slot, type) ->
|
||||||
player.openInventory(player.getEnderChest());
|
player.openInventory(toModerate.getPlayer().getEnderChest())));
|
||||||
}));
|
|
||||||
|
registerClickable(28, ((player1, inventory1, cursor, slot, type) ->
|
||||||
|
CommandRevive.revive(toModerate.getPlayer(), player)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue