Merge pull request #114 from Stefan923/1.6.x

Fixed issues
This commit is contained in:
Driftay 2020-05-09 13:39:51 -04:00 committed by GitHub
commit bbaee8ab06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 30 deletions

View File

@ -27,9 +27,10 @@ public class AntiChestListener implements Listener {
if (e.isCancelled()) return;
Inventory clicked = e.getClickedInventory();
Inventory clicker = e.getWhoClicked().getInventory();
if (e.getClick().isShiftClick()) {
if (clicked == e.getWhoClicked().getInventory()) {
if (clicked == clicker) {
ItemStack clickedOn = e.getCurrentItem();
if (clickedOn != null && FactionsPlugin.getInstance().itemList.contains(clickedOn.getType().toString())) {
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, clickedOn.getType().toString());
@ -38,11 +39,17 @@ public class AntiChestListener implements Listener {
}
}
if (clicked != e.getWhoClicked().getInventory()) {
if (clicked != clicker) {
ItemStack onCursor = e.getCursor();
if (onCursor != null && FactionsPlugin.getInstance().itemList.contains(onCursor.getType().toString())) {
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, onCursor.getType().toString());
e.setCancelled(true);
} else if (e.getClick().isKeyboardClick()) {
ItemStack item = clicker.getItem(e.getHotbarButton());
if (item != null && FactionsPlugin.getInstance().itemList.contains(item.getType().toString())) {
fPlayer.msg(TL.CHEST_ITEM_DENIED_TRANSFER, item.getType().toString());
e.setCancelled(true);
}
}
}
}

View File

@ -57,6 +57,16 @@ public class FPromoteCommand extends FCommand {
context.msg(TL.COMMAND_PROMOTE_NOT_SAME);
return;
}
// Don't allow people to promote people with same or higher rank than their.
if (context.fPlayer.getRole().value <= target.getRole().value) {
context.msg(TL.COMMAND_PROMOTE_HIGHER_RANK, target.getName());
return;
}
// Don't allow people to demote people who already have the lowest rank.
if (current.value == 0 && relative <= 0) {
context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName());
return;
}
// Don't allow people to promote people to their same or higher rank.
if (context.fPlayer.getRole().value <= promotion.value) {
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);
@ -64,11 +74,16 @@ public class FPromoteCommand extends FCommand {
}
}
if (promotion == null) {
context.msg(TL.COMMAND_PROMOTE_NOTTHATPLAYER);
// Don't allow people to demote people who already have the lowest rank.
if (current.value == 0 && relative <= 0) {
context.msg(TL.COMMAND_PROMOTE_LOWEST_RANK, target.getName());
return;
}
// Don't allow people to promote people who already have the highest rank.
if (current.value == 4 && relative > 0) {
context.msg(TL.COMMAND_PROMOTE_HIGHEST_RANK, target.getName());
return;
}
// Don't allow people to promote people to their same or higher rnak.
if (context.fPlayer.getRole().value <= promotion.value) {
context.msg(TL.COMMAND_PROMOTE_NOT_ALLOWED);

View File

@ -581,7 +581,8 @@ public class FactionsPlayerListener implements Listener {
public void checkCanFly(FPlayer me) {
if (!me.canFlyAtLocation() || me.checkIfNearbyEnemies()) {
me.setFFlying(false, false);
if (me.isFlying())
me.setFFlying(false, false);
return;
}
if (me.isFlying() || !FactionsPlugin.instance.getConfig().getBoolean("ffly.AutoEnable"))

View File

@ -141,8 +141,8 @@ public enum TL {
COMMAND_ADMIN_TARGETSELF("'&c&l[!] &cThe target player musn''t be yourself."),
COMMAND_ADMIN_DEMOTES("&c&l[!] &cYou have demoted &7%1$s &cfrom the position of faction admin."),
COMMAND_ADMIN_DEMOTED("&c&l[!] &cYou have been demoted from the position of faction admin by &7%1$s&c"),
COMMAND_ADMIN_PROMOTES("&e&l[!] &eYou have promoted &6%1$s &eto the position of faction admin."),
COMMAND_ADMIN_PROMOTED("&e&l[!] &6%1$s &egave &6%2$s &ethe leadership of &6%3$s&e."),
COMMAND_ADMIN_PROMOTES("&c&l[!] &7You have promoted &c%1$s &7to the position of faction admin."),
COMMAND_ADMIN_PROMOTED("&c&l[!] &c%1$s &7gave &c%2$s &7the leadership of &c%3$s&7."),
COMMAND_ADMIN_DESCRIPTION("Hand over your admin rights"),
COMMAND_ADMIN_NOMEMBERS("&e&l[!] &cNo one else to promote, please disband faction."),
@ -302,7 +302,7 @@ public enum TL {
COMMAND_CREATE_TOCREATE("to create a new faction"),
COMMAND_CREATE_FORCREATE("for creating a new faction"),
COMMAND_CREATE_ERROR("&c&l[!]&7 There was an &cinternal error&7 while trying to create your faction. &cPlease try again&7."),
COMMAND_CREATE_CREATED("&c&l[!]&7 &c%1$s &7created a new faction &c&l%2$s"),
COMMAND_CREATE_CREATED("&c&l[!]&7 &c%1$s &7created a new faction named &c&l%2$s&7."),
COMMAND_CREATE_YOUSHOULD("&c&l[!]&7 You should now: &c%1$s"),
COMMAND_CREATE_CREATEDLOG(" created a new faction: "),
COMMAND_CREATE_DESCRIPTION("Create a new faction"),
@ -395,20 +395,20 @@ public enum TL {
COMMAND_DISBAND_MARKEDPERMANENT("&c&l[!]&7 This faction is designated as&c permanent&7, so you cannot disband it."),
COMMAND_DISBAND_BROADCAST_YOURS("&c&l[!]&7 &c%1$s&7 disbanded your &cfaction."),
COMMAND_DISBAND_BROADCAST_GENERIC("&c&l[!]&7 The Faction &c%1$s&7 was disbanded."),
COMMAND_DISBAND_BROADCAST_NOTYOURS("&c&l[!]&7 &c%1$s &7disbanded the faction &c%2$s."),
COMMAND_DISBAND_BROADCAST_NOTYOURS("&c&l[!]&7 &c%1$s &7disbanded the faction &c%2$s&7."),
COMMAND_DISBAND_HOLDINGS("&c&l[!]&7 &7You have been given the disbanded &cfaction's bank&7, totaling &c%1$s."),
COMMAND_DISBAND_PLAYER("&c&l[!] &7You have disbanded your &cfaction"),
COMMAND_DISBAND_CONFIRM("&c&l[!]&7 Your Faction has&c {tnt} &7tnt left in the bank, it will be &clost&7 if the faction is &cdisbanded&7. Type&c /f disband &7again within &c10&7 seconds to&c disband&7."),
COMMAND_DISBAND_DESCRIPTION("Disband a faction"),
COMMAND_FLY_DISABLED("&c&l[!]&7 Sorry, Faction flight is &cdisabled &7on this server"),
COMMAND_FLY_DISABLED("&c&l[!]&7 Sorry, Faction flight is &cdisabled &7on this server."),
COMMAND_FLY_DESCRIPTION("Enter or leave Faction flight mode"),
COMMAND_FLY_CHANGE("&c&l[!]&7 Faction flight &c%1$s"),
COMMAND_FLY_COOLDOWN("&c&l[!]&7 You will &cnot&7 take fall damage for &c{amount}&7 seconds"),
COMMAND_FLY_DAMAGE("&c&l[!]&7 Faction flight &cdisabled&7 due to entering combat"),
COMMAND_FLY_CHANGE("&c&l[!]&7 Faction flight has been &c%1$s&7."),
COMMAND_FLY_COOLDOWN("&c&l[!]&7 You will &cnot&7 take fall damage for &c{amount}&7 seconds."),
COMMAND_FLY_DAMAGE("&c&l[!]&7 Faction flight &cdisabled&7 due to entering combat."),
COMMAND_FLY_NO_ACCESS("&c&l[!]&7 &cCannot fly &7in territory of %1$s"),
COMMAND_FLY_ENEMY_NEAR("&c&l[!]&7 Flight has been&c disabled&7 an enemy is nearby"),
COMMAND_FLY_CHECK_ENEMY("&c&l[!]&7 Cannot fly here, an enemy is &cnearby"),
COMMAND_FLY_ENEMY_NEAR("&c&l[!]&7 Flight has been&c disabled&7 an enemy is nearby."),
COMMAND_FLY_CHECK_ENEMY("&c&l[!]&7 Cannot fly here, an enemy is &cnearby&7."),
COMMAND_FLY_NO_EPEARL("&c&l[!] &7You &ccannot&7 throw enderpearls while flying!"),
COMMAND_FOCUS_SAMEFACTION("&c[!] You may not focus players in your faction!"),
@ -621,7 +621,7 @@ public enum TL {
COMMAND_OPEN_OPEN("open"),
COMMAND_OPEN_CLOSED("closed"),
COMMAND_OPEN_CHANGES("&c&l[!]&7 &c%1$s&7 changed the faction to &c%2$s&7."),
COMMAND_OPEN_CHANGED("&c&l[!]&7 The faction &c%1$s&7 is now &c%2$s"),
COMMAND_OPEN_CHANGED("&c&l[!]&7 The faction &c%1$s&7 is now &c%2$s&7."),
COMMAND_OPEN_DESCRIPTION("Switch if invitation is required to join"),
COMMAND_OWNER_DISABLED("&c&l[!]&7 Sorry, but &cowned areas &7are &cdisabled &7on this server."),
@ -707,11 +707,14 @@ public enum TL {
COMMAND_PERMANENT_GRANT("&c&l[!]&7 added permanent status to"),
COMMAND_PERMANENT_REVOKE("&c&l[!]&7 removed permanent status from"),
COMMAND_PERMANENT_YOURS("&c&l[!]&7 &c%1$s&7 has &c%2$s&7 your faction"),
COMMAND_PERMANENT_OTHER("&c&l[!]&7 &c%s &7has &c%s &7the faction &c'%s'."),
COMMAND_PROMOTE_TARGET("&c&l[!]&7 You've been &c%1$s&7 to &c%2$s"),
COMMAND_PROMOTE_SUCCESS("&c&l[!]&7 You successfully&c %1$s %2$s &cto&7 %3$s"),
COMMAND_PERMANENT_OTHER("&c&l[!]&7 &c%s &7has &c%s &7the faction '&c%s&7'."),
COMMAND_PROMOTE_TARGET("&c&l[!]&7 You've been &c%1$s&7 to &c%2$s&7."),
COMMAND_PROMOTE_SUCCESS("&c&l[!]&7 You successfully &c%1$s %2$s &cto&7 %3$s&7."),
COMMAND_PROMOTE_PROMOTED("promoted"),
COMMAND_PROMOTE_DEMOTED("demoted"),
COMMAND_PROMOTE_LOWEST_RANK("&c&l[!]&7 &c%1$s&7 already has the lowest rank in the faction."),
COMMAND_PROMOTE_HIGHEST_RANK("&c&l[!]&7 &c%1$s&7 already has the highest rank in the faction."),
COMMAND_PROMOTE_HIGHER_RANK("&c&l[!]&7 &c%1$s&7 has a higher rank than yours. You &4can not modify&7 his rank."),
COMMAND_PROMOTE_COLEADER_ADMIN("&c&l[!]&7 &cColeaders cant promote players to Admin!"),
COMMAND_PERMANENTPOWER_DESCRIPTION("Toggle permanent faction power option"),
@ -723,7 +726,6 @@ public enum TL {
COMMAND_PROMOTE_DESCRIPTION("/f promote <name>"),
COMMAND_PROMOTE_WRONGFACTION("&c&l[!]&7 &c%1$s&7 is &cnot&7 part of your faction."),
COMMAND_NOACCESS("&c&l[!]&7 You don't have access to that."),
COMMAND_PROMOTE_NOTTHATPLAYER("&c&l[!]&7 That player &ccannot&7 be promoted."),
COMMAND_PROMOTE_NOT_ALLOWED("&c&l[!]&7 You cannot promote to the same rank as yourself!"),
COMMAND_PROMOTE_NOTSELF("&c&l[!]&7 You cannot manage your own rank."),
COMMAND_PROMOTE_NOT_SAME("&c&l[!]&7 You cannot promote to the same rank as yourself!"),
@ -731,7 +733,7 @@ public enum TL {
COMMAND_POWER_TOSHOW("to show player power info"),
COMMAND_POWER_FORSHOW("for showing player power info"),
COMMAND_POWER_POWER("&c&l[!]&7 &c%1$s » &cPower &7/ &cMaxpower&a » &c%2$d &7/&c%3$d %4$s"),
COMMAND_POWER_POWER("&c&l[!]&7 &c%1$s » &cPower &7/ &cMaxpower&a » &c%2$d &7/ &c%3$d %4$s"),
COMMAND_POWER_BONUS(" (bonus: "),
COMMAND_POWER_PENALTY(" (penalty: "),
COMMAND_POWER_DESCRIPTION("&a&l» &7Show player &apower &7info"),
@ -750,16 +752,16 @@ public enum TL {
COMMAND_RELATIONS_ALREADYINRELATIONSHIP("&c&l[!]&7 You &calready&7 have that relation wish set with&c %1$s."),
COMMAND_RELATIONS_TOMARRY("to change a relation wish"),
COMMAND_RELATIONS_FORMARRY("for changing a relation wish"),
COMMAND_RELATIONS_MUTUAL("&c&l[!]&7 Your faction is now %1$s to %2$s"),
COMMAND_RELATIONS_MUTUAL("&c&l[!]&7 Your faction is now %1$s&7 to &c%2$s&7."),
COMMAND_RELATIONS_PEACEFUL("&c&l[!]&7 This will have no effect while your faction is peaceful."),
COMMAND_RELATIONS_PEACEFULOTHER("&c&l[!]&7 This will have &cno effect&7 while their faction is peaceful."),
COMMAND_RELATIONS_DESCRIPTION("Set relation wish to another faction"),
COMMAND_RELATIONS_EXCEEDS_ME("&c&l[!]&7 Failed to set relation wish. You can only have %1$s %2$s."),
COMMAND_RELATIONS_EXCEEDS_THEY("&c&l[!]&7 Failed to set relation wish. They can only have %1$s %2$s."),
COMMAND_RELATIONS_PROPOSAL_1("&c&l[!]&7&c %1$s &7wishes to be your&c %2$s"),
COMMAND_RELATIONS_PROPOSAL_1("&c&l[!]&7 &c%1$s &7wishes to be your &c%2$s&7."),
COMMAND_RELATIONS_PROPOSAL_2("&c&l[!]&7 Type &c/%1$s %2$s %3$s&7 to accept."),
COMMAND_RELATIONS_PROPOSAL_SENT("&c&l[!]&7 &c%1$s&7 were informed that you wish to be &c%2$s"),
COMMAND_RELATIONS_PROPOSAL_SENT("&c&l[!]&7 &c%1$s&7 were informed that you wish to be &c%2$s&7."),
COMMAND_RELOAD_TIME("&c&l[!]&7 Reloaded &call &7configuration files from disk, took &c%1$d ms."),
COMMAND_RELOAD_DESCRIPTION("Reload data file(s) from disk"),
@ -1033,12 +1035,12 @@ public enum TL {
/**
* Leaving - This is accessed through a command, and so it MAY need a COMMAND_* slug :s
*/
LEAVE_PASSADMIN("You must give the admin role to someone else first."),
LEAVE_NEGATIVEPOWER("You cannot leave until your power is positive."),
LEAVE_PASSADMIN("&c&l[!] &7You must give the admin role to someone else first."),
LEAVE_NEGATIVEPOWER("&c&l[!] &7You cannot leave until your power is positive."),
LEAVE_TOLEAVE("to leave your faction."),
LEAVE_FORLEAVE("for leaving your faction."),
LEAVE_LEFT("%s left faction %s."),
LEAVE_DISBANDED("%s was disbanded."),
LEAVE_LEFT("&c&l[!] &c%s&7 left faction &c%s&7."),
LEAVE_DISBANDED("&c&l[!] &c%s&7 was disbanded."),
LEAVE_DISBANDEDLOG("The faction %s (%s) was disbanded due to the last player (%s) leaving."),
LEAVE_DESCRIPTION("\\n &a&l» &7Leave your faction"),
AUTOLEAVE_ADMIN_PROMOTED("&e&l[!] &7Faction admin &c%s&7 has been removed. &c%s&7 has been promoted as the new faction admin."),
@ -1172,7 +1174,7 @@ public enum TL {
ECON_PERSONTOOKMONEYFROM("%1$s took %2$s from %3$s."),
ECON_DISABLED("Factions econ is disabled."),
ECON_OVER_BAL_CAP("&4The amount &e%s &4is over Essentials' balance cap."),
ECON_MONEYLOST("&c%s &7lost &c%s &7%s."),
ECON_MONEYLOST("&c&l[!] %s &7lost &c%s &7%s."),
ECON_CANTAFFORD("&c%s &7can't afford &c%s&7 %s."),
ECON_UNABLETOTRANSFER("&7Unable to transfer &c%s&7 to &c%s&7 from &c%s&7."),
ECON_PLAYERBALANCE("&c%s&7's balance is &c%s&7."),