mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Removal of legacy permission system support. SuperPerms only now.
This commit is contained in:
parent
44e954efeb
commit
5645c29dd8
@ -2,6 +2,7 @@ Changelog:
|
||||
#Versions without changelogs probably had very small misc fixes, like tweaks to the source code
|
||||
|
||||
Version 2.0-dev
|
||||
- Removed legacy Permission & PEX support. SuperPerms support only now.
|
||||
|
||||
Version 1.2.10
|
||||
- Fixed issue with receiving Woodcutting XP for all blocks broken (Issue #103)
|
||||
|
14
pom.xml
14
pom.xml
@ -118,20 +118,6 @@
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nijikokun.bukkit</groupId>
|
||||
<artifactId>Permissions</artifactId>
|
||||
<version>3.1.6</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.tehkode.permissions</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.18</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.getspout</groupId>
|
||||
<artifactId>spoutpluginapi</artifactId>
|
||||
|
@ -32,7 +32,6 @@ import com.gmail.nossr50.listeners.mcPlayerListener;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.skills.*;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
@ -83,9 +82,6 @@ public class mcMMO extends JavaPlugin
|
||||
private final mcBlockListener blockListener = new mcBlockListener(this);
|
||||
private final mcEntityListener entityListener = new mcEntityListener(this);
|
||||
|
||||
public static mcPermissions permissionHandler = new mcPermissions();
|
||||
private Permissions permissions;
|
||||
|
||||
private Runnable mcMMO_Timer = new mcTimer(this); //BLEED AND REGENERATION
|
||||
private Runnable ChangeDataValueTimer = new ChangeDataValueTimer(this); //R2 block place workaround
|
||||
//private Timer mcMMO_SpellTimer = new Timer(true);
|
||||
@ -249,9 +245,7 @@ public class mcMMO extends JavaPlugin
|
||||
PlayerProfile PP = Users.getProfile(player);
|
||||
return PP.inParty();
|
||||
}
|
||||
public Permissions getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
Bukkit.getServer().getScheduler().cancelTasks(this);
|
||||
System.out.println("mcMMO was disabled.");
|
||||
|
@ -20,230 +20,86 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
import ru.tehkode.permissions.PermissionManager;
|
||||
import ru.tehkode.permissions.bukkit.PermissionsEx;
|
||||
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
|
||||
public class mcPermissions
|
||||
{
|
||||
private static volatile mcPermissions instance;
|
||||
|
||||
private enum PermissionType {
|
||||
PEX, PERMISSIONS, BUKKIT
|
||||
}
|
||||
|
||||
private static PermissionType permissionType;
|
||||
private static Object PHandle;
|
||||
public static boolean permissionsEnabled = false;
|
||||
|
||||
public static void initialize(Server server)
|
||||
{
|
||||
Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
if(permissionsEnabled && permissionType != PermissionType.PERMISSIONS) return;
|
||||
|
||||
Plugin PEXtest = server.getPluginManager().getPlugin("PermissionsEx");
|
||||
Plugin test = server.getPluginManager().getPlugin("Permissions");
|
||||
if(PEXtest != null) {
|
||||
PHandle = (PermissionManager) PermissionsEx.getPermissionManager();
|
||||
permissionType = PermissionType.PEX;
|
||||
permissionsEnabled = true;
|
||||
log.info("[mcMMO] PermissionsEx found, using PermissionsEx.");
|
||||
} else if(test != null) {
|
||||
PHandle = (PermissionHandler) ((Permissions) test).getHandler();
|
||||
permissionType = PermissionType.PERMISSIONS;
|
||||
permissionsEnabled = true;
|
||||
log.info("[mcMMO] Permissions version "+test.getDescription().getVersion()+" found, using Permissions.");
|
||||
} else {
|
||||
permissionType = PermissionType.BUKKIT;
|
||||
permissionsEnabled = true;
|
||||
log.info("[mcMMO] Using Bukkit Permissions.");
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean getEnabled()
|
||||
{
|
||||
return permissionsEnabled;
|
||||
}
|
||||
|
||||
public static boolean permission(Player player, String permission)
|
||||
{
|
||||
if(!permissionsEnabled) return player.isOp();
|
||||
switch(permissionType) {
|
||||
case PEX:
|
||||
return ((PermissionManager) PHandle).has(player, permission);
|
||||
case PERMISSIONS:
|
||||
return ((PermissionHandler) PHandle).has(player, permission);
|
||||
case BUKKIT:
|
||||
return player.hasPermission(permission);
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean admin(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.admin");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.admin");
|
||||
}
|
||||
public boolean mcrefresh(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.tools.mcrefresh");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.tools.mcrefresh");
|
||||
}
|
||||
public boolean mmoedit(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.tools.mmoedit");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.tools.mmoedit");
|
||||
}
|
||||
public boolean herbalismAbility(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.ability.herbalism");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.ability.herbalism");
|
||||
}
|
||||
public boolean excavationAbility(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.ability.excavation");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.ability.excavation");
|
||||
}
|
||||
public boolean unarmedAbility(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.ability.unarmed");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.ability.unarmed");
|
||||
}
|
||||
public boolean chimaeraWing(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.item.chimaerawing");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.item.chimaerawing");
|
||||
}
|
||||
public boolean miningAbility(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.ability.mining");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.ability.mining");
|
||||
}
|
||||
public boolean axesAbility(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.ability.axes");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.ability.axes");
|
||||
}
|
||||
|
||||
public boolean swordsAbility(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.ability.swords");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.ability.swords");
|
||||
}
|
||||
public boolean woodCuttingAbility(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.ability.woodcutting");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.ability.woodcutting");
|
||||
}
|
||||
public boolean mcgod(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.tools.mcgod");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.tools.mcgod");
|
||||
}
|
||||
public boolean regeneration(Player player){
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.regeneration");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.regeneration");
|
||||
}
|
||||
public boolean motd(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.motd");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.motd");
|
||||
}
|
||||
public boolean mcAbility(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.ability");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.commands.ability");
|
||||
}
|
||||
public boolean mySpawn(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.myspawn");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.commands.myspawn");
|
||||
}
|
||||
public boolean setMySpawn(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.setmyspawn");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.commands.setmyspawn");
|
||||
}
|
||||
public boolean partyChat(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.chat.partychat");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.chat.partychat");
|
||||
}
|
||||
public boolean partyLock(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.chat.partylock");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.chat.partylock");
|
||||
}
|
||||
public boolean partyTeleport(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.ptp");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.commands.ptp");
|
||||
}
|
||||
public boolean whois(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.whois");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.commands.whois");
|
||||
}
|
||||
public boolean party(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.commands.party");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.commands.party");
|
||||
}
|
||||
public boolean adminChat(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.chat.adminchat");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.chat.adminchat");
|
||||
}
|
||||
public static mcPermissions getInstance() {
|
||||
if (instance == null) {
|
||||
@ -251,102 +107,47 @@ public class mcPermissions
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public boolean taming(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.taming");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.taming");
|
||||
}
|
||||
public boolean mining(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.mining");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.mining");
|
||||
}
|
||||
public boolean fishing(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.fishing");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.fishing");
|
||||
}
|
||||
public boolean alchemy(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.alchemy");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.alchemy");
|
||||
}
|
||||
public boolean enchanting(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.enchanting");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.enchanting");
|
||||
}
|
||||
public boolean woodcutting(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.woodcutting");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.woodcutting");
|
||||
}
|
||||
public boolean repair(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.repair");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.repair");
|
||||
}
|
||||
public boolean unarmed(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.unarmed");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.unarmed");
|
||||
}
|
||||
public boolean archery(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.archery");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.archery");
|
||||
}
|
||||
public boolean herbalism(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.herbalism");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.herbalism");
|
||||
}
|
||||
public boolean excavation(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.excavation");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.excavation");
|
||||
}
|
||||
public boolean swords(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.swords");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.swords");
|
||||
}
|
||||
public boolean axes(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.axes");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.axes");
|
||||
}
|
||||
public boolean acrobatics(Player player) {
|
||||
if (permissionsEnabled) {
|
||||
return permission(player, "mcmmo.skills.acrobatics");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return player.hasPermission("mcmmo.skills.acrobatics");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user