edit command re-enabled + help command prefix

This commit is contained in:
SuperRonanCraft 2020-09-24 20:51:09 -04:00
parent 1f2a4b5b01
commit 2fc9c7e94a
13 changed files with 68 additions and 35 deletions

View File

@ -9,7 +9,7 @@ public enum CommandTypes {
INFO(new CmdInfo()), INFO(new CmdInfo()),
PLAYER(new CmdPlayer()), PLAYER(new CmdPlayer()),
RELOAD(new CmdReload()), RELOAD(new CmdReload()),
SETTINGS(new CmdSettings(), true), //SETTINGS(new CmdSettings(), true),
TEST(new CmdTest(), true), TEST(new CmdTest(), true),
VERSION(new CmdVersion()), VERSION(new CmdVersion()),
WORLD(new CmdWorld()); WORLD(new CmdWorld());

View File

@ -1,12 +1,11 @@
package me.SuperRonanCraft.BetterRTP.player.commands; package me.SuperRonanCraft.BetterRTP.player.commands;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPCooldown; import me.SuperRonanCraft.BetterRTP.player.rtp.RTPCooldown;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics; import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -93,6 +92,10 @@ public class Commands {
if (sendi instanceof Player) if (sendi instanceof Player)
tp((Player) sendi, sendi, world, biomes); tp((Player) sendi, sendi, world, biomes);
else else
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'")); sendi.sendMessage(pl.getText().colorPre("Must be a player to use this command! Try '/" + cmd + " help'"));
} }

View File

@ -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) { private void editWorld(CommandSender sendi, RTP_CMD_EDIT_SUB cmd, String val, String world) {
Object value = val; Object value;
try { try {
value = cmd.getResult(val); value = cmd.getResult(val);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Main.getInstance().getText().sms(sendi, "Invalid input!"); Main.getInstance().getText().getEditError(sendi);
return; return;
} }
@ -79,7 +79,8 @@ public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds
for (Object map2 : m.values()) { for (Object map2 : m.values()) {
Map<Object, Object> values = (Map<Object, Object>) map2; Map<Object, Object> values = (Map<Object, Object>) map2;
values.put(cmd.get(), value); values.put(cmd.get(), value);
Main.getInstance().getText().sms(sendi, cmd.get() + " set to " + value);
Main.getInstance().getText().getEditSet(sendi, cmd.get(), val);
} }
break; break;
} }
@ -108,7 +109,7 @@ public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds
value = cmd.getResult(val); value = cmd.getResult(val);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Main.getInstance().getText().sms(sendi, "Invalid input!"); Main.getInstance().getText().getEditError(sendi);
return; return;
} }
@ -120,6 +121,7 @@ public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds
try { try {
config.save(file.getFile()); config.save(file.getFile());
Main.getInstance().getRTP().loadWorldSettings(); Main.getInstance().getRTP().loadWorldSettings();
Main.getInstance().getText().getEditSet(sendi, cmd.get(), val);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -16,12 +16,13 @@ public class CmdHelp implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
Messages txt = Main.getInstance().getText(); Messages txt = Main.getInstance().getText();
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
list.add(txt.getHelpPrefix());
list.add(txt.getHelpMain()); list.add(txt.getHelpMain());
for (CommandTypes cmd : CommandTypes.values()) for (CommandTypes cmd : CommandTypes.values())
if (!cmd.isDebugOnly() || Main.getInstance().getSettings().debug)
if (cmd.getCmd().permission(sendi)) if (cmd.getCmd().permission(sendi))
if (cmd.getCmd() instanceof RTPCommandHelpable) { if (cmd.getCmd() instanceof RTPCommandHelpable) {
String help = ((RTPCommandHelpable) cmd.getCmd()).getHelp(); String help = ((RTPCommandHelpable) cmd.getCmd()).getHelp();
System.out.println(help);
list.add(help); list.add(help);
} }
for (int i = 0; i < list.size(); i++) for (int i = 0; i < list.size(); i++)

View File

@ -12,7 +12,10 @@ import java.util.List;
public class CmdSettings implements RTPCommand, RTPCommandHelpable { public class CmdSettings implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
if (sendi instanceof Player)
Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show((Player) sendi); Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show((Player) sendi);
else
Main.getInstance().getCmd().msgNotPlayer(sendi, label);
} }
public List<String> tabComplete(CommandSender sendi, String[] args) { public List<String> tabComplete(CommandSender sendi, String[] args) {

View File

@ -139,7 +139,24 @@ public class Messages {
return color(getPrefix() + str); 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 //Help
public String getHelpPrefix() {
return getLang().getString(preH + "Prefix");
}
public String getHelpMain() { //rtp public String getHelpMain() { //rtp
return getLang().getString(preH + "Main"); return getLang().getString(preH + "Main");
} }
@ -149,8 +166,7 @@ public class Messages {
} }
public String getHelpEdit() { //rtp edit public String getHelpEdit() { //rtp edit
return ""; return getLang().getString(preH + "Edit");
//return getLang().getString(preH + "Edit");
} }
public String getHelpHelp() { //rtp help public String getHelpHelp() { //rtp help
@ -165,7 +181,7 @@ public class Messages {
return getLang().getString(preH + "Player"); return getLang().getString(preH + "Player");
} }
public String getHelpReload() { //rtp reload public String getHelpReload() {
return getLang().getString(preH + "Reload"); return getLang().getString(preH + "Reload");
} }

