-
-
Notifications
You must be signed in to change notification settings - Fork 355
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Articdive/development
Pull Development Stuffs
- Loading branch information
Showing
23 changed files
with
3,042 additions
and
2,873 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
/bin/ | ||
|
||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
284 changes: 142 additions & 142 deletions
284
...ukkit/towny/permissions/Perms3Source.java → legacy/Perms3Source.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,143 +1,143 @@ | ||
package com.palmergames.bukkit.towny.permissions; | ||
|
||
import org.bukkit.entity.Player; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
import com.nijiko.permissions.PermissionHandler; | ||
import com.nijikokun.bukkit.Permissions.Permissions; | ||
import com.palmergames.bukkit.towny.Towny; | ||
import com.palmergames.bukkit.towny.TownySettings; | ||
import com.palmergames.bukkit.towny.object.Resident; | ||
|
||
public class Perms3Source extends TownyPermissionSource { | ||
|
||
public Perms3Source(Towny towny, Plugin test) { | ||
|
||
this.permissions = (Permissions) test; | ||
this.plugin = towny; | ||
} | ||
|
||
/** | ||
* getPermissionNode | ||
* | ||
* returns the specified prefix/suffix nodes from permissions | ||
* | ||
* @param resident | ||
* @param node | ||
* @return String of the prefix/Suffix for this player. | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
// Suppression is to clear warnings while retaining permissions 2.7 compatibility | ||
public String getPrefixSuffix(Resident resident, String node) { | ||
|
||
String group = "", user = ""; | ||
Player player = plugin.getServer().getPlayer(resident.getName()); | ||
|
||
//sendDebugMsg(" Permissions installed."); | ||
PermissionHandler handler = permissions.getHandler(); | ||
|
||
if (node == "prefix") { | ||
group = handler.getGroupPrefix(player.getWorld().getName(), handler.getGroup(player.getWorld().getName(), player.getName())); | ||
//user = handler.getUserPrefix(player.getWorld().getName(), player.getName()); | ||
} else if (node == "suffix") { | ||
group = handler.getGroupSuffix(player.getWorld().getName(), handler.getGroup(player.getWorld().getName(), player.getName())); | ||
//user = handler.getUserSuffix(player.getWorld().getName(), player.getName()); | ||
} | ||
|
||
if (!group.equals(user)) | ||
user = group + user; | ||
user = TownySettings.parseSingleLineString(user); | ||
|
||
return user; | ||
|
||
} | ||
|
||
/** | ||
* | ||
* @param playerName | ||
* @param node | ||
* @return -1 = can't find | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
// Suppression is to clear warnings while retaining permissions 2.7 compatibility | ||
public int getGroupPermissionIntNode(String playerName, String node) { | ||
|
||
Player player = plugin.getServer().getPlayer(playerName); | ||
String worldName = player.getWorld().getName(); | ||
String groupName; | ||
|
||
try { | ||
PermissionHandler handler = permissions.getHandler(); | ||
groupName = handler.getGroup(worldName, playerName); | ||
|
||
return handler.getGroupPermissionInteger(worldName, groupName, node); | ||
} catch (Exception e) { | ||
// Ignore UnsupportedOperationException on certain Permission APIs | ||
} | ||
|
||
return -1; | ||
} | ||
|
||
/** | ||
* | ||
* @param playerName | ||
* @param node | ||
* @return empty = can't find | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
// Suppression is to clear warnings while retaining permissions 2.7 compatibility | ||
public String getPlayerPermissionStringNode(String playerName, String node) { | ||
|
||
Player player = plugin.getServer().getPlayer(playerName); | ||
String worldName = player.getWorld().getName(); | ||
String groupName; | ||
|
||
try { | ||
PermissionHandler handler = permissions.getHandler(); | ||
groupName = handler.getGroup(worldName, playerName); | ||
String perm = handler.getGroupPermissionString(worldName, groupName, node); | ||
|
||
if (perm != null) | ||
return perm; | ||
} catch (Exception e) { | ||
// Ignore UnsupportedOperationException on certain Permission APIs | ||
} | ||
|
||
return ""; | ||
} | ||
|
||
/** | ||
* hasPermission | ||
* | ||
* returns if a player has a certain permission node. | ||
* | ||
* @param player | ||
* @param node | ||
* @return true is Op or has the permission node | ||
*/ | ||
@Override | ||
public boolean has(Player player, String node) { | ||
|
||
PermissionHandler handler = permissions.getHandler(); | ||
return handler.permission(player, node); | ||
} | ||
|
||
/** | ||
* Returns the players Group name. | ||
* | ||
* @param player | ||
* @return Name of this players group. | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
public String getPlayerGroup(Player player) { | ||
|
||
PermissionHandler handler = permissions.getHandler(); | ||
return handler.getGroup(player.getWorld().getName(), player.getName()); | ||
|
||
} | ||
|
||
package com.palmergames.bukkit.towny.permissions; | ||
|
||
import org.bukkit.entity.Player; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
import com.nijiko.permissions.PermissionHandler; | ||
import com.nijikokun.bukkit.Permissions.Permissions; | ||
import com.palmergames.bukkit.towny.Towny; | ||
import com.palmergames.bukkit.towny.TownySettings; | ||
import com.palmergames.bukkit.towny.object.Resident; | ||
|
||
public class Perms3Source extends TownyPermissionSource { | ||
|
||
public Perms3Source(Towny towny, Plugin test) { | ||
|
||
this.permissions = (Permissions) test; | ||
this.plugin = towny; | ||
} | ||
|
||
/** | ||
* getPermissionNode | ||
* | ||
* returns the specified prefix/suffix nodes from permissions | ||
* | ||
* @param resident | ||
* @param node | ||
* @return String of the prefix/Suffix for this player. | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
// Suppression is to clear warnings while retaining permissions 2.7 compatibility | ||
public String getPrefixSuffix(Resident resident, String node) { | ||
|
||
String group = "", user = ""; | ||
Player player = plugin.getServer().getPlayer(resident.getName()); | ||
|
||
//sendDebugMsg(" Permissions installed."); | ||
PermissionHandler handler = permissions.getHandler(); | ||
|
||
if (node == "prefix") { | ||
group = handler.getGroupPrefix(player.getWorld().getName(), handler.getGroup(player.getWorld().getName(), player.getName())); | ||
//user = handler.getUserPrefix(player.getWorld().getName(), player.getName()); | ||
} else if (node == "suffix") { | ||
group = handler.getGroupSuffix(player.getWorld().getName(), handler.getGroup(player.getWorld().getName(), player.getName())); | ||
//user = handler.getUserSuffix(player.getWorld().getName(), player.getName()); | ||
} | ||
|
||
if (!group.equals(user)) | ||
user = group + user; | ||
user = TownySettings.parseSingleLineString(user); | ||
|
||
return user; | ||
|
||
} | ||
|
||
/** | ||
* | ||
* @param playerName | ||
* @param node | ||
* @return -1 = can't find | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
// Suppression is to clear warnings while retaining permissions 2.7 compatibility | ||
public int getGroupPermissionIntNode(String playerName, String node) { | ||
|
||
Player player = plugin.getServer().getPlayer(playerName); | ||
String worldName = player.getWorld().getName(); | ||
String groupName; | ||
|
||
try { | ||
PermissionHandler handler = permissions.getHandler(); | ||
groupName = handler.getGroup(worldName, playerName); | ||
|
||
return handler.getGroupPermissionInteger(worldName, groupName, node); | ||
} catch (Exception e) { | ||
// Ignore UnsupportedOperationException on certain Permission APIs | ||
} | ||
|
||
return -1; | ||
} | ||
|
||
/** | ||
* | ||
* @param playerName | ||
* @param node | ||
* @return empty = can't find | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
// Suppression is to clear warnings while retaining permissions 2.7 compatibility | ||
public String getPlayerPermissionStringNode(String playerName, String node) { | ||
|
||
Player player = plugin.getServer().getPlayer(playerName); | ||
String worldName = player.getWorld().getName(); | ||
String groupName; | ||
|
||
try { | ||
PermissionHandler handler = permissions.getHandler(); | ||
groupName = handler.getGroup(worldName, playerName); | ||
String perm = handler.getGroupPermissionString(worldName, groupName, node); | ||
|
||
if (perm != null) | ||
return perm; | ||
} catch (Exception e) { | ||
// Ignore UnsupportedOperationException on certain Permission APIs | ||
} | ||
|
||
return ""; | ||
} | ||
|
||
/** | ||
* hasPermission | ||
* | ||
* returns if a player has a certain permission node. | ||
* | ||
* @param player | ||
* @param node | ||
* @return true is Op or has the permission node | ||
*/ | ||
@Override | ||
public boolean has(Player player, String node) { | ||
|
||
PermissionHandler handler = permissions.getHandler(); | ||
return handler.permission(player, node); | ||
} | ||
|
||
/** | ||
* Returns the players Group name. | ||
* | ||
* @param player | ||
* @return Name of this players group. | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
@Override | ||
public String getPlayerGroup(Player player) { | ||
|
||
PermissionHandler handler = permissions.getHandler(); | ||
return handler.getGroup(player.getWorld().getName(), player.getName()); | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
TODO: | ||
Start using this list. Ha. Ha. Nice One :) | ||
|
||
|
||
|
||
|
Oops, something went wrong.