SavageFactions 1.0.23

Ability to remove items from main menu in perms for choosing roles/relations by setting the slot to -1
Changed placeholder identifier back because hooks in many plugins broke :(
Removed debug message from warzone fly.
Changed public modifiers on relation back, as they broke the method signature.
This commit is contained in:
Naman 2018-04-07 16:29:24 -05:00
parent f1bfe2e8c4
commit 0c1a90da22
7 changed files with 82 additions and 77 deletions

View File

@ -6,6 +6,8 @@ import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.Particles.ParticleEffect; import com.massivecraft.factions.util.Particles.ParticleEffect;
import com.massivecraft.factions.util.WarmUpUtil; import com.massivecraft.factions.util.WarmUpUtil;
import com.massivecraft.factions.zcore.fperms.Access;
import com.massivecraft.factions.zcore.fperms.PermissableAction;
import com.massivecraft.factions.zcore.util.TL; import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
@ -59,7 +61,12 @@ public class CmdFly extends FCommand {
flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() { flyid = Bukkit.getScheduler().scheduleSyncRepeatingTask(P.p, new Runnable() {
@Override @Override
public void run() { public void run() {
checkTaskState();
if (flyMap.keySet().size() != 0) {
for (String name : flyMap.keySet()) { for (String name : flyMap.keySet()) {
if (name == null) {
continue;
}
Player player = Bukkit.getPlayer(name); Player player = Bukkit.getPlayer(name);
if (player == null) { if (player == null) {
continue; continue;
@ -93,9 +100,11 @@ public class CmdFly extends FCommand {
continue; continue;
} }
} }
checkTaskState();
} }
} }
}
}, 20L, 20L); }, 20L, 20L);
} }
@ -109,22 +118,29 @@ public class CmdFly extends FCommand {
if (player.hasPermission("factions.fly.safezone") && toFac.isSafeZone()) { if (player.hasPermission("factions.fly.safezone") && toFac.isSafeZone()) {
return true; return true;
} }
if (player.hasPermission("factions.fly.enemy") && toFac.getRelationTo(fplayer.getFaction()) == Relation.ENEMY) { Access access = toFac.getAccess(fplayer, PermissableAction.FLY);
if ((player.hasPermission("factions.fly.enemy") || access == Access.ALLOW) && toFac.getRelationTo(fplayer.getFaction()) == Relation.ENEMY) {
return true; return true;
} }
if (player.hasPermission("factions.fly.ally") && toFac.getRelationTo(fplayer.getFaction()) == Relation.ALLY) { if ((player.hasPermission("factions.fly.ally") || access == Access.ALLOW) && toFac.getRelationTo(fplayer.getFaction()) == Relation.ALLY) {
return true; return true;
} }
if (player.hasPermission("factions.fly.truce") && toFac.getRelationTo(fplayer.getFaction()) == Relation.TRUCE) { if ((player.hasPermission("factions.fly.truce") || access == Access.ALLOW) && toFac.getRelationTo(fplayer.getFaction()) == Relation.TRUCE) {
return true; return true;
} }
return player.hasPermission("factions.fly.neutral") && toFac.getRelationTo(fplayer.getFaction()) == Relation.NEUTRAL; return ((player.hasPermission("factions.fly.neutral") || access == Access.ALLOW) && toFac.getRelationTo(fplayer.getFaction()) == Relation.NEUTRAL && !isSystemFaction(toFac));
} }
public boolean isInFlightChecker(Player player) { public boolean isInFlightChecker(Player player) {
return flyMap.containsKey(player.getName()); return flyMap.containsKey(player.getName());
} }
public static Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() ||
faction.isWarZone() ||
faction.isWilderness();
}
@Override @Override
public void perform() { public void perform() {
// Disabled by default. // Disabled by default.
@ -145,24 +161,24 @@ public class CmdFly extends FCommand {
return; return;
} }
if (!me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) { if (!me.hasPermission("factions.fly.warzone") && toFac.isWarZone()) {
Bukkit.broadcastMessage("oooooooow");
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return; return;
} }
if (!me.hasPermission("factions.fly.enemy") && toFac.getRelationTo(myFaction)== Relation.ENEMY){ Access access = toFac.getAccess(fme, PermissableAction.FLY);
if ((!(me.hasPermission("factions.fly.enemy") || access == Access.ALLOW)) && toFac.getRelationTo(fme.getFaction()) == Relation.ENEMY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return; return;
} }
if (!me.hasPermission("factions.fly.ally") && toFac.getRelationTo(myFaction)== Relation.ALLY){ if (!(me.hasPermission("factions.fly.ally") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.ALLY) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return; return;
} }
if (!me.hasPermission("factions.fly.truce") && toFac.getRelationTo(myFaction)== Relation.TRUCE){ if (!(me.hasPermission("factions.fly.truce") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.TRUCE) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return; return;
} }
if ((!me.hasPermission("factions.fly.neutral") && toFac.getRelationTo(myFaction) == Relation.NEUTRAL && !isSystemFaction(toFac))) { if (!(me.hasPermission("factions.fly.neutral") || access == Access.ALLOW) && toFac.getRelationTo(fme.getFaction()) == Relation.NEUTRAL && !isSystemFaction(toFac)) {
fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme)); fme.msg(TL.COMMAND_FLY_NO_ACCESS, Board.getInstance().getFactionAt(myfloc).getTag(fme));
return; return;
} }
@ -193,12 +209,6 @@ public class CmdFly extends FCommand {
} }
} }
public Boolean isSystemFaction(Faction faction) {
return faction.isSafeZone() ||
faction.isWarZone() ||
faction.isWilderness();
}
public static void checkTaskState() { public static void checkTaskState() {
if (flyMap.keySet().size() == 0) { if (flyMap.keySet().size() == 0) {
Bukkit.getScheduler().cancelTask(flyid); Bukkit.getScheduler().cancelTask(flyid);
@ -213,6 +223,8 @@ public class CmdFly extends FCommand {
return; return;
} }
if (fme.canFlyAtLocation())
this.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", new Runnable() { this.doWarmUp(WarmUpUtil.Warmup.FLIGHT, TL.WARMUPS_NOTIFY_FLIGHT, "Fly", new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -18,12 +18,12 @@ public class ClipPlaceholderAPIManager extends PlaceholderExpansion implements R
// Identifier for this expansion // Identifier for this expansion
@Override @Override
public String getIdentifier() { public String getIdentifier() {
return "savagefactions"; return "factionsuuid";
} }
@Override @Override
public String getAuthor() { public String getAuthor() {
return "prosavage"; return "drtshock";
} }
// Since we are registering this expansion from the dependency, this can be null // Since we are registering this expansion from the dependency, this can be null

View File

@ -61,6 +61,9 @@ public class PermissableRelationGUI implements InventoryHolder, FactionGUI {
for (String key : section.getConfigurationSection("slots").getKeys(false)) { for (String key : section.getConfigurationSection("slots").getKeys(false)) {
int slot = section.getInt("slots." + key); int slot = section.getInt("slots." + key);
if (slot == -1) {
continue;
}
if (slot + 1 > guiSize && slot > 0) { if (slot + 1 > guiSize && slot > 0) {
P.p.log(Level.WARNING, "Invalid slot of " + key.toUpperCase() + " in relation GUI skipping it"); P.p.log(Level.WARNING, "Invalid slot of " + key.toUpperCase() + " in relation GUI skipping it");
continue; continue;

View File

@ -57,15 +57,17 @@ public class CropUpgrades implements Listener {
if (below.getType() == Material.SUGAR_CANE_BLOCK) { if (below.getType() == Material.SUGAR_CANE_BLOCK) {
org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock(); org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock();
if (above.getType() == Material.AIR) { if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) {
above.setType(Material.SUGAR_CANE_BLOCK); above.setType(Material.SUGAR_CANE_BLOCK);
} }
} }
if (below.getType() == Material.CACTUS) { if (below.getType() == Material.CACTUS) {
org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock(); org.bukkit.block.Block above = e.getBlock().getLocation().add(0, 1, 0).getBlock();
if (above.getType() == Material.AIR) {
if (above.getType() == Material.AIR && above.getLocation().add(0, -2, 0).getBlock().getType() != Material.AIR) {
above.setType(Material.CACTUS); above.setType(Material.CACTUS);
} }
} }

View File

@ -959,19 +959,7 @@ public abstract class MemoryFPlayer implements FPlayer {
public boolean canFlyAtLocation(FLocation location) { public boolean canFlyAtLocation(FLocation location) {
Faction faction = Board.getInstance().getFactionAt(location); Faction faction = Board.getInstance().getFactionAt(location);
if ((!faction.isWilderness() && getPlayer().hasPermission("factions.fly.wilderness")) || (faction.isSafeZone() && getPlayer().hasPermission("factions.fly.safezone") )|| (faction.isWarZone() && getPlayer().hasPermission("factions.fly.warzone"))) { if ((faction == getFaction() && getRole() == Role.ADMIN) || isAdminBypassing) {
return false;
}
if (!getPlayer().hasPermission("factions.fly.ally") && getRelationToLocation() == Relation.ALLY) {
return false;
}
if (!getPlayer().hasPermission("factions.fly.truce") && getRelationToLocation() == Relation.TRUCE) {
return false;
}
if (!getPlayer().hasPermission("factions.fly.neutral") && getRelationToLocation() == Relation.NEUTRAL) {
return false;
}
if (faction == getFaction() && getRole() == Role.ADMIN) {
return true; return true;
} }

View File

@ -1,4 +1,4 @@
# Lang file for FactionsUUID by drtshock & ProSavage # Lang file for SavageFactions by drtshock & ProSavage
# Use & for color codes. # Use & for color codes.
# Made with love <3 # Made with love <3

View File

@ -1,5 +1,5 @@
name: Factions name: Factions
version: ${project.version}-SF-1.0.22 version: ${project.version}-SF-1.0.23-BETA
main: com.massivecraft.factions.P main: com.massivecraft.factions.P
authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage] authors: [Olof Larsson, Brett Flannigan, drtshock, ProSavage]
softdepend: [PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop] softdepend: [PlayerVaults, PlaceholderAPI, MVdWPlaceholderAPI, PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag, dynmap, FactionsTop]