Updated
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
9c7005f3a8
commit
750e8d3d59
12
pom.xml
12
pom.xml
@ -83,11 +83,6 @@
|
||||
<id>spigotmc-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>bstats-repo</id>
|
||||
<url>http://repo.bstats.org/content/repositories/releases/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -104,12 +99,5 @@
|
||||
<version>1.13.1-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>1.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -15,7 +15,7 @@ public class Delhome implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command command, String label, String[] a) {
|
||||
if(s instanceof Player && s.hasPermission("bettertp.delhome")) {
|
||||
if(s instanceof Player/* && s.hasPermission("bettertp.delhome")*/) {
|
||||
if(a.length > 2) return false; //too many arguments
|
||||
Config c = new Config(API.getPlayersFolder(), s.getName());
|
||||
String homename = a.length == 0 ? "home" : a[0];
|
||||
@ -26,8 +26,10 @@ public class Delhome implements CommandExecutor {
|
||||
c.delete();
|
||||
} else c.save();
|
||||
//sendmessage home deleted
|
||||
s.sendMessage(m.getString("home.deleted").replace("[home]", homename).replace("&", "§"));
|
||||
} else {
|
||||
//sendmessage home don't exist
|
||||
s.sendMessage(m.getString("home.dont-exist").replace("[home]", homename).replace("&", "§"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -17,16 +17,18 @@ public class Home implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command command, String label, String[] a) {
|
||||
if(s instanceof Player && s.hasPermission("bettertp.home")) {
|
||||
if(s instanceof Player/* && s.hasPermission("bettertp.home")*/) {
|
||||
if(a.length > 1) return false; //too many arguments
|
||||
Config c = new Config(API.getPlayersFolder(), s.getName());
|
||||
String homename = a.length == 0 ? "home" : a[0];
|
||||
if(c.isSet(homename)) {
|
||||
((Player) s).teleport(new Location(Bukkit.getServer().getWorld(c.getString(homename+".world")), c.getDouble(homename+".x"), c.getDouble(homename+".y"), c.getDouble(homename+".z")));
|
||||
//sendmessage teleported to home home
|
||||
s.sendMessage(m.getString("home.teleported").replace("[home]", homename).replace("&", "§"));
|
||||
return true;
|
||||
} else {
|
||||
//sendmessage home don't exist
|
||||
s.sendMessage(m.getString("home.dont-exist").replace("[home]", homename).replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
} else if(s instanceof ConsoleCommandSender) {
|
||||
|
@ -19,12 +19,12 @@ public class Sethome implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command command, String label, String[] a) {
|
||||
if(s instanceof Player && s.hasPermission("bettertp.sethome")) {
|
||||
if(s instanceof Player/* && s.hasPermission("bettertp.sethome")*/) {
|
||||
if(a.length > 2) return false; //too many arguments
|
||||
Config c = new Config(API.getPlayersFolder(), s.getName());
|
||||
Integer maxhomes = -1;
|
||||
for(String e : mc.getSection("maxhomes")) {
|
||||
if(s.hasPermission("bettertp.max."+e)) {
|
||||
if(true || s.hasPermission("bettertp.max."+e)) {
|
||||
Integer max = mc.getInt("maxhomes."+e, 0);
|
||||
maxhomes = max > maxhomes ? max : maxhomes; //if max > maxhome then maxhome = max
|
||||
}
|
||||
@ -37,7 +37,7 @@ public class Sethome implements CommandExecutor {
|
||||
if(!c.exist()) c.create();
|
||||
String homename = a.length == 0 ? "home" : a[0];
|
||||
if(c.isSet(homename)) {
|
||||
//sendmessage home already set please delete it before (/delhome)
|
||||
s.sendMessage(m.getString("home.max").replace("[max]", homename).replace("&", "§"));
|
||||
} else {
|
||||
Location l = ((Player) s).getLocation();
|
||||
c.set(homename+".world", l.getWorld().getName());
|
||||
@ -45,7 +45,7 @@ public class Sethome implements CommandExecutor {
|
||||
c.set(homename+".y", l.getY());
|
||||
c.set(homename+".z", l.getZ());
|
||||
c.save();
|
||||
//sendmessage home set
|
||||
s.sendMessage(m.getString("home.set").replace("[home]", homename).replace("&", "§"));
|
||||
}
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
|
@ -9,8 +9,6 @@ import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import org.bstats.bukkit.Metrics;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.concurrent.Callable;
|
||||
@ -53,9 +51,10 @@ public final class Main extends JavaPlugin {
|
||||
config();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
error("Error Config not generated");
|
||||
error("Error: Config not generated");
|
||||
error("Shutting Down for security...");
|
||||
this.getPluginLoader().disablePlugin(this);
|
||||
return
|
||||
}
|
||||
debug("Loaded Configuration !");
|
||||
|
||||
@ -77,13 +76,6 @@ public final class Main extends JavaPlugin {
|
||||
getCommand("Homelist").setExecutor(new Homelist());
|
||||
|
||||
debug("Loaded Commands");
|
||||
|
||||
if(new Config("", "config").getBoolean("metrics", true)) {
|
||||
debug("Enabling Metrics");
|
||||
loadCharts(new Metrics(this));
|
||||
log("Metrics Started : https://bstats.org/plugin/bukkit/"+desc.getName()+"/");
|
||||
}
|
||||
|
||||
log("Loaded !");
|
||||
}
|
||||
|
||||
@ -131,23 +123,4 @@ public final class Main extends JavaPlugin {
|
||||
c.save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void loadCharts(Metrics metrics) {
|
||||
Main.debug("loading custom charts");
|
||||
metrics.addCustomChart(new Metrics.SingleLineChart("home_number", new Callable<Integer>(){
|
||||
|
||||
@Override
|
||||
public Integer call() throws Exception {
|
||||
Integer result = 0;
|
||||
for (String conf : API.listPlayersWithHome()) {
|
||||
Config c = new Config(API.getPlayersFolder(), conf);
|
||||
result += c.getSection("").size();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}));
|
||||
Main.debug("loading custom charts");
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user