Showing Dropping Anvil Something (Ignore)

This commit is contained in:
Driftay
2019-09-15 05:15:33 -04:00
parent e7db7170d1
commit 2feaed0aad
285 changed files with 28746 additions and 28746 deletions

View File

@@ -17,107 +17,107 @@ import java.util.Map;
public class ChestLogsHandler implements Listener {
public static HashMap<String, List<String>> removeMap = new HashMap<>();
public static HashMap<String, List<String>> addMap = new HashMap<>();
public static HashMap<String, Integer> totalMap = new HashMap<>();
public static HashMap<String, List<String>> removeMap = new HashMap<>();
public static HashMap<String, List<String>> addMap = new HashMap<>();
public static HashMap<String, Integer> totalMap = new HashMap<>();
public static int getAll(String uuid) {
int t = 0;
t = t + removeMap.get(uuid).size();
t = t + addMap.get(uuid).size();
return t;
}
public static int getAll(String uuid) {
int t = 0;
t = t + removeMap.get(uuid).size();
t = t + addMap.get(uuid).size();
return t;
}
public static int getAll() {
int t = 0;
for (Map.Entry<String, List<String>> entry : removeMap.entrySet()) {
t = t + entry.getValue().size();
}
for (Map.Entry<String, List<String>> entry : addMap.entrySet()) {
t = t + entry.getValue().size();
}
return t;
}
public static int getAll() {
int t = 0;
for (Map.Entry<String, List<String>> entry : removeMap.entrySet()) {
t = t + entry.getValue().size();
}
for (Map.Entry<String, List<String>> entry : addMap.entrySet()) {
t = t + entry.getValue().size();
}
return t;
}
public void mapAdd(String uuid, String string) {
List<String> list = new ArrayList<>();
if (addMap.get(uuid) != null) {
list = addMap.get(uuid);
}
list.add(string);
addMap.remove(uuid);
addMap.put(uuid, list);
public void mapAdd(String uuid, String string) {
List<String> list = new ArrayList<>();
if (addMap.get(uuid) != null) {
list = addMap.get(uuid);
}
list.add(string);
addMap.remove(uuid);
addMap.put(uuid, list);
if (totalMap.get(uuid) == null) {
totalMap.put(uuid, 1);
} else {
int t = totalMap.get(uuid);
totalMap.remove(uuid);
totalMap.put(uuid, t + 1);
}
}
if (totalMap.get(uuid) == null) {
totalMap.put(uuid, 1);
} else {
int t = totalMap.get(uuid);
totalMap.remove(uuid);
totalMap.put(uuid, t + 1);
}
}
public void mapRemove(String uuid, String string) {
List<String> list = new ArrayList<>();
if (removeMap.get(uuid) != null) {
list = removeMap.get(uuid);
}
list.add(string);
removeMap.remove(uuid);
removeMap.put(uuid, list);
if (totalMap.get(uuid) == null) {
totalMap.put(uuid, 1);
} else {
int t = totalMap.get(uuid);
totalMap.remove(uuid);
totalMap.put(uuid, t + 1);
}
}
public void mapRemove(String uuid, String string) {
List<String> list = new ArrayList<>();
if (removeMap.get(uuid) != null) {
list = removeMap.get(uuid);
}
list.add(string);
removeMap.remove(uuid);
removeMap.put(uuid, list);
if (totalMap.get(uuid) == null) {
totalMap.put(uuid, 1);
} else {
int t = totalMap.get(uuid);
totalMap.remove(uuid);
totalMap.put(uuid, t + 1);
}
}
public String itemString(ItemStack itemStack) {
String s = "x" + itemStack.getAmount() + " " + itemStack.getType().name().toLowerCase();
if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName()) {
s = s + " (" + itemStack.getItemMeta().getDisplayName() + ")";
}
return s.replace("_", " ");
}
public String itemString(ItemStack itemStack) {
String s = "x" + itemStack.getAmount() + " " + itemStack.getType().name().toLowerCase();
if (itemStack.hasItemMeta() && itemStack.getItemMeta().hasDisplayName()) {
s = s + " (" + itemStack.getItemMeta().getDisplayName() + ")";
}
return s.replace("_", " ");
}
@EventHandler
public void fChestInventoryClick(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
@EventHandler
public void fChestInventoryClick(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
Inventory topInventory = p.getOpenInventory().getTopInventory();
Inventory bottomInventory = p.getOpenInventory().getBottomInventory();
if (topInventory != null) {
if (topInventory.equals(FPlayers.getInstance().getByPlayer(p).getFaction().getChestInventory())) {
Inventory topInventory = p.getOpenInventory().getTopInventory();
Inventory bottomInventory = p.getOpenInventory().getBottomInventory();
if (topInventory != null) {
if (topInventory.equals(FPlayers.getInstance().getByPlayer(p).getFaction().getChestInventory())) {
if (e.getClickedInventory() != null) {
if (e.getClickedInventory().equals(topInventory)) {
ItemStack current = e.getCurrentItem();
if (current == null) return;
ItemStack cursor = e.getCursor();
if (e.getClick().isShiftClick()) return;
if (cursor != null) {
if (current.getType().equals(Material.AIR)) {
if (!cursor.getType().equals(Material.AIR)) {
mapAdd(p.getName(), itemString(cursor));
}
} else {
if (!current.getType().equals(Material.AIR)) {
mapRemove(p.getName(), itemString(current));
}
}
}
} else {
if (e.getClickedInventory().equals(bottomInventory)) {
//clicking from bottom inventory
if (e.getClick().isShiftClick()) {
}
}
if (e.getClickedInventory() != null) {
if (e.getClickedInventory().equals(topInventory)) {
ItemStack current = e.getCurrentItem();
if (current == null) return;
ItemStack cursor = e.getCursor();
if (e.getClick().isShiftClick()) return;
if (cursor != null) {
if (current.getType().equals(Material.AIR)) {
if (!cursor.getType().equals(Material.AIR)) {
mapAdd(p.getName(), itemString(cursor));
}
} else {
if (!current.getType().equals(Material.AIR)) {
mapRemove(p.getName(), itemString(current));
}
}
}
} else {
if (e.getClickedInventory().equals(bottomInventory)) {
//clicking from bottom inventory
if (e.getClick().isShiftClick()) {
}
}
}
}
}
}
}
}
}
}
}
}

