Compare commits

...

4 Commits

13 changed files with 29 additions and 47 deletions

View File

@@ -4,7 +4,7 @@
<groupId>com.massivecraft</groupId> <groupId>com.massivecraft</groupId>
<artifactId>Factions</artifactId> <artifactId>Factions</artifactId>
<version>1.6.9.5-U0.2.1-2.0.7-BETA</version> <version>1.6.9.5-U0.2.1-2.0.9-BETA</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>SaberFactions</name> <name>SaberFactions</name>
@@ -387,11 +387,6 @@
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>org.codemc.worldguardwrapper</groupId>
<artifactId>worldguardwrapper</artifactId>
<version>1.1.6-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>com.jagrosh</groupId> <groupId>com.jagrosh</groupId>
<artifactId>jda-utilities-commons</artifactId> <artifactId>jda-utilities-commons</artifactId>

View File

@@ -440,4 +440,5 @@ public interface Faction extends EconomyParticipator {
String getPaypal(); String getPaypal();
void paypalSet(String paypal); void paypalSet(String paypal);
} }

View File

@@ -195,7 +195,7 @@ public class FactionsPlugin extends MPlugin {
return; return;
} }
//Update their config if needed //Update their config if needed
Updater.updateIfNeeded(getConfig()); // Updater.updateIfNeeded(getConfig());
RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class); RegisteredServiceProvider<Economy> rsp = FactionsPlugin.this.getServer().getServicesManager().getRegistration(Economy.class);
FactionsPlugin.econ = rsp.getProvider(); FactionsPlugin.econ = rsp.getProvider();
com.massivecraft.factions.integration.Essentials.setup(); com.massivecraft.factions.integration.Essentials.setup();
@@ -737,4 +737,8 @@ public class FactionsPlugin extends MPlugin {
public void debug(String s) { public void debug(String s) {
debug(Level.INFO, s); debug(Level.INFO, s);
} }
public Worldguard getWg() {
return wg;
}
} }

View File

@@ -122,7 +122,7 @@ public class CmdFly extends FCommand {
} }
return me.hasPermission(Permission.FLY.node) && (access != Access.DENY || toFac.isSystemFaction()); return me.hasPermission(Permission.FLY.node) && (access != Access.DENY || toFac.isSystemFaction());
} }
return fme.canFlyAtLocation(); return true;
} }

View File

@@ -62,7 +62,7 @@ public class CmdTnt extends FCommand {
return; return;
} }
ItemStack tnt = new ItemStack(Material.TNT, amount); ItemStack tnt = new ItemStack(Material.TNT, amount);
if (context.faction.getTnt() + amount > FactionsPlugin.instance.getConfig().getInt("ftnt.Bank-Limit")) { if (context.faction.getTnt() + amount > context.faction.getTntBankLimit()) {
context.msg(TL.COMMAND_TNT_EXCEEDLIMIT); context.msg(TL.COMMAND_TNT_EXCEEDLIMIT);
return; return;
} }
@@ -71,7 +71,7 @@ public class CmdTnt extends FCommand {
context.faction.addTnt(amount); context.faction.addTnt(amount);
context.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS); context.msg(TL.COMMAND_TNT_DEPOSIT_SUCCESS);
context.fPlayer.sendMessage(FactionsPlugin.instance.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.fPlayer.getFaction().getTnt() + ""))); context.fPlayer.sendMessage(FactionsPlugin.instance.color(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "").replace("{maxAmount}", context.faction.getTntBankLimit() + "")));
return; return;
} }
@@ -113,7 +113,7 @@ public class CmdTnt extends FCommand {
context.msg(TL.GENERIC_ARGS_TOOFEW); context.msg(TL.GENERIC_ARGS_TOOFEW);
context.msg(context.args.get(0).equalsIgnoreCase("take") || context.args.get(0).equalsIgnoreCase("t") ? TL.COMMAND_TNT_TAKE_DESCRIPTION : TL.COMMAND_TNT_ADD_DESCRIPTION); context.msg(context.args.get(0).equalsIgnoreCase("take") || context.args.get(0).equalsIgnoreCase("t") ? TL.COMMAND_TNT_TAKE_DESCRIPTION : TL.COMMAND_TNT_ADD_DESCRIPTION);
} }
context.sendMessage(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "")); context.sendMessage(TL.COMMAND_TNT_AMOUNT.toString().replace("{amount}", context.faction.getTnt() + "").replace("{maxAmount}", context.faction.getTntBankLimit() + ""));
} }

