Fixed F Chest Logging
This commit is contained in:
parent
b8f6a05538
commit
ad69019ba6
@ -20,6 +20,7 @@ public class CmdDisband extends FCommand {
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
|
||||
//TODO: Add Disband Confirmation GUI
|
||||
|
||||
private static HashMap<String, String> disbandMap = new HashMap<>();
|
||||
|
||||
@ -27,12 +28,9 @@ public class CmdDisband extends FCommand {
|
||||
public CmdDisband() {
|
||||
super();
|
||||
this.aliases.addAll(Aliases.disband);
|
||||
|
||||
this.optionalArgs.put("faction tag", "yours");
|
||||
|
||||
this.requirements = new CommandRequirements.Builder(Permission.DISBAND)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@ public class CmdHelp extends FCommand {
|
||||
*/
|
||||
|
||||
public ArrayList<ArrayList<String>> helpPages;
|
||||
|
||||
//TODO: Add Help GUI
|
||||
public CmdHelp() {
|
||||
super();
|
||||
this.aliases.addAll(Aliases.help);
|
||||
|
@ -36,6 +36,7 @@ public class FChestListener implements Listener {
|
||||
e.getWhoClicked().sendMessage(CC.RedB + "(!) " + CC.Red + "You cannot drag items while viewing a /f chest!");
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(
|
||||
priority = EventPriority.HIGHEST,
|
||||
ignoreCancelled = true
|
||||
@ -43,7 +44,8 @@ public class FChestListener implements Listener {
|
||||
public void onPlayerClickInventory(InventoryClickEvent event) {
|
||||
Player player = (Player) event.getWhoClicked();
|
||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
||||
if (!fPlayer.isInFactionsChest()) return;
|
||||
Faction faction;
|
||||
if(!event.getView().getTitle().equalsIgnoreCase(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fchest.Inventory-Title")))) return;
|
||||
if (event.getClick() == ClickType.UNKNOWN) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(CC.RedB + "(!) " + CC.Red + "You cannot use that click type inside the /f chest!");
|
||||
@ -55,17 +57,16 @@ public class FChestListener implements Listener {
|
||||
ItemStack cursorItem = event.getCursor();
|
||||
if (event.getClick() == ClickType.NUMBER_KEY) cursorItem = player.getInventory().getItem(event.getHotbarButton());
|
||||
Material cursorItemType = cursorItem != null ? cursorItem.getType() : Material.AIR;
|
||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
||||
Faction faction;
|
||||
if (fplayer == null || !(faction = fplayer.getFaction()).isNormal()) {
|
||||
if (fPlayer == null || !(faction = fPlayer.getFaction()).isNormal()) {
|
||||
player.closeInventory();
|
||||
player.sendMessage(CC.RedB + "(!) " + CC.Red + "You are no longer in your faction!");
|
||||
return;
|
||||
}
|
||||
if (event.getClickedInventory() == null) return;
|
||||
if (event.getView().getTitle().equalsIgnoreCase(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fchest.Inventory-Title")))) {
|
||||
if (event.getView().getTitle().equalsIgnoreCase(FactionsPlugin.getInstance().color(FactionsPlugin.getInstance().getConfig().getString("fchest.Inventory-Title"))) && !event.getClick().isShiftClick()) {
|
||||
if (currentItemType != Material.AIR) {
|
||||
Inventory ours = faction.getChestInventory();
|
||||
if(event.getClickedInventory() == ours) {
|
||||
if (ours == null || !ours.contains(currentItem)) {
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(CC.RedB + "(!) That item not longer exists!");
|
||||
@ -73,12 +74,13 @@ public class FChestListener implements Listener {
|
||||
player.closeInventory();
|
||||
return;
|
||||
}
|
||||
logRemoveItem(currentItem, fplayer, player);
|
||||
}
|
||||
logRemoveItem(currentItem, fPlayer, player);
|
||||
} else if (cursorItemType != Material.AIR && !event.isShiftClick()) {
|
||||
logAddItem(cursorItem, fplayer, player);
|
||||
logAddItem(cursorItem, fPlayer, player);
|
||||
}
|
||||
} else if (event.isShiftClick() && currentItemType != Material.AIR) {
|
||||
logAddItem(currentItem, fplayer, player);
|
||||
logAddItem(currentItem, fPlayer, player);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@ public class CmdUnclaimall extends FCommand {
|
||||
* @author FactionsUUID Team
|
||||
*/
|
||||
|
||||
//TODO: Add UnclaimAll Confirmation GUI
|
||||
|
||||
public CmdUnclaimall() {
|
||||
this.aliases.addAll(Aliases.unclaim_all_unsafe);
|
||||
|
||||
|
@ -15,6 +15,8 @@ public class CmdGrace extends FCommand {
|
||||
* @author Driftay
|
||||
*/
|
||||
|
||||
//TODO: Make Timed Format For Grace Period
|
||||
|
||||
public CmdGrace() {
|
||||
super();
|
||||
this.aliases.addAll(Aliases.grace);
|
||||
|
@ -577,6 +577,13 @@ public class FactionsPlayerListener implements Listener {
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onCommand(PlayerCommandPreprocessEvent e){
|
||||
if(e.getMessage().equalsIgnoreCase("/f outpost")){
|
||||
e.setMessage("/outpost");
|
||||
}
|
||||
}
|
||||
|
||||
//inspect
|
||||
@EventHandler
|
||||
public void onInspect(PlayerInteractEvent e) {
|
||||
|
@ -300,6 +300,7 @@ public class FUpgradesGUI implements Listener {
|
||||
faction.setChestSize(size * 9);
|
||||
}
|
||||
|
||||
|
||||
private void updatePower(Faction faction) {
|
||||
int level = faction.getUpgrade(UpgradeType.POWER);
|
||||
double power = 0.0;
|
||||
|
Loading…
Reference in New Issue
Block a user