mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 09:05:47 +00:00
edit command re-enabled + help command prefix
This commit is contained in:
parent
1f2a4b5b01
commit
2fc9c7e94a
@ -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());
|
||||
|
@ -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
|
||||
|
@ -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<Object, Object> values = (Map<Object, Object>) 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();
|
||||
}
|
||||
|
@ -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<String> 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);
|
||||
|
@ -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<String> tabComplete(CommandSender sendi, String[] args) {
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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 <default/world> [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:
|
||||
|
@ -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 <default/world> [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- 指定一個玩家隨機傳送。'
|
||||
|
@ -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 <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.'
|
||||
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'
|
||||
|
@ -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 <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'
|
||||
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'
|
||||
|
@ -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 <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'
|
||||
# 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'
|
||||
|
@ -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 <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- ヘルプを見る'
|
||||
# Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters'
|
||||
Player: ' &7- &e/%command% player <player> [world] &7- 他のプレイヤーをランダムテレポート'
|
||||
|
@ -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 <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- показывает этот список'
|
||||
# Info: ' &7- &e/%command% info [arg] &7- View specific information about plugin parameters'
|
||||
Player: ' &7- &e/%command% player <игрок> [мир] &7- случайно телепортирует игрока'
|
||||
|
Loading…
x
Reference in New Issue
Block a user