View File

@@ -80,7 +80,6 @@ public class FactionsBlockListener implements Listener {
boolean pain = !justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW; boolean pain = !justCheck && myFaction.getAccess(me, PermissableAction.PAIN_BUILD) == Access.ALLOW;
return CheckActionState(myFaction, loc, me, PermissableAction.fromString(action), pain); return CheckActionState(myFaction, loc, me, PermissableAction.fromString(action), pain);
} }
// Something failed prevent build // Something failed prevent build
return false; return false;
} }
@@ -137,7 +136,6 @@ public class FactionsBlockListener implements Listener {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }
if (isSpawner) { if (isSpawner) {
if (Conf.spawnerLock) { if (Conf.spawnerLock) {
event.setCancelled(true); event.setCancelled(true);

View File

@@ -24,9 +24,6 @@ public class CmdMissions extends FCommand {
@Override @Override
public void perform(CommandContext context) { public void perform(CommandContext context) {
if (context.faction == null) {
return;
}
final MissionGUI missionsGUI = new MissionGUI(FactionsPlugin.getInstance(), context.fPlayer); final MissionGUI missionsGUI = new MissionGUI(FactionsPlugin.getInstance(), context.fPlayer);
missionsGUI.build(); missionsGUI.build();
context.player.openInventory(missionsGUI.getInventory()); context.player.openInventory(missionsGUI.getInventory());

View File

@@ -31,9 +31,7 @@ public class MissionGUI implements FactionGUI {
@Override @Override
public void onClick(int slot, ClickType action) { public void onClick(int slot, ClickType action) {
String missionName = slots.get(slot); String missionName = slots.get(slot);
if (missionName == null) { if (missionName == null) return;
return;
}
ConfigurationSection configurationSection = plugin.getConfig().getConfigurationSection("Missions"); ConfigurationSection configurationSection = plugin.getConfig().getConfigurationSection("Missions");
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Allowed.Name")))) { if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Allowed.Name")))) {
Mission pickedMission = null; Mission pickedMission = null;
@@ -54,25 +52,22 @@ public class MissionGUI implements FactionGUI {
} }
} }
} else if (plugin.getConfig().getBoolean("Randomization.Enabled")) {return;} } else if (plugin.getConfig().getBoolean("Randomization.Enabled")) {return;}
if (configurationSection == null) { if (configurationSection == null) return;
return;
}
int max = plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce"); int max = plugin.getConfig().getInt("MaximumMissionsAllowedAtOnce");
if (fPlayer.getFaction().getMissions().size() >= max) { if (fPlayer.getFaction().getMissions().size() >= max) {
fPlayer.msg(TL.MISSION_MISSION_MAX_ALLOWED, max); fPlayer.msg(TL.MISSION_MISSION_MAX_ALLOWED, max);
return; return;
} }
if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Disallowed.Name")))) { if (missionName.equals(plugin.color(FactionsPlugin.getInstance().getConfig().getString("Randomization.Start-Item.Disallowed.Name")))) return;
return;
}
if (fPlayer.getFaction().getMissions().containsKey(missionName)) { if (fPlayer.getFaction().getMissions().containsKey(missionName)) {
fPlayer.msg(TL.MISSION_MISSION_ACTIVE); fPlayer.msg(TL.MISSION_MISSION_ACTIVE);
return; return;
} }
ConfigurationSection section = configurationSection.getConfigurationSection(missionName); ConfigurationSection section = configurationSection.getConfigurationSection(missionName);
if (section == null) { if (section == null) return;
return;
}
if(FactionsPlugin.getInstance().getConfig().getBoolean("DenyMissionsMoreThenOnce")) { if(FactionsPlugin.getInstance().getConfig().getBoolean("DenyMissionsMoreThenOnce")) {
if (fPlayer.getFaction().getCompletedMissions().contains(missionName)) { if (fPlayer.getFaction().getCompletedMissions().contains(missionName)) {
fPlayer.msg(TL.MISSION_ALREAD_COMPLETED); fPlayer.msg(TL.MISSION_ALREAD_COMPLETED);
@@ -81,9 +76,7 @@ public class MissionGUI implements FactionGUI {
} }
ConfigurationSection missionSection = section.getConfigurationSection("Mission"); ConfigurationSection missionSection = section.getConfigurationSection("Mission");
if (missionSection == null) { if (missionSection == null) return;
return;
}
Mission mission = new Mission(missionName, missionSection.getString("Type")); Mission mission = new Mission(missionName, missionSection.getString("Type"));
fPlayer.getFaction().getMissions().put(missionName, mission); fPlayer.getFaction().getMissions().put(missionName, mission);

View File

@@ -35,8 +35,7 @@ public class Updater {
conf.set("Randomization.Start-Item.Disallowed.Lore", lore); conf.set("Randomization.Start-Item.Disallowed.Lore", lore);
conf.set("Randomization.Start-Item.Slot", 28); conf.set("Randomization.Start-Item.Slot", 28);
conf.set("Config-Version", 1.1); conf.set("Config-Version", 1.1);
version = 1.1; currentVersion = 1.1;
} }
//End with save + reload //End with save + reload
try { try {

View File

@@ -989,7 +989,7 @@ public abstract class MemoryFPlayer implements FPlayer {
} }
if (faction.isSystemFaction()) { if (faction.isSystemFaction()) {
return CmdFly.checkBypassPerms(this, this.getPlayer(), faction); return CmdFly.checkBypassPerms(this, getPlayer(), faction);
} }
Access access = faction.getAccess(this, PermissableAction.FLY); Access access = faction.getAccess(this, PermissableAction.FLY);

View File

@@ -160,7 +160,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
this.checks = new ConcurrentHashMap<>(); this.checks = new ConcurrentHashMap<>();
this.playerWallCheckCount = new ConcurrentHashMap<>(); this.playerWallCheckCount = new ConcurrentHashMap<>();
this.playerBufferCheckCount = new ConcurrentHashMap<>(); this.playerBufferCheckCount = new ConcurrentHashMap<>();
resetPerms(); // Reset on new Faction so it has default values. resetPerms(); // Reset on new Faction so it has default values.
} }
@@ -866,16 +865,13 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
* @return * @return
*/ */
public Access getAccess(FPlayer player, PermissableAction permissableAction) { public Access getAccess(FPlayer player, PermissableAction permissableAction) {
if (player == null || permissableAction == null) { if (player == null || permissableAction == null) return Access.UNDEFINED;
return Access.UNDEFINED;
}
Permissable perm = player.getFaction() == null ? player.getRole() : player.getFaction().getRelationTo(this);
Permissable perm = player.getFaction() == this ? player.getRole() : player.getFaction().getRelationTo(this);
Map<PermissableAction, Access> accessMap = permissions.get(perm); Map<PermissableAction, Access> accessMap = permissions.get(perm);
if (accessMap != null && accessMap.containsKey(permissableAction)) { if (accessMap != null && accessMap.containsKey(permissableAction)) return accessMap.get(permissableAction);
return accessMap.get(permissableAction);
}
return Access.UNDEFINED; return Access.UNDEFINED;
} }
@@ -890,7 +886,6 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
public void resetPerms() { public void resetPerms() {
FactionsPlugin.getInstance().log(Level.WARNING, "Resetting permissions for Faction: " + tag); FactionsPlugin.getInstance().log(Level.WARNING, "Resetting permissions for Faction: " + tag);
permissions.clear(); permissions.clear();
// First populate a map with undefined as the permission for each action. // First populate a map with undefined as the permission for each action.

View File

@@ -888,7 +888,7 @@ public enum TL {
COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."), COMMAND_TNT_WIDTHDRAW_SUCCESS("&cSuccessfully withdrew tnt."),
COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in bank."), COMMAND_TNT_WIDTHDRAW_NOTENOUGH("&cNot enough tnt in bank."),
COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt inventory."), COMMAND_TNT_DEPOSIT_NOTENOUGH("&cNot enough tnt in tnt inventory."),
COMMAND_TNT_AMOUNT("&cYour faction has %1$s tnt in the tnt bank."), COMMAND_TNT_AMOUNT("&cYour faction has {amount}/{maxAmount} tnt in the tnt bank."),
COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"), COMMAND_TNT_POSITIVE("&cPlease use positive numbers!"),
COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"), COMMAND_TNT_DESCRIPTION("add/widthraw from faction's tnt bank"),
COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE("&cNot enough space in your inventory."), COMMAND_TNT_WIDTHDRAW_NOTENOUGH_SPACE("&cNot enough space in your inventory."),
@@ -1004,6 +1004,7 @@ public enum TL {
GENERIC_YOU("you"), GENERIC_YOU("you"),
GENERIC_YOURFACTION("your faction"), GENERIC_YOURFACTION("your faction"),
GENERIC_NOPERMISSION("You don't have permission to %1$s."), GENERIC_NOPERMISSION("You don't have permission to %1$s."),
GENERIC_ACTION_NOPERMISSION("You don't have permission to use %1$s"),
GENERIC_FPERM_NOPERMISSION("&7The faction leader does not allow you to &c%1$s."), GENERIC_FPERM_NOPERMISSION("&7The faction leader does not allow you to &c%1$s."),
GENERIC_DOTHAT("do that"), //Ugh nuke this from high orbit GENERIC_DOTHAT("do that"), //Ugh nuke this from high orbit
GENERIC_NOPLAYERMATCH("No player match found for \"<plugin>%1$s\"."), GENERIC_NOPLAYERMATCH("No player match found for \"<plugin>%1$s\"."),
@@ -1038,7 +1039,7 @@ public enum TL {
GENERIC_YOUMUSTBE("&cYour must be atleast %1$s to do this!"), GENERIC_YOUMUSTBE("&cYour must be atleast %1$s to do this!"),
GENERIC_MEMBERONLY("&cYou must be in a faction to do this!"), GENERIC_MEMBERONLY("&cYou must be in a faction to do this!"),
// MISSION_CREATED_COOLDOWN("&c&l[!] &7Due to your immediate faction creation, you may not start missions for &b%1$s minutes&7!"),
MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"), MISSION_MISSION_STARTED("&f%1$s &dstarted the %2$s &fmission"),
MISSION_ALREAD_COMPLETED("&c&l[!] &7You may not restart a mission you have already completed"), MISSION_ALREAD_COMPLETED("&c&l[!] &7You may not restart a mission you have already completed"),
MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"), MISSION_MISSION_ACTIVE("&c&l[!] &7This mission is currently active!"),

View File

@@ -535,7 +535,7 @@ fperm-gui:
- '' - ''
- '&4&l* &cStatus: &f{action-access-color}{action-access}' - '&4&l* &cStatus: &f{action-access-color}{action-access}'
- '' - ''
- '&2&l* &aLeft click to &alAllow&a.' - '&2&l* &aLeft click to &a&lAllow&a.'
- '&4&l* &cRight click to &c&lDeny&c.' - '&4&l* &cRight click to &c&lDeny&c.'
- '&8&l* &7Middle click to &7&lUndefine&7.' - '&8&l* &7Middle click to &7&lUndefine&7.'
# Back item will be take you to the previous GUI # Back item will be take you to the previous GUI
@@ -1331,7 +1331,6 @@ Tntfill:
max-radius: 32 max-radius: 32
max-amount: 64 max-amount: 64
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
# | Big List of variables | # # | Big List of variables | #