command help messages revamp + rtp titles enumed

This commit is contained in:
SuperRonanCraft 2020-09-24 18:01:48 -04:00
parent c5d7705d54
commit 1f2a4b5b01
24 changed files with 352 additions and 237 deletions

View File

@ -4,15 +4,15 @@ import me.SuperRonanCraft.BetterRTP.player.commands.types.*;
public enum CommandTypes { public enum CommandTypes {
BIOME(new CmdBiome()), BIOME(new CmdBiome()),
EDIT(new CmdEdit()),
HELP(new CmdHelp()), HELP(new CmdHelp()),
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),
VERSION(new CmdVersion()), VERSION(new CmdVersion()),
WORLD(new CmdWorld()), WORLD(new CmdWorld());
EDIT(new CmdEdit()),
TEST(new CmdTest(), true); //Only gets added if debugger enabled
private final RTPCommand cmd; private final RTPCommand cmd;
private boolean debugOnly = false; private boolean debugOnly = false;

View File

@ -0,0 +1,6 @@
package me.SuperRonanCraft.BetterRTP.player.commands;
public interface RTPCommandHelpable {
String getHelp();
}

View File

@ -3,12 +3,13 @@ package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.player.commands.Commands; import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CmdBiome implements RTPCommand { public class CmdBiome implements RTPCommand, RTPCommandHelpable {
//rtp biome <biome1, biome2...> //rtp biome <biome1, biome2...>
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
@ -36,4 +37,9 @@ public class CmdBiome implements RTPCommand {
private Commands getCmd() { private Commands getCmd() {
return Main.getInstance().getCmd(); return Main.getInstance().getCmd();
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpBiome();
}
} }

View File

@ -2,6 +2,7 @@ package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics; import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
@ -11,7 +12,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
public class CmdEdit implements RTPCommand { //Edit a worlds properties public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds properties
@Override @Override
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
@ -181,6 +182,11 @@ public class CmdEdit implements RTPCommand { //Edit a worlds properties
Main.getInstance().getText().getUsageEdit(sendi, label); Main.getInstance().getText().getUsageEdit(sendi, label);
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpEdit();
}
enum RTP_CMD_EDIT { enum RTP_CMD_EDIT {
WORLD, DEFAULT WORLD, DEFAULT
} }

View File

@ -1,26 +1,41 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types; package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import me.SuperRonanCraft.BetterRTP.references.file.Messages;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CmdHelp implements RTPCommand { public class CmdHelp implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
Main pl = Main.getInstance(); Messages txt = Main.getInstance().getText();
pl.getText().getHelpList(sendi, label); List<String> list = new ArrayList<>();
if (pl.getPerms().getRtpOther(sendi)) list.add(txt.getHelpMain());
pl.getText().getHelpPlayer(sendi, label); for (CommandTypes cmd : CommandTypes.values())
if (sendi instanceof Player) { if (cmd.getCmd().permission(sendi))
if (pl.getPerms().getWorld(sendi)) if (cmd.getCmd() instanceof RTPCommandHelpable) {
pl.getText().getHelpWorld(sendi, label); String help = ((RTPCommandHelpable) cmd.getCmd()).getHelp();
} else System.out.println(help);
pl.getText().getHelpWorld(sendi, label); list.add(help);
if (pl.getPerms().getReload(sendi)) }
pl.getText().getHelpReload(sendi, label); for (int i = 0; i < list.size(); i++)
list.set(i, list.get(i).replace("%command%", label));
Main.getInstance().getText().sms(sendi, list);
// if (pl.getPerms().getRtpOther(sendi))
// pl.getText().getHelpPlayer(sendi, label);
// if (sendi instanceof Player) {
// if (pl.getPerms().getWorld(sendi))
// pl.getText().getHelpWorld(sendi, label);
// } else
// pl.getText().getHelpWorld(sendi, label);
// if (pl.getPerms().getReload(sendi))
// pl.getText().getHelpReload(sendi, label);
//if (pl.getPerms().getInfo(sendi)) //if (pl.getPerms().getInfo(sendi))
// pl.getText().getHelpInfo(sendi); // pl.getText().getHelpInfo(sendi);
} }
@ -33,4 +48,9 @@ public class CmdHelp implements RTPCommand {
public boolean permission(CommandSender sendi) { public boolean permission(CommandSender sendi) {
return true; return true;
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpHelp();
}
} }

View File

@ -1,6 +1,7 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types; package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPParticles; import me.SuperRonanCraft.BetterRTP.player.rtp.RTPParticles;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.references.worlds.RTPWorld; import me.SuperRonanCraft.BetterRTP.references.worlds.RTPWorld;
@ -17,7 +18,7 @@ import xyz.xenondevs.particle.ParticleEffect;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CmdInfo implements RTPCommand { public class CmdInfo implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
if (args.length > 1) { if (args.length > 1) {
@ -48,6 +49,11 @@ public class CmdInfo implements RTPCommand {
infoWorld(sendi); infoWorld(sendi);
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpInfo();
}
enum CmdInfoSub { //Sub commands, future expansions enum CmdInfoSub { //Sub commands, future expansions
PARTICLES, SHAPES, POTION_EFFECTS, WORLD PARTICLES, SHAPES, POTION_EFFECTS, WORLD
} }

View File

@ -4,6 +4,7 @@ import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes; import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes;
import me.SuperRonanCraft.BetterRTP.player.commands.Commands; import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -12,7 +13,7 @@ import org.bukkit.entity.Player;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CmdPlayer implements RTPCommand { public class CmdPlayer implements RTPCommand, RTPCommandHelpable {
//rtp player <world> <biome1> <biome2...> //rtp player <world> <biome1> <biome2...>
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
@ -62,4 +63,9 @@ public class CmdPlayer implements RTPCommand {
private Commands getCmd() { private Commands getCmd() {
return Main.getInstance().getCmd(); return Main.getInstance().getCmd();
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpPlayer();
}
} }

View File

@ -2,11 +2,12 @@ package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import java.util.List; import java.util.List;
public class CmdReload implements RTPCommand { public class CmdReload implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
Main.getInstance().reload(sendi); Main.getInstance().reload(sendi);
@ -19,4 +20,9 @@ public class CmdReload implements RTPCommand {
public boolean permission(CommandSender sendi) { public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getReload(sendi); return Main.getInstance().getPerms().getReload(sendi);
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpReload();
}
} }

View File

@ -1,5 +1,6 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types; package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS; import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
@ -8,7 +9,7 @@ import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
public class CmdSettings implements RTPCommand { public class CmdSettings implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show((Player) sendi); Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show((Player) sendi);
@ -21,4 +22,9 @@ public class CmdSettings implements RTPCommand {
public boolean permission(CommandSender sendi) { public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getSettings(sendi); return Main.getInstance().getPerms().getSettings(sendi);
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpSettings();
}
} }

View File

@ -2,13 +2,14 @@ package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.List; import java.util.List;
//Meant to just test particles and effects without actually rtp'ing around the world //Meant to just test particles and effects without actually rtp'ing around the world
public class CmdTest implements RTPCommand { public class CmdTest implements RTPCommand, RTPCommandHelpable {
@Override @Override
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
@ -29,4 +30,9 @@ public class CmdTest implements RTPCommand {
return Main.getInstance().getPerms().getTest(sendi); return Main.getInstance().getPerms().getTest(sendi);
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpTest();
}
} }

View File

@ -2,11 +2,12 @@ package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import java.util.List; import java.util.List;
public class CmdVersion implements RTPCommand { public class CmdVersion implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
sendi.sendMessage(Main.getInstance().getText().colorPre("&aVersion #&e" + Main.getInstance().getDescription().getVersion())); sendi.sendMessage(Main.getInstance().getText().colorPre("&aVersion #&e" + Main.getInstance().getDescription().getVersion()));
@ -19,4 +20,9 @@ public class CmdVersion implements RTPCommand {
public boolean permission(CommandSender sendi) { public boolean permission(CommandSender sendi) {
return true; return true;
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpVersion();
}
} }

View File

@ -4,6 +4,7 @@ import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes; import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes;
import me.SuperRonanCraft.BetterRTP.player.commands.Commands; import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand; import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -11,7 +12,7 @@ import org.bukkit.command.CommandSender;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
public class CmdWorld implements RTPCommand { public class CmdWorld implements RTPCommand, RTPCommandHelpable {
//rtp world <world> <biome1, biome2...> //rtp world <world> <biome1, biome2...>
public void execute(CommandSender sendi, String label, String[] args) { public void execute(CommandSender sendi, String label, String[] args) {
@ -46,4 +47,9 @@ public class CmdWorld implements RTPCommand {
private Commands getCmd() { private Commands getCmd() {
return Main.getInstance().getCmd(); return Main.getInstance().getCmd();
} }
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpWorld();
}
} }

View File

@ -74,27 +74,27 @@ public class RTPTeleport {
eSounds.playTeleport(p); eSounds.playTeleport(p);
eParticles.display(p); eParticles.display(p);
ePotions.giveEffects(p); ePotions.giveEffects(p);
eTitles.showTeleport(p, loc, attempts); eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.TELEPORT, p, loc, attempts, 0);
if (eTitles.sendMsgTeleport()) if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.TELEPORT))
sendSuccessMsg(p, p.getDisplayName(), loc, price, true, attempts); sendSuccessMsg(p, p.getDisplayName(), loc, price, true, attempts);
} }
public void beforeTeleport(Player p, int delay) { //Only Delays should call this public void beforeTeleport(Player p, int delay) { //Only Delays should call this
eSounds.playDelay(p); eSounds.playDelay(p);
eTitles.showDelay(p, p.getLocation(), delay); eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.DELAY, p, p.getLocation(), 0, delay);
if (eTitles.sendMsgDelay()) if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.DELAY))
getPl().getText().getDelay(p, delay); getPl().getText().getDelay(p, delay);
} }
public void cancelledTeleport(Player p) { //Only Delays should call this public void cancelledTeleport(Player p) { //Only Delays should call this
eTitles.showCancelled(p, p.getLocation()); eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.CANCEL, p, p.getLocation(), 0, 0);
if (eTitles.sendMsgCancelled()) if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.CANCEL))
getPl().getText().getMoved(p); getPl().getText().getMoved(p);
} }
private void loadingTeleport(Player p, CommandSender sendi) { private void loadingTeleport(Player p, CommandSender sendi) {
eTitles.showLoading(p, p.getLocation()); eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.LOADING, p, p.getLocation(), 0, 0);
if (eTitles.sendMsgLoading() || sendi != p) //Show msg if enabled or if not same player if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.LOADING) || sendi != p) //Show msg if enabled or if not same player
getPl().getText().getSuccessLoading(sendi); getPl().getText().getSuccessLoading(sendi);
} }

