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,6 +92,10 @@ public class Commands {
|
||||
if (sendi instanceof Player)
|
||||
tp((Player) sendi, sendi, world, biomes);
|
||||
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'"));
|
||||
}
|
||||
|
||||
|
@ -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,12 +16,13 @@ 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.isDebugOnly() || Main.getInstance().getSettings().debug)
|
||||
if (cmd.getCmd().permission(sendi))
|
||||
if (cmd.getCmd() instanceof RTPCommandHelpable) {
|
||||
String help = ((RTPCommandHelpable) cmd.getCmd()).getHelp();
|
||||
System.out.println(help);
|
||||
list.add(help);
|
||||
}
|
||||
for (int i = 0; i < list.size(); i++)
|
||||
|
@ -12,7 +12,10 @@ import java.util.List;
|
||||
public class CmdSettings implements RTPCommand, RTPCommandHelpable {
|
||||
|
||||
public void execute(CommandSender sendi, String label, String[] args) {
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -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- 指定一个玩家随机传送。'
|
||||
|
@ -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