diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/CommandTypes.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/CommandTypes.java index 500a06d..6a3b20c 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/CommandTypes.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/CommandTypes.java @@ -9,7 +9,7 @@ public enum CommandTypes { INFO(new CmdInfo()), PLAYER(new CmdPlayer()), RELOAD(new CmdReload()), - SETTINGS(new CmdSettings(), true), + //SETTINGS(new CmdSettings(), true), TEST(new CmdTest(), true), VERSION(new CmdVersion()), WORLD(new CmdWorld()); diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/Commands.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/Commands.java index 87588ed..10db9cb 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/Commands.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/Commands.java @@ -1,12 +1,11 @@ package me.SuperRonanCraft.BetterRTP.player.commands; +import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.player.rtp.RTPCooldown; import me.SuperRonanCraft.BetterRTP.references.file.FileBasics; -import me.SuperRonanCraft.BetterRTP.Main; import org.bukkit.block.Biome; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import org.bukkit.scheduler.BukkitRunnable; import java.util.ArrayList; import java.util.HashMap; @@ -93,7 +92,11 @@ public class Commands { if (sendi instanceof Player) tp((Player) sendi, sendi, world, biomes); else - sendi.sendMessage(pl.getText().colorPre("Must be a player to use this command! Try '/" + cmd + " help'")); + msgNotPlayer(sendi, cmd); + } + + public void msgNotPlayer(CommandSender sendi, String cmd) { + sendi.sendMessage(pl.getText().colorPre("Must be a player to use this command! Try '/" + cmd + " help'")); } //Custom biomes diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdEdit.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdEdit.java index d8b1269..a03fc9a 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdEdit.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdEdit.java @@ -59,12 +59,12 @@ public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds } private void editWorld(CommandSender sendi, RTP_CMD_EDIT_SUB cmd, String val, String world) { - Object value = val; + Object value; try { value = cmd.getResult(val); } catch (Exception e) { e.printStackTrace(); - Main.getInstance().getText().sms(sendi, "Invalid input!"); + Main.getInstance().getText().getEditError(sendi); return; } @@ -79,7 +79,8 @@ public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds for (Object map2 : m.values()) { Map values = (Map) map2; values.put(cmd.get(), value); - Main.getInstance().getText().sms(sendi, cmd.get() + " set to " + value); + + Main.getInstance().getText().getEditSet(sendi, cmd.get(), val); } break; } @@ -108,7 +109,7 @@ public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds value = cmd.getResult(val); } catch (Exception e) { e.printStackTrace(); - Main.getInstance().getText().sms(sendi, "Invalid input!"); + Main.getInstance().getText().getEditError(sendi); return; } @@ -120,6 +121,7 @@ public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds try { config.save(file.getFile()); Main.getInstance().getRTP().loadWorldSettings(); + Main.getInstance().getText().getEditSet(sendi, cmd.get(), val); } catch (IOException e) { e.printStackTrace(); } diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdHelp.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdHelp.java index 3f18e17..067b12d 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdHelp.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdHelp.java @@ -16,14 +16,15 @@ public class CmdHelp implements RTPCommand, RTPCommandHelpable { public void execute(CommandSender sendi, String label, String[] args) { Messages txt = Main.getInstance().getText(); List list = new ArrayList<>(); + list.add(txt.getHelpPrefix()); list.add(txt.getHelpMain()); for (CommandTypes cmd : CommandTypes.values()) - if (cmd.getCmd().permission(sendi)) - if (cmd.getCmd() instanceof RTPCommandHelpable) { - String help = ((RTPCommandHelpable) cmd.getCmd()).getHelp(); - System.out.println(help); - list.add(help); - } + if (!cmd.isDebugOnly() || Main.getInstance().getSettings().debug) + if (cmd.getCmd().permission(sendi)) + if (cmd.getCmd() instanceof RTPCommandHelpable) { + String help = ((RTPCommandHelpable) cmd.getCmd()).getHelp(); + list.add(help); + } for (int i = 0; i < list.size(); i++) list.set(i, list.get(i).replace("%command%", label)); Main.getInstance().getText().sms(sendi, list); diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdSettings.java b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdSettings.java index d61fe97..642e6ff 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdSettings.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/player/commands/types/CmdSettings.java @@ -12,7 +12,10 @@ import java.util.List; public class CmdSettings implements RTPCommand, RTPCommandHelpable { public void execute(CommandSender sendi, String label, String[] args) { - Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show((Player) sendi); + if (sendi instanceof Player) + Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show((Player) sendi); + else + Main.getInstance().getCmd().msgNotPlayer(sendi, label); } public List tabComplete(CommandSender sendi, String[] args) { diff --git a/src/main/java/me/SuperRonanCraft/BetterRTP/references/file/Messages.java b/src/main/java/me/SuperRonanCraft/BetterRTP/references/file/Messages.java index b2d0f59..d5fd02d 100644 --- a/src/main/java/me/SuperRonanCraft/BetterRTP/references/file/Messages.java +++ b/src/main/java/me/SuperRonanCraft/BetterRTP/references/file/Messages.java @@ -139,7 +139,24 @@ public class Messages { return color(getPrefix() + str); } + //Edit + public void getEditError(CommandSender sendi) { + sms(sendi, getLang().getString(preM + "Edit.Error")); + } + + public void getEditSet(CommandSender sendi, String type, String value) { + sms(sendi, getLang().getString(preM + "Edit.Set").replaceAll("%type%", type).replaceAll("%value%", value)); + } + + public void getEditRemove(CommandSender sendi, String world) { + sms(sendi, getLang().getString(preM + "Edit.Remove").replaceAll("%world%", world)); + } + //Help + public String getHelpPrefix() { + return getLang().getString(preH + "Prefix"); + } + public String getHelpMain() { //rtp return getLang().getString(preH + "Main"); } @@ -149,8 +166,7 @@ public class Messages { } public String getHelpEdit() { //rtp edit - return ""; - //return getLang().getString(preH + "Edit"); + return getLang().getString(preH + "Edit"); } public String getHelpHelp() { //rtp help @@ -165,7 +181,7 @@ public class Messages { return getLang().getString(preH + "Player"); } - public String getHelpReload() { //rtp reload + public String getHelpReload() { return getLang().getString(preH + "Reload"); } diff --git a/src/main/resources/lang/chn.yml b/src/main/resources/lang/chn.yml index 45e8e6a..fcc651e 100644 --- a/src/main/resources/lang/chn.yml +++ b/src/main/resources/lang/chn.yml @@ -3,12 +3,12 @@ Messages: Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! # Paid: '&a你花费了&c$%price%&7,被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次!' Bypass: '&a你被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次!' - #Loading: '&aSafe spot located! &7Loading chunks...' - #Teleport: '&aTeleporting... &fplease wait while we find a safe location!' +# Loading: '&aSafe spot located! &7Loading chunks...' +# Teleport: '&aTeleporting... &fplease wait while we find a safe location!' Failed: Price: '&c你的钱不够了,&7你至少要有$%price%&7才能随机传送!' NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7你未被传送!' - #Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!' +# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!' Other: Success: '&a%player%被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次!' NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7%player%未被传送!' @@ -28,22 +28,23 @@ Messages: NotExist: '&c看上去&7%world%&c世界并不存在!' Already: '&c啊嘞嘞,&7看上去你已经在随机传送中了,请耐心点!' Sign: '&7命令标记已被创建!&7命令为''&f/rtp %command%&7''' - #Edit: - # Error: '&cError! &7Invalid input provided!' - # Set: '&bSuccess! &7%type% set to %value%' - # Remove: '&cRemoved! &7You removed the Custom World %world%' +# Edit: +# Error: '&cError! &7Invalid input provided!' +# Set: '&bSuccess! &7%type% set to %value%' +# Remove: '&cRemoved! &7You removed the Custom World %world%' Help: +# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----' Main: ' &7- &e/%command% &7- 将你随机传送!' Biome: ' &7- &e/%command% biome <生物群系1, 生物群系2...> &7- 在这些指定的群系中随机传送。' - #Edit: '' +# Edit: ' &7- &e/%command% edit [args...] &7- Edit some plugin settings' Help: ' &7- &e/%command% help &7- 打开帮助菜单。' - #Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters' +# Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters' Player: ' &7- &e/%command% player <玩家> [世界] [生物群系1,生物群系2...] &7- 指定一个玩家随机传送。' Reload: ' &7- &e/%command% reload &7- 重载插件。' - #Settings: ' &7- &e/%command% settings &7- Pull up a gui and edit some settings' - #Test: ' &7- &e/%command% test &7- Test out plugin effects after a teleport without moving' - #Version: ' &7- &e/%command% version &7- View currently running version' +# Settings: ' &7- &e/%command% settings &7- Pull up a gui and edit some settings' +# Test: ' &7- &e/%command% test &7- Test out plugin effects after a teleport without moving' +# Version: ' &7- &e/%command% version &7- View currently running version' World: ' &7- &e/%command% world <世界> [生物群系1, 生物群系2...] &7- 在其他世界随机传送。' Usage: diff --git a/src/main/resources/lang/cht.yml b/src/main/resources/lang/cht.yml index c92aefd..7732af8 100644 --- a/src/main/resources/lang/cht.yml +++ b/src/main/resources/lang/cht.yml @@ -34,9 +34,10 @@ Messages: # Remove: '&cRemoved! &7You removed the Custom World %world%' Help: +# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----' Main: ' &7- &e/%command% &7- 把您隨機傳送!' Biome: ' &7- &e/%command% biome <生態域1, 生態域2...> &7- 在這些指定的生態域中隨機傳送。' -# Edit: '' +# Edit: ' &7- &e/%command% edit [args...] &7- Edit some plugin settings' Help: ' &7- &e/%command% help &7- 打開幫助菜單。' # Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters' Player: ' &7- &e/%command% player <玩家> [世界] [生態域1,生態域2...] &7- 指定一個玩家隨機傳送。' diff --git a/src/main/resources/lang/du.yml b/src/main/resources/lang/du.yml index 5c3dded..ba08fb9 100644 --- a/src/main/resources/lang/du.yml +++ b/src/main/resources/lang/du.yml @@ -33,9 +33,10 @@ Messages: # Remove: '&cRemoved! &7You removed the Custom World %world%' Help: +# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----' Main: ' &7- &e/%command% &7- Teleporteert jou naar een random locatie!' Biome: ' &7- &e/%command% biome &7- Random teleport in deze biome' -# Edit: '' +# Edit: ' &7- &e/%command% edit [args...] &7- Edit some plugin settings' Help: ' &7- &e/%command% help &7- Toont help lijst.' Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters' Player: ' &7- &e/%command% player [world] [biome1, biome2...] &7- Random teleport een andere speler' diff --git a/src/main/resources/lang/en.yml b/src/main/resources/lang/en.yml index 4f25d08..d24e2fe 100644 --- a/src/main/resources/lang/en.yml +++ b/src/main/resources/lang/en.yml @@ -34,9 +34,10 @@ Messages: Remove: '&cRemoved! &7You removed the Custom World %world%' Help: + Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----' Main: ' &7- &e/%command% &7- Randomly teleports you!' Biome: ' &7- &e/%command% biome &7- Randomly teleport withing these biomes' - #Edit: '' + Edit: ' &7- &e/%command% edit [args...] &7- Edit some plugin settings' Help: ' &7- &e/%command% help &7- Shows help list' Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters' Player: ' &7- &e/%command% player [world] [biome1, biome2...] &7- Randomly teleport another player' diff --git a/src/main/resources/lang/fr.yml b/src/main/resources/lang/fr.yml index f2b1ea9..165c2a2 100644 --- a/src/main/resources/lang/fr.yml +++ b/src/main/resources/lang/fr.yml @@ -34,9 +34,10 @@ Messages: # Remove: '&cRemoved! &7You removed the Custom World %world%' Help: +# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----' Main: ' &7- &e/%command% &7- Te téléporte aléatoirement' # Biome: ' &7- &e/%command% biome &7- Randomly teleport withing these biomes' -# Edit: '' +# Edit: ' &7- &e/%command% edit [args...] &7- Edit some plugin settings' Help: ' &7- &e/%command% help &7- Affiche l''aide' # Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters' Player: ' &7- &e/%command% player [monde] &7- Téléporte aléatoirement un autre joueur' diff --git a/src/main/resources/lang/ja.yml b/src/main/resources/lang/ja.yml index de6faf8..9b7ee38 100644 --- a/src/main/resources/lang/ja.yml +++ b/src/main/resources/lang/ja.yml @@ -34,9 +34,10 @@ Messages: # Remove: '&cRemoved! &7You removed the Custom World %world%' Help: +# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----' Main: ' &7- &e/%command% &7- あなたをランダムテレポートする!' Biome: ' &7- &e/%command% biome &7- Randomly teleport withing these biomes' -# Edit: '' +# Edit: ' &7- &e/%command% edit [args...] &7- Edit some plugin settings' Help: ' &7- &e/%command% help &7- ヘルプを見る' # Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters' Player: ' &7- &e/%command% player [world] &7- 他のプレイヤーをランダムテレポート' diff --git a/src/main/resources/lang/ru.yml b/src/main/resources/lang/ru.yml index 737c0a4..11aab20 100644 --- a/src/main/resources/lang/ru.yml +++ b/src/main/resources/lang/ru.yml @@ -34,8 +34,10 @@ Messages: # Remove: '&cRemoved! &7You removed the Custom World %world%' Help: +# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----' Main: ' &7- &e/%command% &7- случайно телепортирует вас!' # Biome: ' &7- &e/%command% biome &7- Randomly teleport withing these biomes' +# Edit: ' &7- &e/%command% edit [args...] &7- Edit some plugin settings' Help: ' &7- &e/%command% help &7- показывает этот список' # Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters' Player: ' &7- &e/%command% player <игрок> [мир] &7- случайно телепортирует игрока'