Merge branch '1.6.x' of https://github.com/ProSavage/SavageFactions into 1.6.x
# Conflicts: # src/main/java/com/massivecraft/factions/SavageFactions.java
This commit is contained in:
commit
5a63e71054
@ -12,6 +12,8 @@
|
|||||||
|
|
||||||
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
|
* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.
|
||||||
|
|
||||||
|
* Please use tabs as ident with a size of 3 spaces.
|
||||||
|
|
||||||
#### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
|
#### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
|
||||||
|
|
||||||
Please specify what changes you made to the formatting etc., as it allows us to get an idea of how this will change our files overall.
|
Please specify what changes you made to the formatting etc., as it allows us to get an idea of how this will change our files overall.
|
||||||
|
BIN
classes/artifacts/Factions_jar/Factions.jar
Normal file
BIN
classes/artifacts/Factions_jar/Factions.jar
Normal file
Binary file not shown.
@ -3,6 +3,7 @@ package com.massivecraft.factions;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.massivecraft.factions.integration.dynmap.DynmapStyle;
|
import com.massivecraft.factions.integration.dynmap.DynmapStyle;
|
||||||
import com.massivecraft.factions.util.MultiversionMaterials;
|
import com.massivecraft.factions.util.MultiversionMaterials;
|
||||||
|
import com.massivecraft.factions.zcore.fperms.DefaultPermissions;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
@ -330,6 +331,15 @@ public class Conf {
|
|||||||
public static int mapHeight = 17;
|
public static int mapHeight = 17;
|
||||||
public static int mapWidth = 49;
|
public static int mapWidth = 49;
|
||||||
public static transient char[] mapKeyChrs = "\\/#$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz?".toCharArray();
|
public static transient char[] mapKeyChrs = "\\/#$%=&^ABCDEFGHJKLMNOPQRSTUVWXYZ1234567890abcdeghjmnopqrsuvwxyz?".toCharArray();
|
||||||
|
|
||||||
|
|
||||||
|
// Default Options
|
||||||
|
public static boolean useCustomDefaultPermissions = false;
|
||||||
|
public static boolean usePermissionHints = false;
|
||||||
|
public static HashMap<String, DefaultPermissions> defaultFactionPermissions;
|
||||||
|
// Custom Ranks
|
||||||
|
//public static boolean enableCustomRanks = false; // We will disable it by default to avoid any migration error
|
||||||
|
//public static int maxCustomRanks = 2; // Setting this to -1 will allow unlimited custom ranks
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Persistance
|
// Persistance
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
@ -430,6 +440,12 @@ public class Conf {
|
|||||||
safeZoneNerfedCreatureTypes.add(EntityType.WITCH);
|
safeZoneNerfedCreatureTypes.add(EntityType.WITCH);
|
||||||
safeZoneNerfedCreatureTypes.add(EntityType.WITHER);
|
safeZoneNerfedCreatureTypes.add(EntityType.WITHER);
|
||||||
safeZoneNerfedCreatureTypes.add(EntityType.ZOMBIE);
|
safeZoneNerfedCreatureTypes.add(EntityType.ZOMBIE);
|
||||||
|
// Is this called lazy load?
|
||||||
|
defaultFactionPermissions.put("LEADER", new DefaultPermissions(true));
|
||||||
|
defaultFactionPermissions.put("COLEADER", new DefaultPermissions(true));
|
||||||
|
defaultFactionPermissions.put("MODERATOR", new DefaultPermissions(true));
|
||||||
|
defaultFactionPermissions.put("MEMBER", new DefaultPermissions(false));
|
||||||
|
defaultFactionPermissions.put("RECRUIT", new DefaultPermissions(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void load() {
|
public static void load() {
|
||||||
|
@ -204,6 +204,8 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
void resetPerms();
|
void resetPerms();
|
||||||
|
|
||||||
|
void setDefaultPerms();
|
||||||
|
|
||||||
void disband(Player disbander);
|
void disband(Player disbander);
|
||||||
|
|
||||||
void disband(Player disbander, PlayerDisbandReason reason);
|
void disband(Player disbander, PlayerDisbandReason reason);
|
||||||
|
@ -55,11 +55,13 @@ public class SavageFactions extends MPlugin {
|
|||||||
// Our single plugin instance.
|
// Our single plugin instance.
|
||||||
// Single 4 life.
|
// Single 4 life.
|
||||||
public static SavageFactions plugin;
|
public static SavageFactions plugin;
|
||||||
// Made for other plugins to hook into so
|
public static Permission perms = null;
|
||||||
// they know the plugin has finished enabling...
|
// This plugin sets the boolean true when fully enabled.
|
||||||
|
// Plugins can check this boolean while hooking in have
|
||||||
|
// a green light to use the api.
|
||||||
public static boolean startupFinished = false;
|
public static boolean startupFinished = false;
|
||||||
|
|
||||||
public static Permission perms = null;
|
|
||||||
// Persistence related
|
// Persistence related
|
||||||
public static ArrayList<FPlayer> playersFlying = new ArrayList();
|
public static ArrayList<FPlayer> playersFlying = new ArrayList();
|
||||||
public Essentials ess;
|
public Essentials ess;
|
||||||
@ -259,6 +261,7 @@ public class SavageFactions extends MPlugin {
|
|||||||
this.setupPlaceholderAPI();
|
this.setupPlaceholderAPI();
|
||||||
this.postEnable();
|
this.postEnable();
|
||||||
this.loadSuccessful = true;
|
this.loadSuccessful = true;
|
||||||
|
// Set startup finished to true. to give plugins hooking in a greenlight
|
||||||
SavageFactions.startupFinished = true;
|
SavageFactions.startupFinished = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +103,11 @@ public class CmdCreate extends FCommand {
|
|||||||
if (SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
|
if (SavageFactions.plugin.getConfig().getBoolean("fpaypal.Enabled")) {
|
||||||
this.fme.msg(TL.COMMAND_PAYPALSET_CREATED);
|
this.fme.msg(TL.COMMAND_PAYPALSET_CREATED);
|
||||||
}
|
}
|
||||||
|
if (Conf.useCustomDefaultPermissions) {
|
||||||
|
faction.setDefaultPerms();
|
||||||
|
if (Conf.usePermissionHints)
|
||||||
|
this.fme.msg(TL.COMMAND_HINT_PERMISSION);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -35,6 +35,10 @@ public class CmdTntFill extends FCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void perform() {
|
public void perform() {
|
||||||
|
if (!SavageFactions.plugin.getConfig().getBoolean("Tntfill.enabled")) {
|
||||||
|
this.fme.msg(TL.GENERIC_DISABLED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!fme.isAdminBypassing()) {
|
if (!fme.isAdminBypassing()) {
|
||||||
Access access = myFaction.getAccess(fme, PermissableAction.TNTFILL);
|
Access access = myFaction.getAccess(fme, PermissableAction.TNTFILL);
|
||||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||||
|
@ -0,0 +1,152 @@
|
|||||||
|
package com.massivecraft.factions.zcore.fperms;
|
||||||
|
|
||||||
|
public class DefaultPermissions {
|
||||||
|
public boolean ban;
|
||||||
|
public boolean build;
|
||||||
|
public boolean destroy;
|
||||||
|
public boolean frostwalk;
|
||||||
|
public boolean painbuild;
|
||||||
|
public boolean door;
|
||||||
|
public boolean button;
|
||||||
|
public boolean lever;
|
||||||
|
public boolean container;
|
||||||
|
public boolean invite;
|
||||||
|
public boolean kick;
|
||||||
|
public boolean items;
|
||||||
|
public boolean sethome;
|
||||||
|
public boolean territory;
|
||||||
|
public boolean access;
|
||||||
|
public boolean home;
|
||||||
|
public boolean disband;
|
||||||
|
public boolean promote;
|
||||||
|
public boolean setwarp;
|
||||||
|
public boolean warp;
|
||||||
|
public boolean fly;
|
||||||
|
public boolean vault;
|
||||||
|
public boolean tntbank;
|
||||||
|
public boolean tntfill;
|
||||||
|
public boolean withdraw;
|
||||||
|
public boolean chest;
|
||||||
|
public boolean spawner;
|
||||||
|
|
||||||
|
public DefaultPermissions() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultPermissions(boolean def) {
|
||||||
|
this.ban = def;
|
||||||
|
this.build = def;
|
||||||
|
this.destroy = def;
|
||||||
|
this.frostwalk = def;
|
||||||
|
this.painbuild = def;
|
||||||
|
this.door = def;
|
||||||
|
this.button = def;
|
||||||
|
this.lever = def;
|
||||||
|
this.container = def;
|
||||||
|
this.invite = def;
|
||||||
|
this.kick = def;
|
||||||
|
this.items = def;
|
||||||
|
this.sethome = def;
|
||||||
|
this.territory = def;
|
||||||
|
this.access = def;
|
||||||
|
this.home = def;
|
||||||
|
this.disband = def;
|
||||||
|
this.promote = def;
|
||||||
|
this.setwarp = def;
|
||||||
|
this.warp = def;
|
||||||
|
this.fly = def;
|
||||||
|
this.vault = def;
|
||||||
|
this.tntbank = def;
|
||||||
|
this.tntfill = def;
|
||||||
|
this.withdraw = def;
|
||||||
|
this.chest = def;
|
||||||
|
this.spawner = def;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultPermissions(boolean canBan,
|
||||||
|
boolean canBuild,
|
||||||
|
boolean canDestory,
|
||||||
|
boolean canFrostwalk,
|
||||||
|
boolean canPainbuild,
|
||||||
|
boolean canDoor,
|
||||||
|
boolean canButton,
|
||||||
|
boolean canLever,
|
||||||
|
boolean canContainer,
|
||||||
|
boolean canInvite,
|
||||||
|
boolean canKick,
|
||||||
|
boolean canItems,
|
||||||
|
boolean canSethome,
|
||||||
|
boolean canTerritory,
|
||||||
|
boolean canAccess,
|
||||||
|
boolean canHome,
|
||||||
|
boolean canDisband,
|
||||||
|
boolean canPromote,
|
||||||
|
boolean canSetwarp,
|
||||||
|
boolean canWarp,
|
||||||
|
boolean canFly,
|
||||||
|
boolean canVault,
|
||||||
|
boolean canTntbank,
|
||||||
|
boolean canTntfill,
|
||||||
|
boolean canWithdraw,
|
||||||
|
boolean canChest,
|
||||||
|
boolean canSpawners) {
|
||||||
|
this.ban = canBan;
|
||||||
|
this.build = canBuild;
|
||||||
|
this.destroy = canDestory;
|
||||||
|
this.frostwalk = canFrostwalk;
|
||||||
|
this.painbuild = canPainbuild;
|
||||||
|
this.door = canDoor;
|
||||||
|
this.button = canButton;
|
||||||
|
this.lever = canLever;
|
||||||
|
this.container = canContainer;
|
||||||
|
this.invite = canInvite;
|
||||||
|
this.kick = canKick;
|
||||||
|
this.items = canItems;
|
||||||
|
this.sethome = canSethome;
|
||||||
|
this.territory = canTerritory;
|
||||||
|
this.access = canAccess;
|
||||||
|
this.home = canHome;
|
||||||
|
this.disband = canDisband;
|
||||||
|
this.promote = canPromote;
|
||||||
|
this.setwarp = canSetwarp;
|
||||||
|
this.warp = canWarp;
|
||||||
|
this.fly = canFly;
|
||||||
|
this.vault = canVault;
|
||||||
|
this.tntbank = canTntbank;
|
||||||
|
this.tntfill = canTntfill;
|
||||||
|
this.withdraw = canWithdraw;
|
||||||
|
this.chest = canChest;
|
||||||
|
this.spawner = canSpawners;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public boolean getbyName(String name) {
|
||||||
|
if (name == "ban") return this.ban;
|
||||||
|
else if (name == "build") return this.build;
|
||||||
|
else if (name == "destroy") return this.destroy;
|
||||||
|
else if (name == "frostwalk") return this.frostwalk;
|
||||||
|
else if (name == "painbuild") return this.painbuild;
|
||||||
|
else if (name == "door") return this.door;
|
||||||
|
else if (name == "button") return this.button;
|
||||||
|
else if (name == "lever") return this.lever;
|
||||||
|
else if (name == "container") return this.container;
|
||||||
|
else if (name == "invite") return this.invite;
|
||||||
|
else if (name == "kick") return this.kick;
|
||||||
|
else if (name == "items") return this.items;
|
||||||
|
else if (name == "sethome") return this.sethome;
|
||||||
|
else if (name == "territory") return this.territory;
|
||||||
|
else if (name == "access") return this.access;
|
||||||
|
else if (name == "home") return this.disband;
|
||||||
|
else if (name == "disband") return this.disband;
|
||||||
|
else if (name == "promote") return this.promote;
|
||||||
|
else if (name == "setwarp") return this.setwarp;
|
||||||
|
else if (name == "warp") return this.warp;
|
||||||
|
else if (name == "fly") return this.fly;
|
||||||
|
else if (name == "vault") return this.vault;
|
||||||
|
else if (name == "tntbank") return this.tntbank;
|
||||||
|
else if (name == "tntfill") return this.tntfill;
|
||||||
|
else if (name == "withdraw") return this.withdraw;
|
||||||
|
else if (name == "chest") return this.chest;
|
||||||
|
else if (name == "spawner") return this.spawner;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,9 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public enum PermissableAction {
|
public enum PermissableAction {
|
||||||
@ -64,6 +66,14 @@ public enum PermissableAction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<PermissableAction, Access> fromDefaults(DefaultPermissions defaultPermissions) {
|
||||||
|
Map<PermissableAction, Access> defaultMap = new HashMap<>();
|
||||||
|
for (PermissableAction permissableAction : PermissableAction.values()) {
|
||||||
|
defaultMap.put(permissableAction, defaultPermissions.getbyName(permissableAction.name) ? Access.ALLOW : Access.DENY);
|
||||||
|
}
|
||||||
|
return defaultMap;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the friendly name of this action. Used for editing in commands.
|
* Get the friendly name of this action. Used for editing in commands.
|
||||||
*
|
*
|
||||||
|
@ -671,6 +671,33 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDefaultPerms() {
|
||||||
|
if (!Conf.useCustomDefaultPermissions) return;
|
||||||
|
Map<PermissableAction, Access> defaultMap = new HashMap<>();
|
||||||
|
for (PermissableAction permissableAction : PermissableAction.values()) {
|
||||||
|
defaultMap.put(permissableAction, Access.UNDEFINED);
|
||||||
|
}
|
||||||
|
// Put the map in there for each relation.
|
||||||
|
for (Relation relation : Relation.values()) {
|
||||||
|
if (relation != Relation.MEMBER) {
|
||||||
|
if (!Conf.defaultFactionPermissions.containsKey(relation.nicename))
|
||||||
|
permissions.put(relation, new HashMap<>(defaultMap));
|
||||||
|
else
|
||||||
|
permissions.put(relation, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(relation.nicename)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// And each role.
|
||||||
|
for (Role role : Role.values()) {
|
||||||
|
if (role != Role.LEADER) {
|
||||||
|
if (!Conf.defaultFactionPermissions.containsKey(role.nicename))
|
||||||
|
permissions.put(role, new HashMap<>(defaultMap));
|
||||||
|
else
|
||||||
|
permissions.put(role, PermissableAction.fromDefaults(Conf.defaultFactionPermissions.get(role.nicename)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read only map of Permissions.
|
* Read only map of Permissions.
|
||||||
*
|
*
|
||||||
|
@ -308,6 +308,8 @@ public enum TL {
|
|||||||
COMMAND_FWARP_PASSWORD_REQUIRED("&c&l[!]&c Warp Password:"),
|
COMMAND_FWARP_PASSWORD_REQUIRED("&c&l[!]&c Warp Password:"),
|
||||||
COMMAND_FWARP_PASSWORD_TIMEOUT("&c&l[!]&7 Warp password &ccanceled"),
|
COMMAND_FWARP_PASSWORD_TIMEOUT("&c&l[!]&7 Warp password &ccanceled"),
|
||||||
|
|
||||||
|
COMMAND_HINT_PERMISSION("&aYou can manage your factions permissions using &7/f perms"),
|
||||||
|
|
||||||
COMMAND_HOME_DISABLED("&c&l[!]&7 Sorry, Faction homes are &cdisabled on this server."),
|
COMMAND_HOME_DISABLED("&c&l[!]&7 Sorry, Faction homes are &cdisabled on this server."),
|
||||||
COMMAND_HOME_TELEPORTDISABLED("&c&l[!]&7 Sorry, the ability to &cteleport &7to Faction homes is &cdisabled &7on this server."),
|
COMMAND_HOME_TELEPORTDISABLED("&c&l[!]&7 Sorry, the ability to &cteleport &7to Faction homes is &cdisabled &7on this server."),
|
||||||
COMMAND_HOME_NOHOME("&c&l[!]&7 Your faction does &cnot &7have a home. "),
|
COMMAND_HOME_NOHOME("&c&l[!]&7 Your faction does &cnot &7have a home. "),
|
||||||
|
@ -1035,6 +1035,7 @@ see-chunk:
|
|||||||
|
|
||||||
|
|
||||||
Tntfill:
|
Tntfill:
|
||||||
|
enabled: true
|
||||||
max-radius: 32
|
max-radius: 32
|
||||||
max-amount: 64
|
max-amount: 64
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user