View File

@ -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! # 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次' 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次' Bypass: '&a你被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次'
#Loading: '&aSafe spot located! &7Loading chunks...' # Loading: '&aSafe spot located! &7Loading chunks...'
#Teleport: '&aTeleporting... &fplease wait while we find a safe location!' # Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed: Failed:
Price: '&c你的钱不够了&7你至少要有$%price%&7才能随机传送' Price: '&c你的钱不够了&7你至少要有$%price%&7才能随机传送'
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&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: Other:
Success: '&a%player%被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次' Success: '&a%player%被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次'
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7%player%未被传送!' NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7%player%未被传送!'
@ -28,22 +28,23 @@ Messages:
NotExist: '&c看上去&7%world%&c世界并不存在' NotExist: '&c看上去&7%world%&c世界并不存在'
Already: '&c啊嘞嘞&7看上去你已经在随机传送中了请耐心点' Already: '&c啊嘞嘞&7看上去你已经在随机传送中了请耐心点'
Sign: '&7命令标记已被创建&7命令为''&f/rtp %command%&7''' Sign: '&7命令标记已被创建&7命令为''&f/rtp %command%&7'''
#Edit: # Edit:
# Error: '&cError! &7Invalid input provided!' # Error: '&cError! &7Invalid input provided!'
# Set: '&bSuccess! &7%type% set to %value%' # Set: '&bSuccess! &7%type% set to %value%'
# Remove: '&cRemoved! &7You removed the Custom World %world%' # Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----'
Main: ' &7- &e/%command% &7- 将你随机传送!' Main: ' &7- &e/%command% &7- 将你随机传送!'
Biome: ' &7- &e/%command% biome <生物群系1, 生物群系2...> &7- 在这些指定的群系中随机传送。' Biome: ' &7- &e/%command% biome <生物群系1, 生物群系2...> &7- 在这些指定的群系中随机传送。'
#Edit: '' # Edit: ' &7- &e/%command% edit <default/world> [args...] &7- Edit some plugin settings'
Help: ' &7- &e/%command% help &7- 打开帮助菜单。' 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- 指定一个玩家随机传送。' Player: ' &7- &e/%command% player <玩家> [世界] [生物群系1生物群系2...] &7- 指定一个玩家随机传送。'
Reload: ' &7- &e/%command% reload &7- 重载插件。' Reload: ' &7- &e/%command% reload &7- 重载插件。'
#Settings: ' &7- &e/%command% settings &7- Pull up a gui and edit some settings' # 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' # 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' # Version: ' &7- &e/%command% version &7- View currently running version'
World: ' &7- &e/%command% world <世界> [生物群系1, 生物群系2...] &7- 在其他世界随机传送。' World: ' &7- &e/%command% world <世界> [生物群系1, 生物群系2...] &7- 在其他世界随机传送。'
Usage: Usage:

View File

