Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.util.logging.Logger;
- public class Jail extends Plugin
- {
- String name = "jail";
- String version = "1.0";
- String author = " Spenk";
- static Logger log = Logger.getLogger("Minecraft");
- JailSet js = new JailSet();
- JailDel jd = new JailDel();
- JailWand jw = new JailWand();
- JailListener jl = new JailListener();
- JailProps props = new JailProps();
- public void initialize(){
- log.info(this.name +" version "+ this.version + " by " +this.author+(" is initialized!"));
- etc.getLoader().addListener(PluginLoader.Hook.COMMAND, js, this, PluginListener.Priority.MEDIUM);
- etc.getLoader().addListener(PluginLoader.Hook.COMMAND, jd, this, PluginListener.Priority.MEDIUM);
- etc.getLoader().addListener(PluginLoader.Hook.COMMAND, jw, this, PluginListener.Priority.MEDIUM);
- etc.getLoader().addListener(PluginLoader.Hook.COMMAND, jl, this, PluginListener.Priority.MEDIUM);
- etc.getLoader().addListener(PluginLoader.Hook.BLOCK_RIGHTCLICKED, jw, this, PluginListener.Priority.MEDIUM);
- File f = new File("plugins/config");
- f.mkdir();
- File f1 = new File("plugins/config/Jail");
- f1.mkdir();
- File f2 = new File("plugins/config/Jail/Jailes");
- f2.mkdir();
- props.load();
- if (!new File("plugins/config/Jail/Jails.properties").exists()) {
- new PropertiesFile("plugins/config/Jail/Jails.properties");
- }
- Writer writer = null;
- File filename;
- try {
- filename = new File("config/groups.txt");
- writer = new BufferedWriter(new FileWriter(filename, true));
- if (!isInList(props.group)){
- writer.write("\n"+props.group);
- }else{
- return;
- }
- } catch (FileNotFoundException e) {
- log.info("[ERROR] Groups File not found.");
- return;
- } catch (IOException e) {
- log.info("[ERROR] File IOException Found o.O");
- return;
- } finally {
- try {
- if (writer != null) {
- writer.close();
- }
- } catch (IOException e) {
- log.info("[ERROR] File IOException Found o.O");
- return;
- }
- }
- }
- public void enable(){
- log.info(this.name + " version " + this.version + " by " + this.author + " is enabled!");
- }
- public void disable(){
- log.info(this.name + " version " + this.version + " is disabled!");
- }
- public boolean isInList(String playername) {
- try {
- BufferedReader in = new BufferedReader(new FileReader("config/groups.txt"));
- String line = in.readLine();
- while (line != null) {
- if (line.equalsIgnoreCase(props.group)) {
- in.close();
- return true;
- }
- line = in.readLine();
- }
- in.close();
- } catch (IOException localIOException) {
- }
- return false; }
- }
Advertisement
Add Comment
Please, Sign In to add comment