View File

@@ -10,31 +10,31 @@ import com.massivecraft.factions.zcore.util.TL;
public class CmdChest extends FCommand {
public CmdChest() {
this.aliases.add("chest");
this.aliases.add("pv");
public CmdChest() {
this.aliases.add("chest");
this.aliases.add("pv");
this.requirements = new CommandRequirements.Builder(Permission.CHEST)
.playerOnly()
.memberOnly()
.withAction(PermissableAction.CHEST)
.build();
}
this.requirements = new CommandRequirements.Builder(Permission.CHEST)
.playerOnly()
.memberOnly()
.withAction(PermissableAction.CHEST)
.build();
}
@Override
public void perform(CommandContext context) {
@Override
public void perform(CommandContext context) {
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fchest.Enabled")) {
context.fPlayer.sendMessage("This command is disabled!");
return;
}
// This permission check is way too explicit but it's clean
context.player.openInventory(context.faction.getChestInventory());
}
if (!FactionsPlugin.getInstance().getConfig().getBoolean("fchest.Enabled")) {
context.fPlayer.sendMessage("This command is disabled!");
return;
}
// This permission check is way too explicit but it's clean
context.player.openInventory(context.faction.getChestInventory());
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VAULT_DESCRIPTION;
}
@Override
public TL getUsageTranslation() {
return TL.COMMAND_VAULT_DESCRIPTION;
}
}