View File

@ -2,91 +2,35 @@ package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.Main; import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics; import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.HashMap;
public class RTPTitles { public class RTPTitles {
private boolean enabled; private final HashMap<RTP_TITLE_TYPE, RTP_TITLE> titles = new HashMap<>();
private String
titleTeleport,
titleDelay,
titleCancel,
titleLoading,
subTeleport,
subDelay,
subCancel,
subLoading;
private boolean //Disable default messages in chat
showMsgTeleport,
showMsgDelay,
showMsgCancel,
showMsgLoading;
void load() { void load() {
titles.clear();
FileBasics.FILETYPE config = FileBasics.FILETYPE.EFFECTS; FileBasics.FILETYPE config = FileBasics.FILETYPE.EFFECTS;
enabled = config.getBoolean("Titles.Enabled"); boolean enabled = config.getBoolean("Titles.Enabled");
if (enabled) { if (enabled)
//Titles for (RTP_TITLE_TYPE type : RTP_TITLE_TYPE.values())
titleTeleport = config.getString("Titles.Teleport.Title"); titles.put(type, new RTP_TITLE(type.path));
titleDelay = config.getString("Titles.Delay.Title");
titleCancel = config.getString("Titles.Cancelled.Title");
titleLoading = config.getString("Titles.Loading.Title");
//Sub titles
subTeleport = config.getString("Titles.Teleport.Subtitle");
subDelay = config.getString("Titles.Delay.Subtitle");
subCancel = config.getString("Titles.Cancelled.Subtitle");
subLoading = config.getString("Titles.Loading.Subtitle");
//Messages
showMsgTeleport = config.getBoolean("Titles.Teleport.SendMessage");
showMsgDelay = config.getBoolean("Titles.Delay.SendMessage");
showMsgCancel = config.getBoolean("Titles.Cancelled.SendMessage");
showMsgLoading = config.getBoolean("Titles.Loading.SendMessage");
}
} }
void showTeleport(Player p, Location loc, int attempts) { void showTitle(RTP_TITLE_TYPE type, Player p, Location loc, int attempts, int delay) {
if (!enabled) return; if (titles.containsKey(type)) {
String title = getPlaceholders(titleTeleport, p, loc, attempts, 0); String title = getPlaceholders(titles.get(type).title, p, loc, attempts, delay);
String sub = getPlaceholders(subTeleport, p, loc, attempts, 0); String sub = getPlaceholders(titles.get(type).subTitle, p, loc, attempts, delay);
show(p, title, sub); show(p, title, sub);
} }
void showDelay(Player p, Location loc, int delay) {
if (!enabled) return;
String title = getPlaceholders(titleDelay, p, loc, 0, delay);
String sub = getPlaceholders(subDelay, p, loc, 0, delay);
show(p, title, sub);
} }
void showCancelled(Player p, Location loc) { boolean sendMsg(RTP_TITLE_TYPE type) {
if (!enabled) return; return titles.containsKey(type) && titles.get(type).send_message;
String title = getPlaceholders(titleCancel, p, loc, 0, 0);
String sub = getPlaceholders(subCancel, p, loc, 0, 0);
show(p, title, sub);
}
void showLoading(Player p, Location loc) {
if (!enabled) return;
String title = getPlaceholders(titleLoading, p, loc, 0, 0);
String sub = getPlaceholders(subLoading, p, loc, 0, 0);
show(p, title, sub);
}
boolean sendMsgTeleport() {
return !enabled || showMsgTeleport;
}
boolean sendMsgDelay() {
return !enabled || showMsgDelay;
}
boolean sendMsgCancelled() {
return !enabled || showMsgCancel;
}
boolean sendMsgLoading() {
return !enabled || showMsgLoading;
} }
private String getPlaceholders(String str, Player p, Location loc, int attempts, int delay) { private String getPlaceholders(String str, Player p, Location loc, int attempts, int delay) {
@ -107,4 +51,25 @@ public class RTPTitles {
p.sendTitle(title, sub); p.sendTitle(title, sub);
// player.sendTitle(title, subTitle, fadeIn, stay, fadeOut); // player.sendTitle(title, subTitle, fadeIn, stay, fadeOut);
} }
enum RTP_TITLE_TYPE {
TELEPORT("Teleport"), DELAY("Delay"), CANCEL("Cancelled"), LOADING("Loading");
String path;
RTP_TITLE_TYPE(String path) {
this.path = path;
}
}
private static class RTP_TITLE {
String title, subTitle;
boolean send_message;
RTP_TITLE(String path) {
FileBasics.FILETYPE config = FileBasics.FILETYPE.EFFECTS;
title = config.getString("Titles." + path + ".Title");
subTitle = config.getString("Titles." + path + ".Subtitle");
send_message = config.getBoolean("Titles." + path + ".SendMessage");
}
}
} }

View File

@ -6,6 +6,9 @@ import org.bukkit.ChatColor;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import java.util.Arrays;
import java.util.List;
public class Messages { public class Messages {
private final String preM = "Messages.", preH = "Help.", preU = "Usage."; private final String preM = "Messages.", preH = "Help.", preU = "Usage.";
@ -18,6 +21,14 @@ public class Messages {
sendi.sendMessage(colorPre(msg)); sendi.sendMessage(colorPre(msg));
} }
public void sms(CommandSender sendi, List<String> msg) {
if (msg != null && !msg.isEmpty()) {
msg.forEach(str ->
msg.set(msg.indexOf(str), color(str)));
sendi.sendMessage(msg.toArray(new String[0]));
}
}
//SUCCESS //SUCCESS
public void getSuccessPaid(CommandSender sendi, int price, String x, String y, String z, String world, int public void getSuccessPaid(CommandSender sendi, int price, String x, String y, String z, String world, int
attempts) { attempts) {
@ -129,21 +140,49 @@ public class Messages {
} }
//Help //Help
public void getHelpList(CommandSender sendi, String cmd) { public String getHelpMain() { //rtp
for (String s : getLang().getStringList(preH + "List")) return getLang().getString(preH + "Main");
sms(sendi, s.replaceAll("%command%", cmd));
} }
public void getHelpPlayer(CommandSender sendi, String cmd) { public String getHelpBiome() { //rtp biome
sms(sendi, getLang().getString(preH + "Player").replaceAll("%command%", cmd)); return getLang().getString(preH + "Biome");
} }
public void getHelpWorld(CommandSender sendi, String cmd) { public String getHelpEdit() { //rtp edit
sms(sendi, getLang().getString(preH + "World").replaceAll("%command%", cmd)); return "";
//return getLang().getString(preH + "Edit");
} }
public void getHelpReload(CommandSender sendi, String cmd) { public String getHelpHelp() { //rtp help
sms(sendi, getLang().getString(preH + "Reload").replaceAll("%command%", cmd)); return getLang().getString(preH + "Help");
}
public String getHelpInfo() { //rtp info
return getLang().getString(preH + "Info");
}
public String getHelpPlayer() { //rtp player
return getLang().getString(preH + "Player");
}
public String getHelpReload() { //rtp reload
return getLang().getString(preH + "Reload");
}
public String getHelpSettings() { //rtp settings
return getLang().getString(preH + "Settings");
}
public String getHelpTest() { //rtp test
return getLang().getString(preH + "Test");
}
public String getHelpVersion() { //rtp version
return getLang().getString(preH + "Version");
}
public String getHelpWorld() { //rtp world
return getLang().getString(preH + "World");
} }
//Usage //Usage

View File

@ -101,7 +101,7 @@ WorldType: # Available types are NORMAL, NETHER
PermissionGroup: #Player requires "betterrtp.group.<world_name>" to trigger these configs PermissionGroup: #Player requires "betterrtp.group.<world_name>" to trigger these configs
Enabled: false Enabled: false
Groups: Groups:
- vip: #betterrtp.config.vip - vip: # permission: betterrtp.config.vip
- Build_World: #World named "Build_World" - Build_World: #World named "Build_World"
MaxRadius: 10000 MaxRadius: 10000
MinRadius: 1000 MinRadius: 1000
@ -113,7 +113,7 @@ PermissionGroup: #Player requires "betterrtp.group.<world_name>" to trigger thes
CenterX: 10 CenterX: 10
CenterZ: 10 CenterZ: 10
Price: 10 Price: 10
- vip2: - vip2: # permission: betterrtp.config.vip2
- Build_World: - Build_World:
MaxRadius: 25000 MaxRadius: 25000
MinRadius: 10000 MinRadius: 10000

View File

@ -3,7 +3,7 @@
</p> </p>
## Wheres the Wiki? ## Wheres the Wiki?
The wiki is available [here](../../wiki)! The wiki is available [here](https://github.com/SuperRonanCraft/BetterRTP/wiki)!
## Want to Contribute translating? ## Want to Contribute translating?
Fork one of the language files above and help translate! Fork one of the language files above and help translate!

View File

@ -28,18 +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:
# Error: '&cError! &7Invalid input provided!'
# Set: '&bSuccess! &7%type% set to %value%'
# Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
List: Main: ' &7- &e/%command% &7- 将你随机传送!'
- '&e&m------&r &6&lBetterRTP &8| &7帮助菜单 &e&m------'
- ' &7- &e/%command% &7- 将你随机传送!'
- ' &7- &e/%command% help &7- 打开帮助菜单。'
##If the player has permission to rtp another player, this message will be added under the list!
Player: ' &7- &e/%command% player <玩家> [世界] [生物群系1生物群系2...] &7- 指定一个玩家随机传送。'
World: ' &7- &e/%command% world <世界> [生物群系1, 生物群系2...] &7- 在其他世界随机传送。'
##If the player has permission to reload the plugin this message will be added under the list!
Biome: ' &7- &e/%command% biome <生物群系1, 生物群系2...> &7- 在这些指定的群系中随机传送。' Biome: ' &7- &e/%command% biome <生物群系1, 生物群系2...> &7- 在这些指定的群系中随机传送。'
#Edit: ''
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- 指定一个玩家随机传送。'
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'
#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: Usage:
Player: '&cUsage&7: /%command% player <玩家> [世界] [生物群系1, 生物群系2]' Player: '&cUsage&7: /%command% player <玩家> [世界] [生物群系1, 生物群系2]'

View File

@ -28,18 +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:
# Error: '&cError! &7Invalid input provided!'
# Set: '&bSuccess! &7%type% set to %value%'
# Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
List: Main: ' &7- &e/%command% &7- 把您隨機傳送!'
- '&e&m------&r &6&lBetterRTP &8| &7幫助菜單 &e&m------'
- ' &7- &e/%command% &7- 把您隨機傳送!'
- ' &7- &e/%command% help &7- 打開幫助菜單。'
## 如果有權限隨機傳送其他玩家,這個訊息將會顯示在幫助菜單中!
Player: ' &7- &e/%command% player <玩家> [世界] [生態域1生態域2...] &7- 指定一個玩家隨機傳送。'
World: ' &7- &e/%command% world <世界> [生態域1, 生態域2...] &7- 在其他世界隨機傳送。'
## 如果有權限重新讀取插件設定,這個訊息將會顯示在幫助菜單中!
Biome: ' &7- &e/%command% biome <生態域1, 生態域2...> &7- 在這些指定的生態域中隨機傳送。' Biome: ' &7- &e/%command% biome <生態域1, 生態域2...> &7- 在這些指定的生態域中隨機傳送。'
# Edit: ''
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- 指定一個玩家隨機傳送。'
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'
# 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: Usage:
Player: '&cUsage&7: /%command% player <玩家> [世界] [生態域1, 生態域2]' Player: '&cUsage&7: /%command% player <玩家> [世界] [生態域1, 生態域2]'

View File

@ -27,18 +27,23 @@ Messages:
NotExist: '&cLijkt dat de wereld &7%world% &cniet bestaat!' NotExist: '&cLijkt dat de wereld &7%world% &cniet bestaat!'
Already: '&cOepsie! &7Het lijkt erop dat je al aan het rtpen bent, heb wat geduld!' Already: '&cOepsie! &7Het lijkt erop dat je al aan het rtpen bent, heb wat geduld!'
Sign: '&7Commando bordje is aangemaakt! &7Commando is... ''&f/rtp %command%&7''' Sign: '&7Commando bordje is aangemaakt! &7Commando is... ''&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%'
Help: Help:
List: Main: ' &7- &e/%command% &7- Teleporteert jou naar een random locatie!'
- '&e&m------&r &6&lBetterRTP &8| &7Help &e&m------'
- ' &7- &e/%command% &7- Teleporteert jou naar een random locatie!'
- ' &7- &e/%command% help &7- Toont help lijst.'
##If the player has permission to rtp another player, this message will be added under the list!
Player: ' &7- &e/%command% player <player> [world] [biome1, biome2...] &7- Random teleport een andere speler'
World: ' &7- &e/%command% world <world> [biome1, biome2...] &7- Random teleport in een andere wereld'
##If the player has permission to reload the plugin this message will be added under the list!
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: ''
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'
Reload: ' &7- &e/%command% reload &7- Herlaad de plugin' Reload: ' &7- &e/%command% reload &7- Herlaad de plugin'
# 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 <world> [biome1, biome2...] &7- Random teleport in een andere wereld'
Usage: Usage:
Player: '&cUsage&7: /%command% player <player> [world] [biome1, biome2]' Player: '&cUsage&7: /%command% player <player> [world] [biome1, biome2]'

View File

@ -34,16 +34,17 @@ Messages:
Remove: '&cRemoved! &7You removed the Custom World %world%' Remove: '&cRemoved! &7You removed the Custom World %world%'
Help: Help:
List: Main: ' &7- &e/%command% &7- Randomly teleports you!'
- '&e&m------&r &6&lBetterRTP &8| &7Help &e&m------'
- ' &7- &e/%command% &7- Randomly teleports you!'
- ' &7- &e/%command% help &7- Shows help list'
##If the player has permission to rtp another player, this message will be added under the list!
Player: ' &7- &e/%command% player <player> [world] [biome1, biome2...] &7- Randomly teleport another player'
World: ' &7- &e/%command% world <world> [biome1, biome2...] &7- Randomly teleport in another world'
##If the player has permission to reload the plugin this message will be added under the list!
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: ''
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'
Reload: ' &7- &e/%command% reload &7- Reloads the plugin' Reload: ' &7- &e/%command% reload &7- Reloads the plugin'
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 <world> [biome1, biome2...] &7- Randomly teleport in another world'
Usage: Usage:
Player: '&cUsage&7: /%command% player <player> [world] [biome1, biome2]' Player: '&cUsage&7: /%command% player <player> [world] [biome1, biome2]'

View File

@ -28,23 +28,29 @@ Messages:
NotExist: '&cLe monde &7%world% &cn''existe pas!' NotExist: '&cLe monde &7%world% &cn''existe pas!'
Already: '&cOups! &7Il semblerait que tu essaie déjà de te téléporter...Patiente un peu!' Already: '&cOups! &7Il semblerait que tu essaie déjà de te téléporter...Patiente un peu!'
# Sign: '&7Command sign has been created! &7Command is... ''&f/rtp %command%&7''' # Sign: '&7Command sign has been created! &7Command is... ''&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%'
Help: Help:
List: Main: ' &7- &e/%command% &7- Te téléporte aléatoirement'
- '&e&m------&r &6&lBetterRTP &8| &7Aide &e&m------' # Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
- ' &7- &e/%command% &7- Te téléporte aléatoirement' # Edit: ''
- ' &7- &e/%command% help &7- Affiche l''aide' Help: ' &7- &e/%command% help &7- Affiche l''aide'
##Si le joueur a la permission de téléporter un autre joueur, ce message s'affiche dans l'aide aussi! # 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'
World: ' &7- &e/%command% world <monde> &7- Te téléporte aléatoirement dans un autre monde'
##Si le joueur a la permission de recharger le plugin, ce message s'affiche dans l'aide aussi!
Reload: ' &7- &e/%command% reload &7- Recharge le plugin!' Reload: ' &7- &e/%command% reload &7- Recharge le plugin!'
# 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 <monde> &7- Te téléporte aléatoirement dans un autre monde'
Usage: Usage:
Player: '&cUtilisation&7: /%command% player <joeur> [monde]' Player: '&cUtilisation&7: /%command% player <joeur> [monde]'
World: '&cUtilisation&7: /%command% world <monde>' World: '&cUtilisation&7: /%command% world <monde>'
Biome: '&cUtilisation&7: /%command% biome <biome1, biome2...>' Biome: '&cUtilisation&7: /%command% biome <biome1, biome2...>'
Edit: # Edit:
Base: '&cUsage&7: /%command% edit <default/world> [args...]' # Base: '&cUsage&7: /%command% edit <default/world> [args...]'
Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>' # Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>' # World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@ -28,18 +28,23 @@ Messages:
NotExist: '&cワールド&7%world%&cが存在しないようです。' NotExist: '&cワールド&7%world%&cが存在しないようです。'
Already: '&cおっと &7あなたはすでにRTPしているように見えます。' Already: '&cおっと &7あなたはすでにRTPしているように見えます。'
# Sign: '&7Command sign has been created! &7Command is... ''&f/rtp %command%&7''' # Sign: '&7Command sign has been created! &7Command is... ''&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%'
Help: Help:
List: Main: ' &7- &e/%command% &7- あなたをランダムテレポートする!'
- '&e&m------&r &6&lBetterRTP &8| &7ヘルプ&e&m------'
- ' &7- &e/%command% &7- あなたをランダムテレポートする!'
- ' &7- &e/%command% help &7- ヘルプを見る'
##
Player: ' &7- &e/%command% player <player> [world] &7- 他のプレイヤーをランダムテレポート'
World: ' &7- &e/%command% world <world> &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: ''
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- 他のプレイヤーをランダムテレポート'
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'
# 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 <world> &7- 他のワールドにランダムテレポート'
Usage: Usage:
Player: '&c使い方&7: /%command% player <プレイヤー> [ワールド]' Player: '&c使い方&7: /%command% player <プレイヤー> [ワールド]'

View File

@ -27,19 +27,23 @@ Messages:
Moved: '&cВы подвинулись! &7RTP отменено!' Moved: '&cВы подвинулись! &7RTP отменено!'
NotExist: '&cПохоже что мир &7%world% &cне существует!' NotExist: '&cПохоже что мир &7%world% &cне существует!'
Already: '&cУуупс! &7Похоже вы уже телепортируетесь. Имейте терпение!' Already: '&cУуупс! &7Похоже вы уже телепортируетесь. Имейте терпение!'
Sign: '&7Command sign has been created! &7Command is... ''&f/rtp %command%&7''' # Sign: '&7Command sign has been created! &7Command is... ''&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%'
Help: Help:
List: Main: ' &7- &e/%command% &7- случайно телепортирует вас!'
- '&e&m------&r &6&lBetterRTP &8| &7Помощь &e&m------'
- ' &7- &e/%command% &7- случайно телепортирует вас!'
- ' &7- &e/%command% help &7- показывает этот список'
##If the player has permission to rtp another player, this message will be added under the list!
Player: ' &7- &e/%command% player <игрок> [мир] &7- случайно телепортирует игрока'
World: ' &7- &e/%command% world <мир> &7- случайно телепортирует в другой мир'
##If the player has permission to reload the plugin this message will be added under the list!
# 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'
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- случайно телепортирует игрока'
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'
# 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 <мир> &7- случайно телепортирует в другой мир'
Usage: Usage:
Player: '&cИспользование&7: /%command% player <игрок> [мир]' Player: '&cИспользование&7: /%command% player <игрок> [мир]'