mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
Vminecraft.properties should be created if one doesn't exist, added masstp
This commit is contained in:
parent
1b9b57889c
commit
9a68fa78dc
@ -1,7 +1,7 @@
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
||||
public class settings {
|
||||
private final static Object syncLock = new Object();
|
||||
@ -17,6 +17,7 @@ public class settings {
|
||||
private boolean cmdDemote = false;
|
||||
private boolean cmdWhoIs = false;
|
||||
private boolean cmdRules = false;
|
||||
private boolean cmdMasstp = false;
|
||||
private boolean cmdTp = false;
|
||||
private boolean cmdTphere = false;
|
||||
private boolean globalmessages = false;
|
||||
@ -31,7 +32,42 @@ public class settings {
|
||||
|
||||
if(properties == null)
|
||||
{
|
||||
String location = etc.getInstance().getUsersLocation();
|
||||
properties = new PropertiesFile("vminecraft.properties");
|
||||
FileWriter writer = null;
|
||||
try {
|
||||
writer = new FileWriter(location);
|
||||
writer.write("#This plugin is modular\r\n");
|
||||
writer.write("#Turn any features you don't want to false and they won't be running\r\n");
|
||||
writer.write("#If you edit this file and save it, then use /reload it will reload the settings\r\n");
|
||||
writer.write("greentext=true\r\n");
|
||||
writer.write("quakeColors=true\r\n");
|
||||
writer.write("cmdTphere=true\r\n");
|
||||
writer.write("cmdFabulous=true\r\n");
|
||||
writer.write("cmdWhoIs=true\r\n");
|
||||
writer.write("cmdPromote=true\r\n");
|
||||
writer.write("cmdDemote=true\r\n");
|
||||
writer.write("cmdMasstp=true\r\n");
|
||||
writer.write("cmdSay=true\r\n");
|
||||
writer.write("cmdTp=true\r\n");
|
||||
writer.write("cmdRules=true\r\n");
|
||||
writer.write("globalmessages=true\r\n");
|
||||
writer.write("FFF=true\r\n");
|
||||
writer.write("adminchat=true\r\n");
|
||||
writer.write("rules=Rules@#1: No griefing@#2: No griefing\r\n");
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while creating " + location, e);
|
||||
} finally {
|
||||
try {
|
||||
if (writer != null) {
|
||||
writer.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.log(Level.SEVERE, "Exception while closing writer for " + location, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
properties.load();
|
||||
}
|
||||
@ -47,6 +83,7 @@ public class settings {
|
||||
cmdWhoIs = properties.getBoolean("cmdWhoIs",true);
|
||||
cmdRules = properties.getBoolean("cmdRules",true);
|
||||
cmdTp = properties.getBoolean("cmdTp",true);
|
||||
cmdMasstp = properties.getBoolean("cmdMasstp",true);
|
||||
cmdTphere = properties.getBoolean("cmdTphere",true);
|
||||
globalmessages = properties.getBoolean("globalmessages",true);
|
||||
cmdSay = properties.getBoolean("cmdSay",true);
|
||||
@ -73,6 +110,7 @@ public class settings {
|
||||
public boolean cmdSay() {return cmdSay;}
|
||||
public boolean cmdRules() {return cmdRules;}
|
||||
public boolean globalmessages() {return globalmessages;}
|
||||
public boolean cmdMasstp() {return cmdMasstp;}
|
||||
|
||||
public static settings getInstance() {
|
||||
if (instance == null) {
|
||||
|
@ -82,6 +82,21 @@ import java.util.logging.Level; //Need this to use LEVEL.INFO etc
|
||||
public boolean onCommand(Player player, String[] split) {
|
||||
if(!player.canUseCommand(split[0])) {
|
||||
return false;
|
||||
}
|
||||
if(settings.getInstance().cmdMasstp() && split[0].equalsIgnoreCase("/masstp")) {
|
||||
etc.getInstance().addCommand("/masstp", "Teleports those with lower permissions to you");
|
||||
if (split.length < 2) {
|
||||
player.sendMessage(Colors.Rose + "Correct usage is: /masstp group");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (Player p : etc.getServer().getPlayerList()) {
|
||||
if (!p.hasControlOver(player)) {
|
||||
p.teleportTo(player);
|
||||
}
|
||||
player.sendMessage("Summoning successful.");
|
||||
}
|
||||
|
||||
}
|
||||
//Replacement for /tp
|
||||
if(settings.getInstance().cmdTp() && split[0].equalsIgnoreCase("/tp")) {
|
||||
|
Loading…
Reference in New Issue
Block a user