blob: 5d027cccca1bb01ecf79809c0feba9c6b209ad76 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
package com.nijikokun.bukkit.Permissions;
import com.nijiko.permissions.PermissionHandler;
import java.util.logging.Logger;
//import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.permissions.NijikoPermissionsProxy;
import org.bukkit.event.Event.Priority;
import org.bukkit.event.Event.Type;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;
public class Permissions extends JavaPlugin {
public static final Logger log = Logger.getLogger("Fake Permissions");
public static String name = "Permissions";
public static String codename = "Hacked Permissions by AnjoCaido";
public static String version = "2.0";
public static PermissionHandler Security = null;
@Override
public void onDisable() {
PluginDescriptionFile pdfFile = this.getDescription();
System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is disabled!");
}
@Override
public void onEnable() {
PluginDescriptionFile pdfFile = this.getDescription();
if (Security == null) {
//make sure we have only one instance
Security = new NijikoPermissionsProxy(null);
}
Plugin p = (this.getServer() == null) ? null : this.getServer().getPluginManager().getPlugin("GroupManager");
if (p != null) {
if (p.isEnabled()) {
setGM(p);
} else {
if (this.getServer() != null) {
this.getServer().getPluginManager().registerEvent(Type.PLUGIN_ENABLE, new ServerListener() {
@Override
public void onPluginEnable(PluginEnableEvent event) {
if (event.getPlugin().getDescription().getName().equals("GroupManager")) {
Permissions.this.setGM(event.getPlugin());
}
}
}, Priority.Normal, this);
}
}
} else {
System.err.println("OOOPS! Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " couldn't find GroupManager!");
this.getPluginLoader().disablePlugin(this);
}
if (pdfFile != null) {
System.out.println("Fake " + pdfFile.getName() + " version " + pdfFile.getVersion() + " is enabled!");
}
}
private void setGM(final Plugin p) {
//GroupManager groupManager = (GroupManager) p;
((NijikoPermissionsProxy) Security).setGM(p);
}
public PermissionHandler getHandler() {
if (Security == null) {
Security = new NijikoPermissionsProxy(null);
}
return Security;
}
public void setupPermissions() {
if (Security == null) {
Security = new NijikoPermissionsProxy(null);
}
}
}
|