DONE
This commit is contained in:
parent
f677c3040a
commit
3a20947ccb
16
.gitignore
vendored
Normal file
16
.gitignore
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
*.class
|
||||
*.log
|
||||
*.ctxt
|
||||
.mtj.tmp/
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
hs_err_pid*
|
||||
.idea
|
||||
*.iml
|
||||
out
|
||||
gen
|
@ -1,33 +1,71 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Delta Wings on 19/03/2017 at.01:40
|
||||
*/
|
||||
public class Bettertp implements CommandExecutor {
|
||||
|
||||
Config m = new Config("", "messages");
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command c, String l, String[] a) {
|
||||
if(a.length == 2) {
|
||||
if(a[0].equalsIgnoreCase("set")) {
|
||||
if(a[1].equalsIgnoreCase("spawn")) {
|
||||
|
||||
} else if(a[1].equalsIgnoreCase("lobby")) {
|
||||
|
||||
public boolean onCommand(CommandSender s, Command d, String g, String[] a) {
|
||||
if(s instanceof Player && s.hasPermission("bettertp.admin")) {
|
||||
Player p = (Player) s;
|
||||
if(a.length == 2) {
|
||||
if(a[0].equalsIgnoreCase("set")) {
|
||||
if(a[1].equalsIgnoreCase("spawn")) {
|
||||
Config c = new Config("data/spawn", "config");
|
||||
if(!c.exist()) c.create();
|
||||
Location l = p.getLocation();
|
||||
c.set("world", l.getWorld().getName());
|
||||
c.set("x", l.getX());
|
||||
c.set("y", l.getY());
|
||||
c.set("z", l.getZ());
|
||||
c.save();
|
||||
s.sendMessage(m.getString("spawn.set").replace("&","§"));
|
||||
return true;
|
||||
} else if(a[1].equalsIgnoreCase("lobby")) {
|
||||
Config c = new Config("data/lobby", "config");
|
||||
if(!c.exist()) c.create();
|
||||
Location l = p.getLocation();
|
||||
c.set("world", l.getWorld().getName());
|
||||
c.set("x", l.getX());
|
||||
c.set("y", l.getY());
|
||||
c.set("z", l.getZ());
|
||||
c.save();
|
||||
s.sendMessage(m.getString("lobby.set").replace("&","§"));
|
||||
return true;
|
||||
}
|
||||
} else if(a[0].equalsIgnoreCase("del") || a[0].equalsIgnoreCase("delete")) {
|
||||
if(a[1].equalsIgnoreCase("spawn")) {
|
||||
new Config("data/spawn", "config").delete();
|
||||
s.sendMessage(m.getString("spawn.deleted").replace("&","§"));
|
||||
return true;
|
||||
} else if(a[1].equalsIgnoreCase("lobby")) {
|
||||
new Config("data/lobby", "config").delete();
|
||||
s.sendMessage(m.getString("lobby.deleted").replace("&","§"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if(a[0].equalsIgnoreCase("del") || a[0].equalsIgnoreCase("delete")) {
|
||||
if(a[1].equalsIgnoreCase("spawn")) {
|
||||
|
||||
} else if(a[1].equalsIgnoreCase("lobby")) {
|
||||
|
||||
} else if(a.length == 1) {
|
||||
if(a[0].equalsIgnoreCase("help")) {
|
||||
Config c = new Config("", "messages");
|
||||
p.sendMessage(c.getString("help.top").replace("&", "§"));
|
||||
p.sendMessage("&4| &9/btp &lset &llobby/spawn".replace("&", "§"));
|
||||
p.sendMessage("&4| &9To set spawn or lobby".replace("&", "§"));
|
||||
p.sendMessage("&4| &9/btp &ldel &llobby/spawn".replace("&", "§"));
|
||||
p.sendMessage("&4| &9To delete spawn/lobby".replace("&", "§"));
|
||||
p.sendMessage(c.getString("help.bottom").replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if(a.length == 1) {
|
||||
if(a[0].equalsIgnoreCase("help")) {
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1,9 +1,50 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Delta Wings on 19/03/2017 at.01:37
|
||||
*/
|
||||
public class Delhome implements CommandExecutor {
|
||||
|
||||
private Config m = new Config("", "messages");
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command command, String label, String[] a) {
|
||||
if(s instanceof Player && s.hasPermission("bettertp.delhome")) {
|
||||
Config c = new Config("data", s.getName());
|
||||
if(a.length == 1) {
|
||||
if(c.isSet(a[0])) {
|
||||
c.set(a[0], null);
|
||||
c.save();
|
||||
s.sendMessage(m.getString("home.deleted"));
|
||||
return true;
|
||||
} else {
|
||||
s.sendMessage(m.getString("home.dont-exist").replace("[home]", a[0]).replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
} else if(a.length == 0) {
|
||||
if(c.isSet("home")) {
|
||||
c.set("home", null);
|
||||
c.save();
|
||||
s.sendMessage(m.getString("home.deleted"));
|
||||
return true;
|
||||
} else {
|
||||
s.sendMessage(m.getString("home.dont-exist").replace("[home]", "home").replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else if(s instanceof Player && !s.hasPermission("bettertp.delhome")) {
|
||||
s.sendMessage(m.getString("global.permission").replace("&", "§"));
|
||||
return true;
|
||||
} else {
|
||||
s.sendMessage("global.not-console");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,53 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Main;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Delta Wings on 19/03/2017 at.01:37
|
||||
*/
|
||||
public class Home implements CommandExecutor {
|
||||
private Config m = new Config("", "messages");
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command command, String label, String[] a) {
|
||||
if(s instanceof Player && s.hasPermission("bettertp.home")) {
|
||||
Config c = new Config("data", s.getName());
|
||||
if(c.exist()) {
|
||||
if(a.length == 0) {
|
||||
if ( c.isSet("home") ) {
|
||||
String[] l = new String[2];
|
||||
l[0] = "home";
|
||||
l[1] = "home";
|
||||
Main.getInstance().tp(l, (Player) s);
|
||||
s.sendMessage(m.getString("home.teleported").replace("[home]", "home").replace("&", "§"));
|
||||
return true;
|
||||
} else {
|
||||
s.sendMessage(m.getString("home.dont-exist").replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
} else if(a.length == 1) {
|
||||
if ( c.isSet(a[0]) ) {
|
||||
String[] l = new String[2];
|
||||
l[0] = "home";
|
||||
l[1] = a[0];
|
||||
Main.getInstance().tp(l, (Player) s);
|
||||
s.sendMessage(m.getString("home.teleported").replace("[home]", a[0]).replace("&", "§"));
|
||||
return true;
|
||||
} else {
|
||||
s.sendMessage(m.getString("home.dont-exist").replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
s.sendMessage(m.getString("home.dont-exist"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Delta Wings on 19/03/2017 at.21:33
|
||||
*/
|
||||
public class Homelist implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command command, String label, String[] args) {
|
||||
if(s instanceof Player) {for(String a : new Config("data", s.getName()).getSection("")) s.sendMessage(a.replace("&", "§"));}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,15 +1,43 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Main;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Delta Wings on 18/03/2017 at.15:24
|
||||
*/
|
||||
public class Lobby implements CommandExecutor {
|
||||
private Config m = new Config("", "messages");
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
public boolean onCommand(CommandSender s, Command command, String label, String[] args) {
|
||||
if(s instanceof Player ) {
|
||||
if(s.hasPermission("bettertp.lobby")) {
|
||||
Config c = new Config("data/lobby", "config");
|
||||
if(c.exist()) {
|
||||
Double y = c.getDouble("x", (double) -1);
|
||||
if(!(y == -1)) {
|
||||
String[] sl = new String[2];
|
||||
sl[0] = "lobby";
|
||||
Main.getInstance().tp(sl, (Player) s );
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
s.sendMessage(m.getString("lobby.not-set").replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
s.sendMessage(m.getString("global.permission").replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
s.sendMessage(m.getString("global.not-console"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,51 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Created by Delta Wings on 19/03/2017 at.01:37
|
||||
*/
|
||||
public class Sethome implements CommandExecutor {
|
||||
|
||||
Config m = new Config("", "messages");
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command command, String label, String[] a) {
|
||||
if(s instanceof Player && s.hasPermission("bettertp.sethome")) {
|
||||
if(a.length == 0) {
|
||||
Config c = new Config("data", s.getName());
|
||||
if(!c.exist()) c.create();
|
||||
Location l = ((Player) s).getLocation();
|
||||
c.set("home.world", l.getWorld().getName());
|
||||
c.set("home.x", l.getX());
|
||||
c.set("home.y", l.getY());
|
||||
c.set("home.z", l.getZ());
|
||||
c.save();
|
||||
s.sendMessage(m.getString("home.set").replace("[home]", "home").replace("&", "§"));
|
||||
return true;
|
||||
} else if(a.length == 1) {
|
||||
Config c = new Config("data", s.getName());
|
||||
if(!c.exist()) c.create();
|
||||
Location l = ((Player) s).getLocation();
|
||||
c.set(a[0] + ".world", l.getWorld().getName());
|
||||
c.set(a[0] + ".x", l.getX());
|
||||
c.set(a[0] + ".y", l.getY());
|
||||
c.set(a[0] + ".z", l.getZ());
|
||||
c.save();
|
||||
s.sendMessage(m.getString("home.set").replace("[home]", a[0]).replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
} else if(s instanceof Player && !s.hasPermission("bettertp.sethome")) {
|
||||
s.sendMessage(m.getString("global.permission").replace("&", "§"));
|
||||
return true;
|
||||
} else {
|
||||
s.sendMessage(m.getString("global.not-console"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Spawn implements CommandExecutor {
|
||||
Config m = new Config("", "messages");
|
||||
private Config m = new Config("", "messages");
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender s, Command abdoulila, String l, String[] a) {
|
||||
public boolean onCommand(CommandSender s, Command d, String l, String[] a) {
|
||||
if(s instanceof Player) {
|
||||
if(s.hasPermission("bettertp.spawn")) {
|
||||
Config c = new Config("data/spawn", "config");
|
||||
@ -23,11 +23,19 @@ public class Spawn implements CommandExecutor {
|
||||
String[] sl = new String[2];
|
||||
sl[0] = "spawn";
|
||||
Main.getInstance().tp(sl, (Player) s );
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
s.sendMessage(m.getString("spawn.not-set").replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
} else s.sendMessage(m.getString("global.permission"));
|
||||
} else {
|
||||
s.sendMessage(m.getString("global.permission").replace("&", "§"));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
s.sendMessage(m.getString("global.not-console"));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -16,14 +16,14 @@ public final class Main extends JavaPlugin {
|
||||
Bukkit.getLogger().log(Level.INFO, Message);
|
||||
}
|
||||
|
||||
public Boolean tp(String[] Type, Player Player) {
|
||||
if(Type[0].equals("spawn")) {
|
||||
Config c = new Config("data/spawn", "config");
|
||||
return Player.teleport(new Location(Bukkit.getServer().getWorld(c.getString("world")), c.getDouble("x"), c.getDouble("y"), c.getDouble("z")));
|
||||
public void tp(String[] Type, Player Player) {
|
||||
if(Type[0].equals("spawn") || Type[0].equals("lobby")) {
|
||||
Config c = new Config("data/"+Type[0], "config");
|
||||
Player.teleport(new Location(Bukkit.getServer().getWorld(c.getString("world")), c.getDouble("x"), c.getDouble("y"), c.getDouble("z")));
|
||||
} else {
|
||||
Config c = new Config("data", Player.getName());
|
||||
String t = Type[1];
|
||||
return Player.teleport(new Location(Bukkit.getServer().getWorld(c.getString(t+"world")), c.getDouble(t+"x"), c.getDouble(t+"y"), c.getDouble(t+"z")));
|
||||
String t = Type[1] + ".";
|
||||
Player.teleport(new Location(Bukkit.getServer().getWorld(c.getString(t+"world")), c.getDouble(t+"x"), c.getDouble(t+"y"), c.getDouble(t+"z")));
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,6 +41,7 @@ public final class Main extends JavaPlugin {
|
||||
getCommand("Bettertp").setExecutor(new Bettertp());
|
||||
getCommand("Sethome").setExecutor(new Sethome());
|
||||
getCommand("Delhome").setExecutor(new Delhome());
|
||||
getCommand("Homelist").setExecutor(new Homelist());
|
||||
|
||||
config();
|
||||
|
||||
@ -59,9 +60,20 @@ public final class Main extends JavaPlugin {
|
||||
messages.set("global.permission", "&8 > &cYou do not have the permission to do thats !");
|
||||
messages.set("global.not-console", "This Command cannot be send throught console");
|
||||
messages.set("spawn.set", "&8 >&c The Spawn was set");
|
||||
messages.set("spawn.teleported", "&8 >&c You have benn teleported to the spawn");
|
||||
messages.set("home.teleported", "&8 >&c You have benn teleported to you home : [home]");
|
||||
messages.set("spawn.deleted", "&8 >&c The spawn was deleted");
|
||||
messages.set("spawn.not-set", "&8 >&c Spawn was not set !");
|
||||
messages.set("spawn.teleported", "&8 >&c You have been teleported to the spawn");
|
||||
messages.set("lobby.set", "&8 >&c The lobby was set");
|
||||
messages.set("lobby.deleted", "&8 >&c The lobby was deleted");
|
||||
messages.set("lobby.not-set", "&8 >&c lobby was not set !");
|
||||
messages.set("lobby.teleported", "&8 >&c You have been teleported to the lobby");
|
||||
messages.set("home.teleported", "&8 >&c You have been teleported to you home : [home]");
|
||||
messages.set("home.set", "&8 >&c Your home [home] has been set");
|
||||
messages.set("home.deleted", "&8 >&c Your home [home] has been deleted");
|
||||
messages.set("home.dont-exist", "&8 >&c Your home [home] do not exist");
|
||||
messages.set("home.teleported", "&8 >&c You have been teleported to your home : [home]");
|
||||
messages.set("help.top", "&4-&c=&4-&c=&4-&c=&4-&c=&4-&c=&4-&c=&4-&c= &2BetterTP &c=&4-&c=&4-&c=&4-&c=&4-&c=&4-&c=&4-&c=&4-");
|
||||
messages.set("help.bottom", "&4-&c=&4-&c=&4-&c=&4-&c=&4-&c=&4-&c=&4-&c= &2BetterTP &c=&4-&c=&4-&c=&4-&c=&4-&c=&4-&c=&4-&c=&4-");
|
||||
messages.save();
|
||||
}
|
||||
|
||||
|
@ -27,3 +27,7 @@ commands:
|
||||
description: Delete your homes
|
||||
usage: Usage /delhome [home]
|
||||
aliases: [dhome]
|
||||
homelist:
|
||||
description: List your homes
|
||||
usage: Usage /homelist
|
||||
aliases: [hlist]
|
Reference in New Issue
Block a user