@ -34,9 +34,10 @@ Messages:
# Remove: '&cRemoved! &7You removed the Custom World %world%' # Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----'
Main: ' &7- &e/%command% &7- 把您隨機傳送!' Main: ' &7- &e/%command% &7- 把您隨機傳送!'
Biome: ' &7- &e/%command% biome <生態域1, 生態域2...> &7- 在這些指定的生態域中隨機傳送。' Biome: ' &7- &e/%command% biome <生態域1, 生態域2...> &7- 在這些指定的生態域中隨機傳送。'
# Edit: '' # Edit: ' &7- &e/%command% edit <default/world> [args...] &7- Edit some plugin settings'
Help: ' &7- &e/%command% help &7- 打開幫助菜單。' 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- 指定一個玩家隨機傳送。' Player: ' &7- &e/%command% player <玩家> [世界] [生態域1生態域2...] &7- 指定一個玩家隨機傳送。'

View File

@ -33,9 +33,10 @@ Messages:
# Remove: '&cRemoved! &7You removed the Custom World %world%' # Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----'
Main: ' &7- &e/%command% &7- Teleporteert jou naar een random locatie!' Main: ' &7- &e/%command% &7- Teleporteert jou naar een random locatie!'
Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Random teleport in deze biome' Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Random teleport in deze biome'
# Edit: '' # Edit: ' &7- &e/%command% edit <default/world> [args...] &7- Edit some plugin settings'
Help: ' &7- &e/%command% help &7- Toont help lijst.' Help: ' &7- &e/%command% help &7- Toont help lijst.'
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 <player> [world] [biome1, biome2...] &7- Random teleport een andere speler' Player: ' &7- &e/%command% player <player> [world] [biome1, biome2...] &7- Random teleport een andere speler'

View File

@ -34,9 +34,10 @@ Messages:
Remove: '&cRemoved! &7You removed the Custom World %world%' Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----'
Main: ' &7- &e/%command% &7- Randomly teleports you!' Main: ' &7- &e/%command% &7- Randomly teleports you!'
Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes' Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
#Edit: '' Edit: ' &7- &e/%command% edit <default/world> [args...] &7- Edit some plugin settings'
Help: ' &7- &e/%command% help &7- Shows help list' Help: ' &7- &e/%command% help &7- Shows help list'
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 <player> [world] [biome1, biome2...] &7- Randomly teleport another player' Player: ' &7- &e/%command% player <player> [world] [biome1, biome2...] &7- Randomly teleport another player'

View File

@ -34,9 +34,10 @@ Messages:
# Remove: '&cRemoved! &7You removed the Custom World %world%' # Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----'
Main: ' &7- &e/%command% &7- Te téléporte aléatoirement' Main: ' &7- &e/%command% &7- Te téléporte aléatoirement'
# Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes' # Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
# Edit: '' # Edit: ' &7- &e/%command% edit <default/world> [args...] &7- Edit some plugin settings'
Help: ' &7- &e/%command% help &7- Affiche l''aide' Help: ' &7- &e/%command% help &7- Affiche l''aide'
# 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 <joueur> [monde] &7- Téléporte aléatoirement un autre joueur' Player: ' &7- &e/%command% player <joueur> [monde] &7- Téléporte aléatoirement un autre joueur'

View File

@ -34,9 +34,10 @@ Messages:
# Remove: '&cRemoved! &7You removed the Custom World %world%' # Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----'
Main: ' &7- &e/%command% &7- あなたをランダムテレポートする!' Main: ' &7- &e/%command% &7- あなたをランダムテレポートする!'
Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes' Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
# Edit: '' # Edit: ' &7- &e/%command% edit <default/world> [args...] &7- Edit some plugin settings'
Help: ' &7- &e/%command% help &7- ヘルプを見る' 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 <player> [world] &7- 他のプレイヤーをランダムテレポート' Player: ' &7- &e/%command% player <player> [world] &7- 他のプレイヤーをランダムテレポート'

View File

@ -34,8 +34,10 @@ Messages:
# Remove: '&cRemoved! &7You removed the Custom World %world%' # Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
# Prefix: '&e&m-----&6&l BetterRTP &8| Help &e&m-----'
Main: ' &7- &e/%command% &7- случайно телепортирует вас!' Main: ' &7- &e/%command% &7- случайно телепортирует вас!'
# Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes' # Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
# Edit: ' &7- &e/%command% edit <default/world> [args...] &7- Edit some plugin settings'
Help: ' &7- &e/%command% help &7- показывает этот список' 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 <игрок> [мир] &7- случайно телепортирует игрока' Player: ' &7- &e/%command% player <игрок> [мир] &7- случайно телепортирует игрока'