Compare commits
44 Commits
Author | SHA1 | Date | |
---|---|---|---|
75a9cad1e6 | |||
|
99fbed29e0 | ||
dfd4e1e1b4 | |||
a120301bef | |||
d443b464d4 | |||
a92b82e5da | |||
c43340ee15 | |||
d9311addab | |||
ad43193951 | |||
b6dedbd13a | |||
b92be6d2a9 | |||
80c055d209 | |||
b9dcbbfc09 | |||
4bac4a1d70 | |||
79bc01d986 | |||
8b8a304476 | |||
9d8879f0b2 | |||
31c7d8cd7f | |||
6fc78f64f3 | |||
46bc9963fa | |||
63fae3590f | |||
70f667447a | |||
7c1376be8a | |||
7aeed9877f | |||
5e8c850ee7 | |||
56af5a4866 | |||
b4eee29372 | |||
d08ff3f275 | |||
e50e394cb9 | |||
aea566ff30 | |||
892b493c9f | |||
a561ac693b | |||
187d68902e | |||
c5ac11a347 | |||
0c3601e112 | |||
8a648ad0ac | |||
953e1bf4d7 | |||
5f5552b6e4 | |||
066fa619c9 | |||
8d49e0ecc0 | |||
0ad58581d8 | |||
f1817a636d | |||
b9de5e5353 | |||
d8f2fd5c3c |
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@
|
||||||
.settings
|
.settings
|
||||||
/bin
|
/bin
|
||||||
.git
|
.git
|
||||||
|
*.class
|
||||||
|
|
54
README.md
54
README.md
|
@ -1,11 +1,10 @@
|
||||||
SimplyPerms
|
![](http://dev.bukkit.org/media/images/40/348/simplyperms3.png)
|
||||||
===========
|
|
||||||
|
|
||||||
### *When powerful plugin made Permissions easy !*
|
### *When powerful plugin made Permissions easy !*
|
||||||
|
|
||||||
SimplyPerms is yet another Permissions plugin manager based on PermissionsBukkit ideas with the new Configuration API.
|
SimplyPerms is yet another Permissions plugin manager based on PermissionsBukkit ideas with some new really great features !
|
||||||
|
|
||||||
**WARNING : SimplyPerms is not compatible with PermissionsBukkit or other permissions plugins, SimplyPerms will disable all permissions plugins !**
|
**WARNING : SimplyPerms is not compatible with PermissionsBukkit or other permissions plugins !**
|
||||||
|
|
||||||
## [Commands][2]
|
## [Commands][2]
|
||||||
|
|
||||||
|
@ -21,10 +20,44 @@ Please refer to the [PermissionsBukkit documentation][5]
|
||||||
An example configuration file [can be found here][6]
|
An example configuration file [can be found here][6]
|
||||||
For the database connection, [please refer to this page][7]
|
For the database connection, [please refer to this page][7]
|
||||||
|
|
||||||
|
## Add-ons
|
||||||
|
|
||||||
|
### [SimplyWrap][10]
|
||||||
|
|
||||||
|
This make plugins based on PermissionsBukkit API compatible with SimplyPerms.
|
||||||
|
|
||||||
|
[You can download it here.][10]
|
||||||
|
|
||||||
|
*Not all PermissionsBukkit plugin will work with this ! Try and give me your feedbacks !*
|
||||||
|
|
||||||
|
### [SimplyRank][14]
|
||||||
|
|
||||||
|
This allow you to use the rank feature with SimplyPerms.
|
||||||
|
|
||||||
|
[You can download it here.][14]
|
||||||
|
|
||||||
|
With this you can allow someone to grant someone else on a specified group.
|
||||||
|
|
||||||
|
Commands :
|
||||||
|
|
||||||
|
* /rank [player] [group]
|
||||||
|
* /ranker [player] [group]
|
||||||
|
* /setrank [player] [group]
|
||||||
|
|
||||||
|
Permission :
|
||||||
|
|
||||||
|
* permissions.rank.[groupname]
|
||||||
|
|
||||||
|
## [Source code][11]
|
||||||
|
|
||||||
|
All my work is available in GitHub :
|
||||||
|
**[SimplyPerms][11]** / *[SimplyWrap][12] / [SimplyRank][15]*
|
||||||
|
|
||||||
## Thanks
|
## Thanks
|
||||||
|
|
||||||
* [PermissionsBukkit][8] by SpaceManiac for core permissions code
|
* [PermissionsBukkit][8] by SpaceManiac for core permissions code
|
||||||
* [AntiGuest][9] by QuickWango for part of authorizations feature
|
* [AntiGuest][9] by QuickWango for part of authorizations feature
|
||||||
|
* [milkywayz][16] for the modified PermissionsBukkit to include rank feature
|
||||||
|
|
||||||
## Todo
|
## Todo
|
||||||
|
|
||||||
|
@ -32,9 +65,11 @@ For the database connection, [please refer to this page][7]
|
||||||
* Import from other Permissions Plugins
|
* Import from other Permissions Plugins
|
||||||
* **Feel free to ask me new features, improvements or bugs :D**
|
* **Feel free to ask me new features, improvements or bugs :D**
|
||||||
|
|
||||||
## Donations
|
## [Donate][13]
|
||||||
|
|
||||||
I make my plugins with my free time and for free, if you like my work, you can buy me a coffee :D
|
I make my plugins with my free time and for free, if you like my work, [you can buy me a coffee][13] :D
|
||||||
|
|
||||||
|
[![](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif)][13]
|
||||||
|
|
||||||
[2]: http://dev.bukkit.org/server-mods/simplyperms/pages/commands/
|
[2]: http://dev.bukkit.org/server-mods/simplyperms/pages/commands/
|
||||||
[3]: http://dev.bukkit.org/server-mods/simplyperms/pages/permissions-and-authorizations/
|
[3]: http://dev.bukkit.org/server-mods/simplyperms/pages/permissions-and-authorizations/
|
||||||
|
@ -44,3 +79,10 @@ I make my plugins with my free time and for free, if you like my work, you can b
|
||||||
[7]: http://dev.bukkit.org/server-mods/simplyperms/pages/database-connection/
|
[7]: http://dev.bukkit.org/server-mods/simplyperms/pages/database-connection/
|
||||||
[8]: http://dev.bukkit.org/server-mods/permbukkit/
|
[8]: http://dev.bukkit.org/server-mods/permbukkit/
|
||||||
[9]: http://dev.bukkit.org/server-mods/antiguest/
|
[9]: http://dev.bukkit.org/server-mods/antiguest/
|
||||||
|
[10]: https://github.com/downloads/Xefir/SimplyWrap/SimplyWrap.jar
|
||||||
|
[11]: https://github.com/Xefir/SimplyPerms
|
||||||
|
[12]: https://github.com/Xefir/SimplyWrap
|
||||||
|
[13]: https://github.com/downloads/Xefir/SimplyPerms/donate.html
|
||||||
|
[14]: https://github.com/downloads/Xefir/SimplyRank/SimplyRank.jar
|
||||||
|
[15]: https://github.com/Xefir/SimplyRank
|
||||||
|
[16]: https://github.com/milkywayz/PermissionsBukkit
|
||||||
|
|
15
donate.html
Normal file
15
donate.html
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
|
||||||
|
<title> </title>
|
||||||
|
</head>
|
||||||
|
<body onload="document.getElementById('form').submit()">
|
||||||
|
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="form">
|
||||||
|
<input type="hidden" name="cmd" value="_s-xclick">
|
||||||
|
<input type="hidden" name="hosted_button_id" value="FQ8F4D7JZRPS2">
|
||||||
|
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
||||||
|
<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -18,7 +18,7 @@ db:
|
||||||
value: value
|
value: value
|
||||||
date: date
|
date: date
|
||||||
users:
|
users:
|
||||||
ConspiracyWizard:
|
conspiracywizard:
|
||||||
permissions:
|
permissions:
|
||||||
permissions.example: true
|
permissions.example: true
|
||||||
groups:
|
groups:
|
||||||
|
|
|
@ -16,46 +16,61 @@ public class SimplyAPI implements PermsConfig {
|
||||||
@Override
|
@Override
|
||||||
public void removePlayer(String player) {
|
public void removePlayer(String player) {
|
||||||
plugin.config.removePlayer(player);
|
plugin.config.removePlayer(player);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerGroups(String player) {
|
public void removePlayerGroups(String player) {
|
||||||
plugin.config.removePlayerGroups(player);
|
plugin.config.removePlayerGroups(player);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerGroup(String player, String group) {
|
public void removePlayerGroup(String player, String group) {
|
||||||
plugin.config.removePlayerGroup(player, group);
|
plugin.config.removePlayerGroup(player, group);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayerGroup(String player, String group) {
|
||||||
|
plugin.config.setPlayerGroup(player, group);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPlayerGroup(String player, String group) {
|
public void addPlayerGroup(String player, String group) {
|
||||||
plugin.config.addPlayerGroup(player, group);
|
plugin.config.addPlayerGroup(player, group);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPlayerPermission(String player, String permission, boolean value) {
|
public void addPlayerPermission(String player, String permission, boolean value) {
|
||||||
plugin.config.addPlayerPermission(player, permission, value);
|
plugin.config.addPlayerPermission(player, permission, value);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPlayerPermission(String player, String world, String permission, boolean value) {
|
public void addPlayerPermission(String player, String world, String permission, boolean value) {
|
||||||
plugin.config.addPlayerPermission(player, world, permission, value);
|
plugin.config.addPlayerPermission(player, world, permission, value);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerPermissions(String player) {
|
public void removePlayerPermissions(String player) {
|
||||||
plugin.config.removePlayerPermissions(player);
|
plugin.config.removePlayerPermissions(player);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerPermission(String player, String permission) {
|
public void removePlayerPermission(String player, String permission) {
|
||||||
plugin.config.removePlayerPermission(player, permission);
|
plugin.config.removePlayerPermission(player, permission);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerPermission(String player, String world, String permission) {
|
public void removePlayerPermission(String player, String world, String permission) {
|
||||||
plugin.config.removePlayerPermission(player, world, permission);
|
plugin.config.removePlayerPermission(player, world, permission);
|
||||||
|
plugin.refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,16 +126,19 @@ public class SimplyAPI implements PermsConfig {
|
||||||
@Override
|
@Override
|
||||||
public void addGroupInheritance(String group, String inherit) {
|
public void addGroupInheritance(String group, String inherit) {
|
||||||
plugin.config.addGroupInheritance(group, inherit);
|
plugin.config.addGroupInheritance(group, inherit);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeGroupInheritance(String group, String inherit) {
|
public void removeGroupInheritance(String group, String inherit) {
|
||||||
plugin.config.removeGroupInheritance(group, inherit);
|
plugin.config.removeGroupInheritance(group, inherit);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeGroupInheritances(String group) {
|
public void removeGroupInheritances(String group) {
|
||||||
plugin.config.removeGroupInheritances(group);
|
plugin.config.removeGroupInheritances(group);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -136,31 +154,37 @@ public class SimplyAPI implements PermsConfig {
|
||||||
@Override
|
@Override
|
||||||
public void addGroupPermission(String group, String world, String permission, boolean value) {
|
public void addGroupPermission(String group, String world, String permission, boolean value) {
|
||||||
plugin.config.addGroupPermission(group, world, permission, value);
|
plugin.config.addGroupPermission(group, world, permission, value);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addGroupPermission(String group, String permission, boolean value) {
|
public void addGroupPermission(String group, String permission, boolean value) {
|
||||||
plugin.config.addGroupPermission(group, permission, value);
|
plugin.config.addGroupPermission(group, permission, value);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeGroupPermission(String group, String world, String permission) {
|
public void removeGroupPermission(String group, String world, String permission) {
|
||||||
plugin.config.removeGroupPermission(group, world, permission);
|
plugin.config.removeGroupPermission(group, world, permission);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeGroupPermission(String group, String permission) {
|
public void removeGroupPermission(String group, String permission) {
|
||||||
plugin.config.removeGroupPermission(group, permission);
|
plugin.config.removeGroupPermission(group, permission);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeGroupPermissions(String group) {
|
public void removeGroupPermissions(String group) {
|
||||||
plugin.config.removeGroupPermissions(group);
|
plugin.config.removeGroupPermissions(group);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeGroup(String group) {
|
public void removeGroup(String group) {
|
||||||
plugin.config.removeGroup(group);
|
plugin.config.removeGroup(group);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -176,11 +200,13 @@ public class SimplyAPI implements PermsConfig {
|
||||||
@Override
|
@Override
|
||||||
public void addMessage(String key, String message) {
|
public void addMessage(String key, String message) {
|
||||||
plugin.config.addMessage(key, message);
|
plugin.config.addMessage(key, message);
|
||||||
|
plugin.refreshConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeMessage(String key) {
|
public void removeMessage(String key) {
|
||||||
plugin.config.removeMessage(key);
|
plugin.config.removeMessage(key);
|
||||||
|
plugin.refreshConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -191,6 +217,7 @@ public class SimplyAPI implements PermsConfig {
|
||||||
@Override
|
@Override
|
||||||
public void setDefaultGroup(String group) {
|
public void setDefaultGroup(String group) {
|
||||||
plugin.config.setDefaultGroup(group);
|
plugin.config.setDefaultGroup(group);
|
||||||
|
refreshPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -201,6 +228,7 @@ public class SimplyAPI implements PermsConfig {
|
||||||
@Override
|
@Override
|
||||||
public void setDebug(boolean debug) {
|
public void setDebug(boolean debug) {
|
||||||
plugin.config.setDebug(debug);
|
plugin.config.setDebug(debug);
|
||||||
|
plugin.refreshConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshPermissions() {
|
public void refreshPermissions() {
|
||||||
|
|
|
@ -183,10 +183,8 @@ public class SimplyCommands implements CommandExecutor {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
manager.run();
|
manager.run();
|
||||||
plugin.refreshPermissions();
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Operation success !");
|
sender.sendMessage(ChatColor.GREEN + "Operation success !");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
plugin.reloadConfig();
|
|
||||||
sender.sendMessage(ChatColor.RED + "An error occurred ! Please check server log...");
|
sender.sendMessage(ChatColor.RED + "An error occurred ! Please check server log...");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -301,7 +299,7 @@ public class SimplyCommands implements CommandExecutor {
|
||||||
String player = split[2].toLowerCase();
|
String player = split[2].toLowerCase();
|
||||||
|
|
||||||
if (!plugin.config.isPlayerInDB(player)) {
|
if (!plugin.config.isPlayerInDB(player)) {
|
||||||
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.RED + " is in the default group.");
|
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.RED + " is in the " + plugin.config.getDefaultGroup() + " group.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +323,7 @@ public class SimplyCommands implements CommandExecutor {
|
||||||
plugin.config.addPlayerGroup(player, group);
|
plugin.config.addPlayerGroup(player, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.refreshPermissions();
|
plugin.refreshPlayerPermissions(player);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is now in " + ChatColor.WHITE + split[3] + ChatColor.GREEN + ".");
|
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is now in " + ChatColor.WHITE + split[3] + ChatColor.GREEN + ".");
|
||||||
return true;
|
return true;
|
||||||
|
@ -341,7 +339,7 @@ public class SimplyCommands implements CommandExecutor {
|
||||||
}
|
}
|
||||||
plugin.config.addPlayerGroup(player, group);
|
plugin.config.addPlayerGroup(player, group);
|
||||||
|
|
||||||
plugin.refreshPermissions();
|
plugin.refreshPlayerPermissions(player);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is now in " + ChatColor.WHITE + group + ChatColor.GREEN + ".");
|
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is now in " + ChatColor.WHITE + group + ChatColor.GREEN + ".");
|
||||||
return true;
|
return true;
|
||||||
|
@ -357,7 +355,7 @@ public class SimplyCommands implements CommandExecutor {
|
||||||
}
|
}
|
||||||
plugin.config.removePlayerGroup(player, group);
|
plugin.config.removePlayerGroup(player, group);
|
||||||
|
|
||||||
plugin.refreshPermissions();
|
plugin.refreshPlayerPermissions(player);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is no longer in " + ChatColor.WHITE + group + ChatColor.GREEN + ".");
|
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is no longer in " + ChatColor.WHITE + group + ChatColor.GREEN + ".");
|
||||||
return true;
|
return true;
|
||||||
|
@ -372,7 +370,7 @@ public class SimplyCommands implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.config.removePlayer(player);
|
plugin.config.removePlayer(player);
|
||||||
plugin.refreshPermissions();
|
plugin.refreshPlayerPermissions(player);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is no longer in config file.");
|
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " is no longer in config file.");
|
||||||
return true;
|
return true;
|
||||||
|
@ -390,7 +388,7 @@ public class SimplyCommands implements CommandExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.config.addPlayerPermission(player, world, perm, value);
|
plugin.config.addPlayerPermission(player, world, perm, value);
|
||||||
plugin.refreshPermissions();
|
plugin.refreshPlayerPermissions(player);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " now has " + ChatColor.WHITE + perm + ChatColor.GREEN + " = " + ChatColor.WHITE + value + ChatColor.GREEN + ".");
|
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " now has " + ChatColor.WHITE + perm + ChatColor.GREEN + " = " + ChatColor.WHITE + value + ChatColor.GREEN + ".");
|
||||||
return true;
|
return true;
|
||||||
|
@ -412,7 +410,7 @@ public class SimplyCommands implements CommandExecutor {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plugin.config.removePlayerPermission(player, world, perm);
|
plugin.config.removePlayerPermission(player, world, perm);
|
||||||
plugin.refreshPermissions();
|
plugin.refreshPlayerPermissions(player);
|
||||||
|
|
||||||
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " no longer has " + ChatColor.WHITE + perm + ChatColor.GREEN + " set.");
|
sender.sendMessage(ChatColor.GREEN + "Player " + ChatColor.WHITE + player + ChatColor.GREEN + " no longer has " + ChatColor.WHITE + perm + ChatColor.GREEN + " set.");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -92,8 +92,7 @@ public class SimplyPlugin extends JavaPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDatabase() {
|
private void initDatabase() {
|
||||||
if (getConfig().getString("db/type") != null
|
if (!getConfig().getString("db/type", "file").equals("file")) {
|
||||||
&& !getConfig().getString("db/type").equals("file")) {
|
|
||||||
ConfigSQL configsql = new ConfigSQL(this);
|
ConfigSQL configsql = new ConfigSQL(this);
|
||||||
if (configsql.checkDatabase()) {
|
if (configsql.checkDatabase()) {
|
||||||
config = configsql;
|
config = configsql;
|
||||||
|
@ -146,20 +145,29 @@ public class SimplyPlugin extends JavaPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void refreshPermissions() {
|
protected void refreshConfig() {
|
||||||
try {
|
try {
|
||||||
getConfig().save(configFile);
|
getConfig().save(configFile);
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getLogger().warning("Failed to write changed config.yml: " + e.getMessage());
|
getLogger().warning("Failed to write changed config.yml: " + e.getMessage());
|
||||||
}
|
}
|
||||||
for (String player : permissions.keySet()) {
|
}
|
||||||
PermissionAttachment attachment = permissions.get(player);
|
|
||||||
for (String key : attachment.getPermissions().keySet()) {
|
|
||||||
attachment.unsetPermission(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
calculateAttachment(getServer().getPlayer(player));
|
protected void refreshPlayerPermissions(String player) {
|
||||||
|
refreshConfig();
|
||||||
|
if (getServer().getPlayer(player) == null) return;
|
||||||
|
PermissionAttachment attachment = permissions.get(getServer().getPlayer(player).getName());
|
||||||
|
for (String key : attachment.getPermissions().keySet()) {
|
||||||
|
attachment.unsetPermission(key);
|
||||||
|
}
|
||||||
|
calculateAttachment(getServer().getPlayer(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void refreshPermissions() {
|
||||||
|
refreshConfig();
|
||||||
|
for (String player : permissions.keySet()) {
|
||||||
|
refreshPlayerPermissions(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ public abstract class SimplyPrevents implements Listener {
|
||||||
"chat.Chat",
|
"chat.Chat",
|
||||||
"chat.CapsLock",
|
"chat.CapsLock",
|
||||||
"chat.Flood",
|
"chat.Flood",
|
||||||
|
"chat.Macros",
|
||||||
"craft.Brew",
|
"craft.Brew",
|
||||||
"craft.Chest",
|
"craft.Chest",
|
||||||
"craft.Dispenser",
|
"craft.Dispenser",
|
||||||
|
@ -70,9 +71,11 @@ public abstract class SimplyPrevents implements Listener {
|
||||||
long current = System.currentTimeMillis();
|
long current = System.currentTimeMillis();
|
||||||
|
|
||||||
if (next.longValue() < current) {
|
if (next.longValue() < current) {
|
||||||
player.sendMessage(plugin.config.getMessage(node));
|
if (!plugin.config.getMessage(node).isEmpty()) {
|
||||||
plugin.debug("Event '" + node + "' cancelled for " + player.getName());
|
player.sendMessage(plugin.config.getMessage(node));
|
||||||
throttleTimestamps.put(player, Long.valueOf(current + 3000));
|
plugin.debug("Event '" + node + "' cancelled for " + player.getName());
|
||||||
|
throttleTimestamps.put(player, Long.valueOf(current + 3000));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,10 @@ public class ImportPermBukkit extends SimplyAPI implements ImportManager {
|
||||||
addPlayerGroup(player, group);
|
addPlayerGroup(player, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<String, Object> perm : permBukkit.getConfigurationSection("users/" + player + "/permissions").getValues(false).entrySet()) {
|
if (permBukkit.getConfigurationSection("users/" + player + "/permissions") != null) {
|
||||||
addPlayerPermission(player, perm.getKey(), (Boolean) perm.getValue());
|
for (Entry<String, Object> perm : permBukkit.getConfigurationSection("users/" + player + "/permissions").getValues(false).entrySet()) {
|
||||||
|
addPlayerPermission(player, perm.getKey(), (Boolean) perm.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String world : plugin.getKeys(permBukkit, "users/" + player + "/worlds")) {
|
for (String world : plugin.getKeys(permBukkit, "users/" + player + "/worlds")) {
|
||||||
|
@ -43,8 +45,10 @@ public class ImportPermBukkit extends SimplyAPI implements ImportManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String group : plugin.getKeys(permBukkit, "groups")) {
|
for (String group : plugin.getKeys(permBukkit, "groups")) {
|
||||||
for (Entry<String, Object> perms : permBukkit.getConfigurationSection("groups/" + group + "/permissions").getValues(false).entrySet()) {
|
if (permBukkit.getConfigurationSection("groups/" + group + "/permissions") != null) {
|
||||||
addGroupPermission(group, perms.getKey(), (Boolean) perms.getValue());
|
for (Entry<String, Object> perms : permBukkit.getConfigurationSection("groups/" + group + "/permissions").getValues(false).entrySet()) {
|
||||||
|
addGroupPermission(group, perms.getKey(), (Boolean) perms.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String world : plugin.getKeys(permBukkit, "groups/" + group + "/worlds")) {
|
for (String world : plugin.getKeys(permBukkit, "groups/" + group + "/worlds")) {
|
||||||
|
|
|
@ -18,23 +18,33 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayer(String player) {
|
public void removePlayer(String player) {
|
||||||
|
player = player.toLowerCase();
|
||||||
plugin.getConfig().set("users/" + player, null);
|
plugin.getConfig().set("users/" + player, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerGroups(String player) {
|
public void removePlayerGroups(String player) {
|
||||||
|
player = player.toLowerCase();
|
||||||
plugin.getConfig().set("users/" + player + "/groups", null);
|
plugin.getConfig().set("users/" + player + "/groups", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerGroup(String player, String group) {
|
public void removePlayerGroup(String player, String group) {
|
||||||
|
player = player.toLowerCase();
|
||||||
List<String> groups = getPlayerGroups(player);
|
List<String> groups = getPlayerGroups(player);
|
||||||
groups.remove(group);
|
groups.remove(group);
|
||||||
plugin.getConfig().set("users/" + player + "/groups", (groups.isEmpty()) ? null : groups);
|
plugin.getConfig().set("users/" + player + "/groups", (groups.isEmpty()) ? null : groups);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayerGroup(String player, String group) {
|
||||||
|
removePlayerGroups(player);
|
||||||
|
addPlayerGroup(player, group);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPlayerGroup(String player, String group) {
|
public void addPlayerGroup(String player, String group) {
|
||||||
|
player = player.toLowerCase();
|
||||||
if (group.isEmpty()) return;
|
if (group.isEmpty()) return;
|
||||||
List<String> groups = getPlayerGroups(player);
|
List<String> groups = getPlayerGroups(player);
|
||||||
if (!groups.contains(group)) groups.add(group);
|
if (!groups.contains(group)) groups.add(group);
|
||||||
|
@ -48,6 +58,7 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPlayerPermission(String player, String world, String permission, boolean value) {
|
public void addPlayerPermission(String player, String world, String permission, boolean value) {
|
||||||
|
player = player.toLowerCase();
|
||||||
Map<String, Boolean> permissions = getPlayerPermissions(player, world);
|
Map<String, Boolean> permissions = getPlayerPermissions(player, world);
|
||||||
if (permissions.containsKey(permission)) permissions.remove(permission);
|
if (permissions.containsKey(permission)) permissions.remove(permission);
|
||||||
permissions.put(permission, value);
|
permissions.put(permission, value);
|
||||||
|
@ -61,6 +72,7 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerPermissions(String player) {
|
public void removePlayerPermissions(String player) {
|
||||||
|
player = player.toLowerCase();
|
||||||
plugin.getConfig().set("users/" + player + "/permissions", null);
|
plugin.getConfig().set("users/" + player + "/permissions", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +83,7 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removePlayerPermission(String player, String world, String permission) {
|
public void removePlayerPermission(String player, String world, String permission) {
|
||||||
|
player = player.toLowerCase();
|
||||||
Map<String, Boolean> permissions = getPlayerPermissions(player, world);
|
Map<String, Boolean> permissions = getPlayerPermissions(player, world);
|
||||||
permissions.remove(permission);
|
permissions.remove(permission);
|
||||||
if (!world.isEmpty()) {
|
if (!world.isEmpty()) {
|
||||||
|
@ -96,6 +109,7 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getPlayerGroups(String player) {
|
public List<String> getPlayerGroups(String player) {
|
||||||
|
player = player.toLowerCase();
|
||||||
return plugin.getConfig().getStringList("users/" + player + "/groups");
|
return plugin.getConfig().getStringList("users/" + player + "/groups");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,11 +120,12 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Boolean> getPlayerPermissions(String player, String world) {
|
public Map<String, Boolean> getPlayerPermissions(String player, String world) {
|
||||||
|
player = player.toLowerCase();
|
||||||
Map<String, Boolean> finalPerms = new LinkedHashMap<String, Boolean>();
|
Map<String, Boolean> finalPerms = new LinkedHashMap<String, Boolean>();
|
||||||
String permNode = (!world.isEmpty()) ? "users/" + player + "/worlds/" + world : "users/" + player + "/permissions";
|
String permNode = (!world.isEmpty()) ? "users/" + player + "/worlds/" + world : "users/" + player + "/permissions";
|
||||||
if (plugin.getNode(permNode) != null) {
|
if (plugin.getNode(permNode) != null) {
|
||||||
for (Entry<String, Object> permPlayer : plugin.getNode(permNode).getValues(false).entrySet()) {
|
for (Entry<String, Object> permPlayer : plugin.getNode(permNode).getValues(false).entrySet()) {
|
||||||
finalPerms.put(permPlayer.getKey(), (Boolean) permPlayer.getValue());
|
finalPerms.put(permPlayer.getKey(), Boolean.valueOf(permPlayer.getValue().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return finalPerms;
|
return finalPerms;
|
||||||
|
@ -118,11 +133,13 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPlayerInDB(String player) {
|
public boolean isPlayerInDB(String player) {
|
||||||
|
player = player.toLowerCase();
|
||||||
return plugin.getNode("users/" + player) != null;
|
return plugin.getNode("users/" + player) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getPlayerWorlds(String player) {
|
public List<String> getPlayerWorlds(String player) {
|
||||||
|
player = player.toLowerCase();
|
||||||
if (plugin.getNode("users/" + player + "/worlds") != null) {
|
if (plugin.getNode("users/" + player + "/worlds") != null) {
|
||||||
return new ArrayList<String>(plugin.getNode("users/" + player + "/worlds").getKeys(false));
|
return new ArrayList<String>(plugin.getNode("users/" + player + "/worlds").getKeys(false));
|
||||||
}
|
}
|
||||||
|
@ -197,7 +214,7 @@ public class ConfigFile implements PermsConfig {
|
||||||
String permNode = (!world.isEmpty()) ? "groups/" + group + "/worlds/" + world : "groups/" + group + "/permissions";
|
String permNode = (!world.isEmpty()) ? "groups/" + group + "/worlds/" + world : "groups/" + group + "/permissions";
|
||||||
if (plugin.getNode(permNode) != null) {
|
if (plugin.getNode(permNode) != null) {
|
||||||
for (Entry<String, Object> permGroup : plugin.getNode(permNode).getValues(false).entrySet()) {
|
for (Entry<String, Object> permGroup : plugin.getNode(permNode).getValues(false).entrySet()) {
|
||||||
finalPerms.put(permGroup.getKey(), (Boolean) permGroup.getValue());
|
finalPerms.put(permGroup.getKey(), Boolean.valueOf(permGroup.getValue().toString()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return finalPerms;
|
return finalPerms;
|
||||||
|
@ -268,7 +285,7 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage(String key) {
|
public String getMessage(String key) {
|
||||||
return plugin.getConfig().getString("messages/" + key, plugin.getConfig().getString("messages/all")).replace('&', '\u00A7');
|
return plugin.getConfig().getString("messages/" + key, plugin.getConfig().getString("messages/all", "")).replace('&', '\u00A7');
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -298,7 +315,7 @@ public class ConfigFile implements PermsConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getDebug() {
|
public boolean getDebug() {
|
||||||
return plugin.getConfig().getBoolean("debug", false);
|
return plugin.getConfig().getBoolean("debug", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -113,6 +113,12 @@ public class ConfigSQL implements PermsConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setPlayerGroup(String player, String group) {
|
||||||
|
removePlayerGroups(player);
|
||||||
|
addPlayerGroup(player, group);
|
||||||
|
}
|
||||||
|
|
||||||
private void addPlayerGroup(String player, String group, boolean first) {
|
private void addPlayerGroup(String player, String group, boolean first) {
|
||||||
if (init()) {
|
if (init()) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -11,6 +11,8 @@ public interface PermsConfig {
|
||||||
|
|
||||||
public void removePlayerGroup(String player, String group);
|
public void removePlayerGroup(String player, String group);
|
||||||
|
|
||||||
|
public void setPlayerGroup(String player, String group);
|
||||||
|
|
||||||
public void addPlayerGroup(String player, String group);
|
public void addPlayerGroup(String player, String group);
|
||||||
|
|
||||||
public void addPlayerPermission(String player, String permission, boolean value);
|
public void addPlayerPermission(String player, String permission, boolean value);
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
package net.crystalyx.bukkit.simplyperms.preventions.chat;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
|
|
||||||
|
import net.crystalyx.bukkit.simplyperms.SimplyPlugin;
|
||||||
|
import net.crystalyx.bukkit.simplyperms.SimplyPrevents;
|
||||||
|
|
||||||
|
public class Macros extends SimplyPrevents {
|
||||||
|
|
||||||
|
private HashMap<Player, Long> commandsTimestamps = new HashMap<Player, Long>();
|
||||||
|
|
||||||
|
public Macros(SimplyPlugin plugin) {
|
||||||
|
super(plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
|
public void chat(PlayerCommandPreprocessEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
if (isChatLocked(player)) {
|
||||||
|
prevent(event, player, "macros,spam");
|
||||||
|
} else {
|
||||||
|
setChatLock(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setChatLock(Player player) {
|
||||||
|
commandsTimestamps.put(player, Long.valueOf(System.currentTimeMillis() + 2000));
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isChatLocked(Player player) {
|
||||||
|
Long nextPossible = commandsTimestamps.get(player);
|
||||||
|
if (nextPossible == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
long currentTime = System.currentTimeMillis();
|
||||||
|
return nextPossible.longValue() >= currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
name: SimplyPerms
|
name: SimplyPerms
|
||||||
main: net.crystalyx.bukkit.simplyperms.SimplyPlugin
|
main: net.crystalyx.bukkit.simplyperms.SimplyPlugin
|
||||||
author: Xefir Destiny
|
author: Xefir Destiny
|
||||||
website: http://www.crystalyx.net/
|
website: http://dev.bukkit.org/server-mods/simplyperms/
|
||||||
version: 1.7
|
version: 1.7.6
|
||||||
|
dscription: When powerful plugin made Permissions easy !
|
||||||
softdepend: [ PermissionsBukkit ]
|
softdepend: [ PermissionsBukkit ]
|
||||||
commands:
|
commands:
|
||||||
permissions:
|
permissions:
|
||||||
|
@ -252,10 +253,13 @@ permissions:
|
||||||
children:
|
children:
|
||||||
permissions.allow.capslock: true
|
permissions.allow.capslock: true
|
||||||
permissions.allow.flood: true
|
permissions.allow.flood: true
|
||||||
|
permissions.allow.macros: true
|
||||||
permissions.allow.capslock:
|
permissions.allow.capslock:
|
||||||
description: ALLOWS THE PLAYER TO USE CAPSLOCK
|
description: ALLOWS THE PLAYER TO USE CAPSLOCK
|
||||||
permissions.allow.flood:
|
permissions.allow.flood:
|
||||||
description: Allows the player to chat as fast as he wants
|
description: Allows the player to chat as fast as he wants
|
||||||
|
permissions.allow.macros:
|
||||||
|
description: Allows the player to spam commands
|
||||||
permissions.allow.projectile:
|
permissions.allow.projectile:
|
||||||
description: Allows the player to throw items
|
description: Allows the player to throw items
|
||||||
children:
|
children:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user