1 |
package dk.thoerup.bukkit.whois; |
2 |
|
3 |
|
4 |
import java.io.File; |
5 |
|
6 |
import org.bukkit.event.Event; |
7 |
import org.bukkit.event.Event.Priority; |
8 |
import org.bukkit.plugin.PluginManager; |
9 |
import org.bukkit.plugin.java.JavaPlugin; |
10 |
|
11 |
import org.bukkit.util.config.Configuration; |
12 |
|
13 |
|
14 |
public class WhoisMain extends JavaPlugin { |
15 |
|
16 |
@Override |
17 |
public void onDisable() { |
18 |
// TODO Auto-generated method stub |
19 |
} |
20 |
|
21 |
|
22 |
@Override |
23 |
public void onEnable() { |
24 |
System.out.println("Loading whois plugin"); |
25 |
|
26 |
File f = new File(this.getDataFolder(), "whoisinfo.dat" ); |
27 |
Configuration config = new Configuration(f); |
28 |
config.load(); |
29 |
|
30 |
getCommand("whois").setExecutor(new WhoisCommand(config) ); |
31 |
getCommand("setwhois").setExecutor(new SetwhoisCommand(config)); |
32 |
getCommand("admsetwhois").setExecutor(new AdmsetwhoisCommand(config)); |
33 |
getCommand("setopnote").setExecutor(new SetopnoteCommand(config)); |
34 |
|
35 |
|
36 |
PluginManager pm = getServer().getPluginManager(); |
37 |
pm.registerEvent(Event.Type.PLAYER_JOIN, new LoginHandler(config, this), Priority.Normal, this); |
38 |
} |
39 |
|
40 |
public static String concatStrings(String args[], int offset) { |
41 |
StringBuilder sb = new StringBuilder(); |
42 |
|
43 |
for (int i=offset; i<args.length; i++) { |
44 |
if (i > offset) |
45 |
sb.append(" "); |
46 |
|
47 |
sb.append(args[i]); |
48 |
} |
49 |
return sb.toString(); |
50 |
} |
51 |
|
52 |
} |