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
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//TODO: Add Disband Confirmation GUI
|
||||||
|
|
||||||
private static HashMap<String, String> disbandMap = new HashMap<>();
|
private static HashMap<String, String> disbandMap = new HashMap<>();
|
||||||
|
|
||||||
@ -27,12 +28,9 @@ public class CmdDisband extends FCommand {
|
|||||||
public CmdDisband() {
|
public CmdDisband() {
|
||||||
super();
|
super();
|
||||||
this.aliases.addAll(Aliases.disband);
|
this.aliases.addAll(Aliases.disband);
|
||||||
|
|
||||||
this.optionalArgs.put("faction tag", "yours");
|
this.optionalArgs.put("faction tag", "yours");
|
||||||
|
|
||||||
this.requirements = new CommandRequirements.Builder(Permission.DISBAND)
|
this.requirements = new CommandRequirements.Builder(Permission.DISBAND)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,7 +18,7 @@ public class CmdHelp extends FCommand {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public ArrayList<ArrayList<String>> helpPages;
|
public ArrayList<ArrayList<String>> helpPages;
|
||||||
|
//TODO: Add Help GUI
|
||||||
public CmdHelp() {
|
public CmdHelp() {
|
||||||
super();
|
super();
|
||||||
this.aliases.addAll(Aliases.help);
|
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!");
|
e.getWhoClicked().sendMessage(CC.RedB + "(!) " + CC.Red + "You cannot drag items while viewing a /f chest!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(
|
@EventHandler(
|
||||||
priority = EventPriority.HIGHEST,
|
priority = EventPriority.HIGHEST,
|
||||||
ignoreCancelled = true
|
ignoreCancelled = true
|
||||||
@ -43,7 +44,8 @@ public class FChestListener implements Listener {
|
|||||||
public void onPlayerClickInventory(InventoryClickEvent event) {
|
public void onPlayerClickInventory(InventoryClickEvent event) {
|
||||||
Player player = (Player) event.getWhoClicked();
|
Player player = (Player) event.getWhoClicked();
|
||||||
FPlayer fPlayer = FPlayers.getInstance().getByPlayer(player);
|
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) {
|
if (event.getClick() == ClickType.UNKNOWN) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.sendMessage(CC.RedB + "(!) " + CC.Red + "You cannot use that click type inside the /f chest!");
|
player.sendMessage(CC.RedB + "(!) " + CC.Red + "You cannot use that click type inside the /f chest!");
|
||||||
@ -55,30 +57,30 @@ public class FChestListener implements Listener {
|
|||||||
ItemStack cursorItem = event.getCursor();
|
ItemStack cursorItem = event.getCursor();
|
||||||
if (event.getClick() == ClickType.NUMBER_KEY) cursorItem = player.getInventory().getItem(event.getHotbarButton());
|
if (event.getClick() == ClickType.NUMBER_KEY) cursorItem = player.getInventory().getItem(event.getHotbarButton());
|
||||||
Material cursorItemType = cursorItem != null ? cursorItem.getType() : Material.AIR;
|
Material cursorItemType = cursorItem != null ? cursorItem.getType() : Material.AIR;
|
||||||
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
|
if (fPlayer == null || !(faction = fPlayer.getFaction()).isNormal()) {
|
||||||
Faction faction;
|
|
||||||
if (fplayer == null || !(faction = fplayer.getFaction()).isNormal()) {
|
|
||||||
player.closeInventory();
|
player.closeInventory();
|
||||||
player.sendMessage(CC.RedB + "(!) " + CC.Red + "You are no longer in your faction!");
|
player.sendMessage(CC.RedB + "(!) " + CC.Red + "You are no longer in your faction!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (event.getClickedInventory() == null) 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) {
|
if (currentItemType != Material.AIR) {
|
||||||
Inventory ours = faction.getChestInventory();
|
Inventory ours = faction.getChestInventory();
|
||||||
if (ours == null || !ours.contains(currentItem)) {
|
if(event.getClickedInventory() == ours) {
|
||||||
event.setCancelled(true);
|
if (ours == null || !ours.contains(currentItem)) {
|
||||||
player.sendMessage(CC.RedB + "(!) That item not longer exists!");
|
event.setCancelled(true);
|
||||||
Bukkit.getLogger().info("[FactionChest] " + player.getName() + " tried to remove " + currentItem + " from /f chest when it didnt contain! Items: " + (ours == null ? "none" : Arrays.toString(ours.getContents())));
|
player.sendMessage(CC.RedB + "(!) That item not longer exists!");
|
||||||
player.closeInventory();
|
Bukkit.getLogger().info("[FactionChest] " + player.getName() + " tried to remove " + currentItem + " from /f chest when it didnt contain! Items: " + (ours == null ? "none" : Arrays.toString(ours.getContents())));
|
||||||
return;
|
player.closeInventory();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
logRemoveItem(currentItem, fplayer, player);
|
logRemoveItem(currentItem, fPlayer, player);
|
||||||
} else if (cursorItemType != Material.AIR && !event.isShiftClick()) {
|
} else if (cursorItemType != Material.AIR && !event.isShiftClick()) {
|
||||||
logAddItem(cursorItem, fplayer, player);
|
logAddItem(cursorItem, fPlayer, player);
|
||||||
}
|
}
|
||||||
} else if (event.isShiftClick() && currentItemType != Material.AIR) {
|
} 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
|
* @author FactionsUUID Team
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//TODO: Add UnclaimAll Confirmation GUI
|
||||||
|
|
||||||
public CmdUnclaimall() {
|
public CmdUnclaimall() {
|
||||||
this.aliases.addAll(Aliases.unclaim_all_unsafe);
|
this.aliases.addAll(Aliases.unclaim_all_unsafe);
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ public class CmdGrace extends FCommand {
|
|||||||
* @author Driftay
|
* @author Driftay
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//TODO: Make Timed Format For Grace Period
|
||||||
|
|
||||||
public CmdGrace() {
|
public CmdGrace() {
|
||||||
super();
|
super();
|
||||||
this.aliases.addAll(Aliases.grace);
|
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
|
//inspect
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInspect(PlayerInteractEvent e) {
|
public void onInspect(PlayerInteractEvent e) {
|
||||||
|
@ -300,6 +300,7 @@ public class FUpgradesGUI implements Listener {
|
|||||||
faction.setChestSize(size * 9);
|
faction.setChestSize(size * 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void updatePower(Faction faction) {
|
private void updatePower(Faction faction) {
|
||||||
int level = faction.getUpgrade(UpgradeType.POWER);
|
int level = faction.getUpgrade(UpgradeType.POWER);
|
||||||
double power = 0.0;
|
double power = 0.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user