Addons support incoming

This commit is contained in:
SuperRonanCraft
2020-11-09 15:25:35 -05:00
parent 54982cd850
commit d92ee9bcff
83 changed files with 183 additions and 145 deletions

View File

@@ -1,124 +0,0 @@
package me.SuperRonanCraft.BetterRTP;
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
import me.SuperRonanCraft.BetterRTP.player.events.Listener;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP;
import me.SuperRonanCraft.BetterRTP.references.depends.DepEconomy;
import me.SuperRonanCraft.BetterRTP.references.Permissions;
import me.SuperRonanCraft.BetterRTP.references.Updater;
import me.SuperRonanCraft.BetterRTP.references.file.Files;
import me.SuperRonanCraft.BetterRTP.references.file.Messages;
import me.SuperRonanCraft.BetterRTP.references.invs.RTPInventories;
import me.SuperRonanCraft.BetterRTP.references.settings.Settings;
import me.SuperRonanCraft.BetterRTP.references.web.Metrics;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
public class Main extends JavaPlugin {
private final Permissions perms = new Permissions();
private final Messages text = new Messages();
private final DepEconomy eco = new DepEconomy();
private final Commands cmd = new Commands(this);
private final RTP rtp = new RTP();
private final Listener listener = new Listener();
private static Main instance;
private final Files files = new Files();
private final RTPInventories invs = new RTPInventories();
private final PlayerInfo pInfo = new PlayerInfo();
private final Settings settings = new Settings();
public void onEnable() {
instance = this;
new Updater(this);
new Metrics(this);
loadAll();
listener.registerEvents(this);
}
public void onDisable() {
invs.closeAll();
}
public Files getFiles() {
return files;
}
public static Main getInstance() {
return instance;
}
@Override
public boolean onCommand(CommandSender sendi, Command cmd, String label, String[] args) {
try {
this.cmd.commandExecuted(sendi, label, args);
} catch (NullPointerException e) {
e.printStackTrace();
text.error(sendi);
}
return true;
}
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
return this.cmd.onTabComplete(sender, args);
}
public Permissions getPerms() {
return perms;
}
public Messages getText() {
return text;
}
public DepEconomy getEco() {
return eco;
}
public Commands getCmd() {
return cmd;
}
public RTP getRTP() {
return rtp;
}
public Settings getSettings() {
return settings;
}
public void reload(CommandSender sendi) {
invs.closeAll();
loadAll();
text.getReload(sendi);
}
public RTPInventories getInvs() {
return invs;
}
public PlayerInfo getpInfo() {
return pInfo;
}
//(Re)Load all plugin systems/files/cache
private void loadAll() {
files.loadAll();
settings.load();
invs.load();
rtp.load();
cmd.load();
listener.load();
eco.load();
perms.register();
}
public static void debug(String str) {
if (getInstance().getSettings().debug)
getInstance().getLogger().info(str);
}
}

View File

@@ -1,79 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import java.util.HashMap;
public class PlayerInfo {
private final HashMap<Player, Inventory> invs = new HashMap<>();
private final HashMap<Player, RTP_INV_SETTINGS> invType = new HashMap<>();
private final HashMap<Player, World> invWorld = new HashMap<>();
private final HashMap<Player, RTP_INV_SETTINGS> invNextInv = new HashMap<>();
private final HashMap<Player, RTP_TYPE> rtpType = new HashMap<>();
public Inventory getInv(Player p) {
return invs.get(p);
}
public RTP_INV_SETTINGS getInvType(Player p) {
return invType.get(p);
}
public World getInvWorld(Player p) {
return invWorld.get(p);
}
public RTP_INV_SETTINGS getNextInv(Player p) {
return invNextInv.get(p);
}
public RTP_TYPE getRTPType(Player p) {
return rtpType.getOrDefault(p, RTP_TYPE.COMMAND);
}
public void setInv(Player p, Inventory inv) {
invs.put(p, inv);
}
public void setInvType(Player p, RTP_INV_SETTINGS type) {
invType.put(p, type);
}
public void setInvWorld(Player p, World type) {
invWorld.put(p, type);
}
public void setNextInv(Player p, RTP_INV_SETTINGS type) {
invNextInv.put(p, type);
}
public void setRTPType(Player p, RTP_TYPE rtpType) {
this.rtpType.put(p, rtpType);
}
//--Logic--
public Boolean playerExists(Player p) {
return invs.containsKey(p);
}
public void clear() {
invs.clear();
invType.clear();
invWorld.clear();
invNextInv.clear();
}
public void clear(Player p) {
invs.remove(p);
invType.remove(p);
invWorld.remove(p);
invNextInv.remove(p);
}
}

View File

@@ -1,36 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands;
import me.SuperRonanCraft.BetterRTP.player.commands.types.*;
public enum CommandTypes {
BIOME(new CmdBiome()),
EDIT(new CmdEdit()),
HELP(new CmdHelp()),
INFO(new CmdInfo()),
PLAYER(new CmdPlayer()),
RELOAD(new CmdReload()),
//SETTINGS(new CmdSettings(), true),
TEST(new CmdTest(), true),
VERSION(new CmdVersion()),
WORLD(new CmdWorld());
private final RTPCommand cmd;
private boolean debugOnly = false;
CommandTypes(RTPCommand cmd) {
this.cmd = cmd;
}
CommandTypes(RTPCommand cmd, boolean debugOnly) {
this.cmd = cmd;
this.debugOnly = debugOnly;
}
public boolean isDebugOnly() {
return debugOnly;
}
public RTPCommand getCmd() {
return cmd;
}
}

View File

@@ -1,172 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPCooldown;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.block.Biome;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
public class Commands {
private final Main pl;
public HashMap<UUID, Boolean> rtping = new HashMap<>();
public RTPCooldown cooldowns = new RTPCooldown();
private int delayTimer;
public Commands(Main pl) {
this.pl = pl;
}
public void load() {
FileBasics.FILETYPE config = FileBasics.FILETYPE.CONFIG;
delayTimer = config.getInt("Settings.Delay.Time");
cooldowns.load();
rtping.clear();
}
public void commandExecuted(CommandSender sendi, String label, String[] args) {
if (pl.getPerms().getUse(sendi)) {
if (args != null && args.length > 0) {
for (CommandTypes cmd : CommandTypes.values()) {
if (cmd.name().equalsIgnoreCase(args[0])) {
if (!cmd.isDebugOnly() || pl.getSettings().debug) { //Debug only?
if (cmd.getCmd().permission(sendi))
cmd.getCmd().execute(sendi, label, args);
else
noPerm(sendi);
return;
}
}
}
invalid(sendi, label);
} else
rtp(sendi, label, null, null);
} else
noPerm(sendi);
}
private void invalid(CommandSender sendi, String cmd) {
pl.getText().getInvalid(sendi, cmd);
}
public List<String> onTabComplete(CommandSender sendi, String[] args) {
List<String> list = new ArrayList<>();
if (args.length == 1) {
for (CommandTypes cmd : CommandTypes.values()) {
if (cmd.name().toLowerCase().startsWith(args[0].toLowerCase()))
if (!cmd.isDebugOnly() || pl.getSettings().debug) //Debug only?
if (cmd.getCmd().permission(sendi))
list.add(cmd.name().toLowerCase());
}
} else if (args.length > 1) {
for (CommandTypes cmd : CommandTypes.values()) {
if (cmd.name().equalsIgnoreCase(args[0]))
if (!cmd.isDebugOnly() || pl.getSettings().debug) //Debug only?
if (cmd.getCmd().permission(sendi)) {
List<String> _cmdlist = cmd.getCmd().tabComplete(sendi, args);
if (_cmdlist != null)
list.addAll(_cmdlist);
}
}
}
return list;
}
public void addBiomes(List<String> list, String[] args) {
try {
for (Biome b : Biome.values())
if (b.name().toUpperCase().replaceAll("minecraft:", "").startsWith(args[args.length - 1].toUpperCase()))
list.add(b.name().replaceAll("minecraft:", ""));
} catch (NoSuchMethodError e) {
//Not in 1.14.X
}
}
public void rtp(CommandSender sendi, String cmd, String world, List<String> biomes) {
if (sendi instanceof Player)
tp((Player) sendi, sendi, world, biomes, RTP_TYPE.COMMAND);
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'"));
}
//Custom biomes
public List<String> getBiomes(String[] args, int start, CommandSender sendi) {
List<String> biomes = new ArrayList<>();
boolean error_sent = false;
if (Main.getInstance().getPerms().getBiome(sendi))
for (int i = start; i < args.length; i++) {
String str = args[i];
try {
biomes.add(Biome.valueOf(str.replaceAll(",", "").toUpperCase()).name());
} catch (Exception e) {
if (!error_sent) {
pl.getText().getOtherBiome(sendi, str);
error_sent = true;
}
}
}
return biomes;
}
public void playerNotOnline(CommandSender sendi, String player) {
pl.getText().getNotOnline(sendi, player);
}
private void noPerm(CommandSender sendi) {
pl.getText().getNoPermission(sendi);
}
public void tp(Player player, CommandSender sendi, String world, List<String> biomes, RTP_TYPE rtpType) {
if (checkDelay(sendi, player)) { //Cooling down or rtp'ing
boolean delay = false;
if (sendi == player) //Forced?
if (pl.getSettings().delayEnabled && delayTimer > 0) //Delay enabled?
if (!pl.getPerms().getBypassDelay(player)) //Can bypass?
delay = true;
pl.getRTP().start(player, sendi, world, biomes, delay, rtpType);
}
}
private boolean checkDelay(CommandSender sendi, Player player) {
if (rtping.containsKey(player.getUniqueId()) && rtping.get(player.getUniqueId())) {
pl.getText().getAlready(sendi);
return false;
} else if (sendi != player || pl.getPerms().getBypassCooldown(player)) { //Bypassing/Forced?
return true;
} else if (cooldowns.enabled) { //Cooling down?
UUID id = player.getUniqueId();
if (cooldowns.exists(id)) {
if (cooldowns.locked(id)) { //Infinite cooldown (locked)
pl.getText().getNoPermission(sendi);
return false;
} else { //Normal cooldown
long Left = cooldowns.timeLeft(id);
if (pl.getSettings().delayEnabled && !pl.getPerms().getBypassDelay(sendi))
Left = Left + delayTimer;
if (Left > 0) {
//Still cooling down
pl.getText().getCooldown(sendi, String.valueOf(Left));
return false;
} else {
//Reset timer, but allow them to tp
//cooldowns.add(id);
return true;
}
}
} //else
//cooldowns.add(id);
}
return true;
}
}

View File

@@ -1,14 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands;
import org.bukkit.command.CommandSender;
import java.util.List;
public interface RTPCommand {
void execute(CommandSender sendi, String label, String[] args);
List<String> tabComplete(CommandSender sendi, String[] args);
boolean permission(CommandSender sendi);
}

View File

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

View File

@@ -1,45 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.List;
public class CmdBiome implements RTPCommand, RTPCommandHelpable {
//rtp biome <biome1, biome2...>
public void execute(CommandSender sendi, String label, String[] args) {
if (args.length >= 2)
Main.getInstance().getCmd().rtp(sendi, label, null, Main.getInstance().getCmd().getBiomes(args, 1, sendi));
else
usage(sendi, label);
}
public List<String> tabComplete(CommandSender sendi, String[] args) {
List<String> list = new ArrayList<>();
if (args.length == 2)
getCmd().addBiomes(list, args);
return list;
}
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getBiome(sendi);
}
public void usage(CommandSender sendi, String label) {
Main.getInstance().getText().getUsageBiome(sendi, label);
}
private Commands getCmd() {
return Main.getInstance().getCmd();
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpBiome();
}
}

View File

@@ -1,241 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.io.IOException;
import java.util.*;
public class CmdEdit implements RTPCommand, RTPCommandHelpable { //Edit a worlds properties
@Override
public void execute(CommandSender sendi, String label, String[] args) {
if (args.length >= 4) {
for (RTP_CMD_EDIT cmd : RTP_CMD_EDIT.values())
if (cmd.name().toLowerCase().startsWith(args[1].toLowerCase())) {
switch (cmd) {
case WORLD:
if (args.length >= 5) {
for (World world : Bukkit.getWorlds()) {
if (world.getName().toLowerCase().startsWith(args[2].toLowerCase())) {
for (RTP_CMD_EDIT_SUB cmde : RTP_CMD_EDIT_SUB.values())
if (cmde.name().toLowerCase().startsWith(args[3].toLowerCase())) {
editWorld(sendi, cmde, args[4], args[2]);
return;
}
usage(sendi, label, cmd);
return;
}
}
Main.getInstance().getText().getNotExist(sendi, label);
return;
}
usage(sendi, label, cmd);
return;
case DEFAULT:
for (RTP_CMD_EDIT_SUB cmde : RTP_CMD_EDIT_SUB.values())
if (cmde.name().toLowerCase().startsWith(args[2].toLowerCase())) {
editDefault(sendi, cmde, args[3]);
return;
}
usage(sendi, label, cmd);
return;
}
}
} else if (args.length >= 2) {
for (RTP_CMD_EDIT cmd : RTP_CMD_EDIT.values())
if (cmd.name().toLowerCase().startsWith(args[1].toLowerCase())) {
usage(sendi, label, cmd);
return;
}
}
usage(sendi, label, null);
}
private void editWorld(CommandSender sendi, RTP_CMD_EDIT_SUB cmd, String val, String world) {
Object value;
try {
value = cmd.getResult(val);
} catch (Exception e) {
e.printStackTrace();
Main.getInstance().getText().getEditError(sendi);
return;
}
FileBasics.FILETYPE file = FileBasics.FILETYPE.CONFIG;
YamlConfiguration config = file.getConfig();
List<Map<?, ?>> map = config.getMapList("CustomWorlds");
boolean found = false;
for (Map<?, ?> m : map) {
if (m.keySet().toArray()[0].equals(world)) {
found = true;
for (Object map2 : m.values()) {
Map<Object, Object> values = (Map<Object, Object>) map2;
values.put(cmd.get(), value);
Main.getInstance().getText().getEditSet(sendi, cmd.get(), val);
}
break;
}
}
if (!found) {
Map<Object, Object> map2 = new HashMap<>();
Map<Object, Object> values = new HashMap<>();
values.put(cmd.get(), value);
map2.put(world, values);
map.add(map2);
}
config.set("CustomWorlds", map);
try {
config.save(file.getFile());
Main.getInstance().getRTP().loadWorldSettings();
} catch (IOException e) {
e.printStackTrace();
}
}
private void editDefault(CommandSender sendi, RTP_CMD_EDIT_SUB cmd, String val) {
Object value = val;
try {
value = cmd.getResult(val);
} catch (Exception e) {
e.printStackTrace();
Main.getInstance().getText().getEditError(sendi);
return;
}
FileBasics.FILETYPE file = FileBasics.FILETYPE.CONFIG;
YamlConfiguration config = file.getConfig();
config.set("Default." + cmd.get(), value);
try {
config.save(file.getFile());
Main.getInstance().getRTP().loadWorldSettings();
Main.getInstance().getText().getEditSet(sendi, cmd.get(), val);
} catch (IOException e) {
e.printStackTrace();
}
}
//rtp edit default <max/min/center/useworldborder> <value>
//rtp edit world [<world>] <max/min/center/useworldborder> <value>
@Override
public List<String> tabComplete(CommandSender sendi, String[] args) {
List<String> list = new ArrayList<>();
if (args.length == 2) {
for (RTP_CMD_EDIT cmd : RTP_CMD_EDIT.values())
if (cmd.name().toLowerCase().startsWith(args[1].toLowerCase()))
list.add(cmd.name().toLowerCase());
} else if (args.length == 3) {
for (RTP_CMD_EDIT cmd : RTP_CMD_EDIT.values())
if (cmd.name().equalsIgnoreCase(args[1])) {
switch (cmd) {
case WORLD: //List all worlds
for (World world : Bukkit.getWorlds())
if (world.getName().toLowerCase().startsWith(args[2].toLowerCase()))
list.add(world.getName());
break;
case DEFAULT:
list.addAll(tabCompleteSub(args));
}
}
} else if (args.length == 4) {
for (RTP_CMD_EDIT cmd : RTP_CMD_EDIT.values())
if (cmd.name().equalsIgnoreCase(args[1]))
switch (cmd) {
case WORLD:
list.addAll(tabCompleteSub(args)); break;
case DEFAULT:
if (args[2].equalsIgnoreCase(RTP_CMD_EDIT_SUB.CENTER_X.name()))
list.add(String.valueOf(((Player) sendi).getLocation().getBlockX()));
else if (args[2].equalsIgnoreCase(RTP_CMD_EDIT_SUB.CENTER_Z.name()))
list.add(String.valueOf(((Player) sendi).getLocation().getBlockZ()));
break;
}
} else if (args.length == 5) {
for (RTP_CMD_EDIT cmd : RTP_CMD_EDIT.values())
if (cmd.name().equalsIgnoreCase(args[1]))
if (cmd == RTP_CMD_EDIT.WORLD) {
if (args[3].equalsIgnoreCase(RTP_CMD_EDIT_SUB.CENTER_X.name()))
list.add(String.valueOf(((Player) sendi).getLocation().getBlockX()));
else if (args[3].equalsIgnoreCase(RTP_CMD_EDIT_SUB.CENTER_Z.name()))
list.add(String.valueOf(((Player) sendi).getLocation().getBlockZ()));
}
}
return list;
}
private List<String> tabCompleteSub(String[] args) {
List<String> list = new ArrayList<>();
for (RTP_CMD_EDIT_SUB cmd : RTP_CMD_EDIT_SUB.values()) {
if (cmd.name().toLowerCase().startsWith(args[args.length - 1].toLowerCase()))
list.add(cmd.name().toLowerCase());
}
return list;
}
@Override
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getEdit(sendi);
}
private void usage(CommandSender sendi, String label, RTP_CMD_EDIT type) {
if (type != null)
switch (type) {
case DEFAULT:
Main.getInstance().getText().getUsageEditDefault(sendi, label); break;
case WORLD:
Main.getInstance().getText().getUsageEditWorld(sendi, label); break;
}
else
Main.getInstance().getText().getUsageEdit(sendi, label);
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpEdit();
}
enum RTP_CMD_EDIT {
WORLD, DEFAULT
}
enum RTP_CMD_EDIT_SUB {
CENTER_X("CenterX", "INT"),
CENTER_Z("CenterZ", "INT"),
MAX("MaxRadius", "INT"),
MIN("MinRadius", "INT"),
USEWORLDBORDER("UseWorldBorder", "BOL");
private String type;
private String str;
RTP_CMD_EDIT_SUB(String str, String type) {
this.str = str;
this.type = type;
}
String get() {
return str;
}
Object getResult(String input) {
if (this.type.equalsIgnoreCase("INT"))
return Integer.parseInt(input);
else if (this.type.equalsIgnoreCase("BOL"))
return Boolean.valueOf(input);
return null;
}
}
}

View File

@@ -1,57 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
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.RTPCommandHelpable;
import me.SuperRonanCraft.BetterRTP.references.file.Messages;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
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();
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);
// 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))
// pl.getText().getHelpInfo(sendi);
}
public List<String> tabComplete(CommandSender sendi, String[] args) {
return null;
}
public boolean permission(CommandSender sendi) {
return true;
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpHelp();
}
}

View File

@@ -1,174 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPParticles;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.references.worlds.RTPWorld;
import me.SuperRonanCraft.BetterRTP.references.worlds.WORLD_TYPE;
import me.SuperRonanCraft.BetterRTP.references.worlds.WorldPlayer;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffectType;
import xyz.xenondevs.particle.ParticleEffect;
import java.util.ArrayList;
import java.util.List;
public class CmdInfo implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) {
if (args.length > 1) {
if (args[1].equalsIgnoreCase(CmdInfoSub.PARTICLES.name()))
infoParticles(sendi);
else if (args[1].equalsIgnoreCase(CmdInfoSub.SHAPES.name()))
infoShapes(sendi);
else if (args[1].equalsIgnoreCase(CmdInfoSub.POTION_EFFECTS.name()))
infoEffects(sendi);
else if (args[1].equalsIgnoreCase(CmdInfoSub.WORLD.name())) {
if (sendi instanceof Player) { //Personalize with permission groups
World world = null;
boolean personal = false;
if (args.length > 2) {
Player player = Bukkit.getPlayer(args[2]);
if (player != null) {
world = player.getWorld();
personal = true;
}
}
if (world == null)
world = ((Player) sendi).getWorld();
sendInfoWorld(sendi, infoGetWorld(sendi, world, personal));
} else
infoWorld(sendi);
}
} else
infoWorld(sendi);
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpInfo();
}
enum CmdInfoSub { //Sub commands, future expansions
PARTICLES, SHAPES, POTION_EFFECTS, WORLD
}
//Particles
private void infoParticles(CommandSender sendi) {
List<String> info = new ArrayList<>();
Main pl = Main.getInstance();
for (ParticleEffect eff : ParticleEffect.VALUES) {
if (info.isEmpty() || info.size() % 2 == 0) {
info.add("&7" + eff.name() + "&r");
} else
info.add("&f" + eff.name() + "&r");
}
info.forEach(str ->
info.set(info.indexOf(str), pl.getText().color(str)));
sendi.sendMessage(info.toString());
}
//Shapes
private void infoShapes(CommandSender sendi) {
List<String> info = new ArrayList<>();
for (String shape : RTPParticles.shapeTypes) {
if (info.isEmpty() || info.size() % 2 == 0) {
info.add("&7" + shape + "&r");
} else
info.add("&f" + shape + "&r");
}
info.forEach(str ->
info.set(info.indexOf(str), Main.getInstance().getText().color(str)));
sendi.sendMessage(info.toString());
}
//World
private void sendInfoWorld(CommandSender sendi, List<String> list) { //Send info
list.add(0, "&e&m-----&6 BetterRTP &8| Info &e&m-----");
list.forEach(str ->
list.set(list.indexOf(str), Main.getInstance().getText().color(str)));
sendi.sendMessage(list.toArray(new String[0]));
}
private void infoWorld(CommandSender sendi) { //All worlds
List<String> info = new ArrayList<>();
for (World w : Bukkit.getWorlds())
info.addAll(infoGetWorld(sendi, w, false));
sendInfoWorld(sendi, info);
}
private List<String> infoGetWorld(CommandSender sendi, World w, boolean personal) { //Specific world
List<String> info = new ArrayList<>();
Main pl = Main.getInstance();
String _true = "&aTrue", _false = "&bFalse";
info.add("&eWorld: &7" + w.getName() + (personal ? " &7(personalized)" : ""));
if (personal)
info.add("&7- &6Allowed: " + (pl.getPerms().getAWorld(sendi, w.getName()) ? _true : _false));
if (pl.getRTP().getDisabledWorlds().contains(w.getName())) //DISABLED
info.add("&7- &6Disabled: " + _true);
else {
info.add("&7- &6Disabled: " + _false);
if (pl.getRTP().overriden.containsKey(w.getName()))
info.add("&7- &6Overriden: " + _true + " &7(" + pl.getRTP().overriden.get(w.getName()) + ")");
else {
info.add("&7- &6WorldType: &f" + pl.getRTP().world_type.getOrDefault(w.getName(), WORLD_TYPE.NORMAL).name());
info.add("&7- &6Overriden: " + _false);
WorldPlayer _rtpworld = Main.getInstance().getRTP().getPlayerWorld(sendi, w.getName(), null, personal);
info.add("&7- &6Custom: " + (Main.getInstance().getRTP().customWorlds.containsKey(w.getName()) ? _true : _false));
info.add("&7- &6UseWorldBorder: " + (_rtpworld.getUseWorldborder() ? _true : _false));
info.add("&7- &6Permission Group: " + (_rtpworld.getConfig() != null ? "&e" + _rtpworld.getConfig().name : "&cN/A"));
info.add("&7- &6Center X: &f" + _rtpworld.getCenterX());
info.add("&7- &6Center Z: &f" + _rtpworld.getCenterZ());
info.add("&7- &6MaxRad: &f" + _rtpworld.getMaxRad());
info.add("&7- &6MinRad: &f" + _rtpworld.getMinRad());
}
}
return info;
}
//Effects
private void infoEffects(CommandSender sendi) {
List<String> info = new ArrayList<>();
for (PotionEffectType effect : PotionEffectType.values()) {
if (info.isEmpty() || info.size() % 2 == 0) {
info.add("&7" + effect.getName() + "&r");
} else
info.add("&f" + effect.getName() + "&r");
}
info.forEach(str ->
info.set(info.indexOf(str), Main.getInstance().getText().color(str)));
sendi.sendMessage(info.toString());
}
public List<String> tabComplete(CommandSender sendi, String[] args) {
List<String> info = new ArrayList<>();
if (args.length == 2) {
for (CmdInfoSub cmd : CmdInfoSub.values())
if (cmd.name().toLowerCase().startsWith(args[1].toLowerCase()))
info.add(cmd.name().toLowerCase());
} else if (args.length == 3) {
if (CmdInfoSub.WORLD.name().toLowerCase().startsWith(args[1].toLowerCase())) {
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getName().toLowerCase().startsWith(args[2].toLowerCase()))
info.add(p.getName());
}
}
}
return info;
}
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getInfo(sendi);
}
}

View File

@@ -1,72 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes;
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
public class CmdPlayer implements RTPCommand, RTPCommandHelpable {
//rtp player <world> <biome1> <biome2...>
public void execute(CommandSender sendi, String label, String[] args) {
if (args.length == 2)
if (Bukkit.getPlayer(args[1]) != null && Bukkit.getPlayer(args[1]).isOnline())
getCmd().tp(Bukkit.getPlayer(args[1]), sendi, Bukkit.getPlayer(args[1]).getWorld().getName(), null, RTP_TYPE.FORCED);
else if (Bukkit.getPlayer(args[1]) != null)
getCmd().playerNotOnline(sendi, args[1]);
else
usage(sendi, label);
else if (args.length >= 3)
if (Bukkit.getPlayer(args[1]) != null && Bukkit.getPlayer(args[1]).isOnline())
getCmd().tp(Bukkit.getPlayer(args[1]), sendi, Bukkit.getWorld(args[2]).getName(), getCmd().getBiomes(args, 3, sendi), RTP_TYPE.FORCED);
else if (Bukkit.getPlayer(args[1]) != null)
getCmd().playerNotOnline(sendi, args[1]);
else
usage(sendi, label);
else
usage(sendi, label);
}
public List<String> tabComplete(CommandSender sendi, String[] args) {
List<String> list = new ArrayList<>();
if (args.length == 2) {
for (Player p : Bukkit.getOnlinePlayers())
if (p.getDisplayName().toLowerCase().startsWith(args[1].toLowerCase()))
list.add(p.getName());
} else if (args.length == 3) {
for (World w : Bukkit.getWorlds())
if (w.getName().startsWith(args[2]) && !Main.getInstance().getRTP().disabledWorlds().contains(w.getName()))
list.add(w.getName());
} else if (args.length > 3) {
if (CommandTypes.BIOME.getCmd().permission(sendi))
getCmd().addBiomes(list, args);
}
return list;
}
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getRtpOther(sendi);
}
public void usage(CommandSender sendi, String label) {
Main.getInstance().getText().getUsageRTPOther(sendi, label);
}
private Commands getCmd() {
return Main.getInstance().getCmd();
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpPlayer();
}
}

View File

@@ -1,28 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.command.CommandSender;
import java.util.List;
public class CmdReload implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) {
Main.getInstance().reload(sendi);
}
public List<String> tabComplete(CommandSender sendi, String[] args) {
return null;
}
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getReload(sendi);
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpReload();
}
}

View File

@@ -1,33 +0,0 @@
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.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
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) {
return null;
}
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getSettings(sendi);
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpSettings();
}
}

View File

@@ -1,38 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.List;
//Meant to just test particles and effects without actually rtp'ing around the world
public class CmdTest implements RTPCommand, RTPCommandHelpable {
@Override
public void execute(CommandSender sendi, String label, String[] args) {
if (sendi instanceof Player) {
Player p = (Player) sendi;
Main.getInstance().getRTP().getTeleport().afterTeleport(p, p.getLocation(), 0, 0);
} else
sendi.sendMessage("Console is not able to execute this command! Try '/rtp help'");
}
@Override
public List<String> tabComplete(CommandSender sendi, String[] args) {
return null;
}
@Override
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getTest(sendi);
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpTest();
}
}

View File

@@ -1,28 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.command.CommandSender;
import java.util.List;
public class CmdVersion implements RTPCommand, RTPCommandHelpable {
public void execute(CommandSender sendi, String label, String[] args) {
sendi.sendMessage(Main.getInstance().getText().colorPre("&aVersion #&e" + Main.getInstance().getDescription().getVersion()));
}
public List<String> tabComplete(CommandSender sendi, String[] args) {
return null;
}
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getVersion(sendi);
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpVersion();
}
}

View File

@@ -1,57 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.commands.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes;
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import java.util.ArrayList;
import java.util.List;
public class CmdWorld implements RTPCommand, RTPCommandHelpable {
//rtp world <world> <biome1, biome2...>
public void execute(CommandSender sendi, String label, String[] args) {
if (args.length >= 2)
Main.getInstance().getCmd().rtp(sendi, label, args[1], Main.getInstance().getCmd().getBiomes(args, 2, sendi));
else
usage(sendi, label);
}
public List<String> tabComplete(CommandSender sendi, String[] args) {
List<String> list = new ArrayList<>();
if (args.length == 2) {
for (World w : Bukkit.getWorlds()) {
String _wName = w.getName().replace(" ", "_");
if (w.getName().startsWith(args[1]) && !Main.getInstance().getRTP().disabledWorlds().contains(_wName)
&& Main.getInstance().getPerms().getAWorld(sendi, _wName))
list.add(_wName);
}
} else if (args.length >= 3) {
if (CommandTypes.BIOME.getCmd().permission(sendi))
getCmd().addBiomes(list, args);
}
return list;
}
public boolean permission(CommandSender sendi) {
return Main.getInstance().getPerms().getWorld(sendi);
}
public void usage(CommandSender sendi, String label) {
Main.getInstance().getText().getUsageWorld(sendi, label);
}
private Commands getCmd() {
return Main.getInstance().getCmd();
}
@Override
public String getHelp() {
return Main.getInstance().getText().getHelpWorld();
}
}

View File

@@ -1,50 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.events;
import me.SuperRonanCraft.BetterRTP.references.invs.RTPInventories;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
public class Click {
public void click(InventoryClickEvent e) {
if (!validClick(e))
return;
e.setCancelled(true);
handler(e);
}
private void handler(InventoryClickEvent e) {
try {
PlayerInfo pInfo = Main.getInstance().getpInfo();
Player p = (Player) e.getWhoClicked();
RTPInventories menu = Main.getInstance().getInvs();
menu.getInv(pInfo.getInvType(p)).clickEvent(e);
} catch (NullPointerException ex) {
//ex.printStackTrace();
}
}
private boolean validClick(InventoryClickEvent e) {
//Not a player, or Not our inventory
if (!(e.getWhoClicked() instanceof Player) || e.isCancelled())
return false;
// Item is clicked
else if (e.getCurrentItem() == null || e.getCurrentItem().getType().equals(Material.AIR))
return false;
else if (e.getWhoClicked() instanceof Player) {
// Clicks the inventory
if (!e.getInventory().equals(Main.getInstance().getpInfo().getInv((Player) e.getWhoClicked())))
return false;
// Clicks their own inventory
else if (!e.getClickedInventory().equals(Main.getInstance().getpInfo().getInv((Player) e
.getWhoClicked()))) {
e.setCancelled(true);
return false;
}
}
return true;
}
}

View File

@@ -1,79 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.events;
import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.block.Block;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import java.util.Arrays;
class Interact {
private boolean enabled;
private String title, coloredTitle;
void load() {
String pre = "Settings.";
FileBasics.FILETYPE file = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.SIGNS);
enabled = file.getBoolean(pre + "Enabled");
title = file.getString(pre + "Title");
coloredTitle = Main.getInstance().getText().color(title);
}
void event(PlayerInteractEvent e) {
if (enabled && e.getClickedBlock() != null && e.getAction() == Action.RIGHT_CLICK_BLOCK && isSign(e.getClickedBlock())) {
Sign sign = (Sign) e.getClickedBlock().getState();
if (sign.getLine(0).equals(coloredTitle)) {
String command = sign.getLine(1).split(" ")[0];
if (cmd(sign.getLines()).split(" ")[0].equalsIgnoreCase("") || cmd(sign.getLines()).split(" ")[0].equalsIgnoreCase("rtp")) {
action(e.getPlayer(), null);
return;
} else
for (CommandTypes cmd : CommandTypes.values())
if (command.equalsIgnoreCase(cmd.name())) {
action(e.getPlayer(), cmd(sign.getLines()).split(" "));
return;
}
e.getPlayer().sendMessage(Main.getInstance().getText().colorPre("&cError! &7Command &a"
+ Arrays.toString(cmd(sign.getLines()).split(" ")) + "&7 does not exist! Defaulting command to /rtp!"));
}
}
}
void createSign(SignChangeEvent e) {
if (enabled && Main.getInstance().getPerms().getSignCreate(e.getPlayer())) {
String line = e.getLine(0);
if (line != null && (line.equalsIgnoreCase(title) ||
line.equalsIgnoreCase("[RTP]"))) {
e.setLine(0, coloredTitle != null ? coloredTitle : "[RTP]");
Main.getInstance().getText().getSignCreated(e.getPlayer(), cmd(e.getLines()));
}
}
}
private void action(Player p, String[] line) {
Main.getInstance().getCmd().commandExecuted(p, "rtp", line);
}
private String cmd(String[] signArray) {
String actions = "";
for (int i = 1; i < signArray.length; i++) {
String line = signArray[i];
if (line != null && !line.equals(""))
if (actions.equals(""))
actions = line;
else
actions = actions.concat(" " + line);
}
return actions;
}
private boolean isSign(Block block) {
return block.getState() instanceof Sign;
}
}

View File

@@ -1,36 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.events;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
import me.SuperRonanCraft.BetterRTP.references.Updater;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerJoinEvent;
public class Join {
void event(PlayerJoinEvent e) {
Player p = e.getPlayer();
updater(p);
rtpOnFirstJoin(p);
}
//Updater
private void updater(Player p) {
if (!getPl().getFiles().getType(FileBasics.FILETYPE.CONFIG).getBoolean("Settings.DisableUpdater") && getPl().getPerms().getUpdate(p))
if (!getPl().getDescription().getVersion().equals(Updater.updatedVersion))
getPl().getText().sms(p, "&7There is currently an update for &6BetterRTP &7version &e#" +
Updater.updatedVersion + " &7you have version &e#" + getPl().getDescription().getVersion());
}
//RTP on first join
private void rtpOnFirstJoin(Player p) {
if (getPl().getSettings().rtpOnFirstJoin_Enabled && !p.hasPlayedBefore())
getPl().getCmd().tp(p, Bukkit.getConsoleSender(), getPl().getSettings().rtpOnFirstJoin_World, null, RTP_TYPE.JOIN); //Console is sender to override delays
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@@ -1,11 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.events;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.event.player.PlayerQuitEvent;
class Leave {
void event(PlayerQuitEvent e) {
Main.getInstance().getCmd().rtping.remove(e.getPlayer().getUniqueId());
}
}

View File

@@ -1,63 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.events;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.plugin.PluginManager;
public class Listener implements org.bukkit.event.Listener {
private final Join join = new Join();
private final Leave leave = new Leave();
private final Interact interact = new Interact();
private final Click click = new Click();
//private final PluginEnable pEnable = new PluginEnable();
public void registerEvents(Main pl) {
PluginManager pm = pl.getServer().getPluginManager();
pm.registerEvents(this, pl);
}
public void load() {
interact.load();
}
@EventHandler
@SuppressWarnings("unused")
private void onLeave(PlayerQuitEvent e) {
leave.event(e);
}
@EventHandler
@SuppressWarnings("unused")
private void onJoin(PlayerJoinEvent e) {
join.event(e);
}
@EventHandler
@SuppressWarnings("unused")
private void onInteract(PlayerInteractEvent e) {
interact.event(e);
}
@EventHandler
@SuppressWarnings("unused")
private void interact(SignChangeEvent e) {
interact.createSign(e);
}
@EventHandler
@SuppressWarnings("unused")
private void click(InventoryClickEvent e) {
click.click(e);
}
/*@EventHandler
private void enablePlugin(PluginEnableEvent e) {
pEnable.enabled(e);
}*/
}

View File

@@ -1,19 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.events;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.event.server.PluginEnableEvent;
public class PluginEnable {
//In the case SoftDependencies plugins load after us!
void enabled(PluginEnableEvent e) {
String name = e.getPlugin().getName();
//System.out.println(name);
if (name.equalsIgnoreCase("WorldGuard"))
Main.getInstance().getSettings().getsDepends().registerWorldguard();
else if (name.equalsIgnoreCase("GriefPrevention"))
Main.getInstance().getSettings().getsDepends().registerGriefPrevention();
}
}

View File

@@ -1,189 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import me.SuperRonanCraft.BetterRTP.references.worlds.*;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class RTP {
final RTPTeleport teleport = new RTPTeleport();
final RTPPluginValidation softDepends = new RTPPluginValidation();
public final RTPPermissionGroup permConfig = new RTPPermissionGroup();
//Cache
public HashMap<String, RTPWorld> customWorlds = new HashMap<>();
public HashMap<String, String> overriden = new HashMap<>();
public WorldDefault defaultWorld = new WorldDefault();
List<String> disabledWorlds, blockList;
int maxAttempts, delayTime;
boolean cancelOnMove, cancelOnDamage;
public HashMap<String, WORLD_TYPE> world_type = new HashMap<>();
public RTPTeleport getTeleport() {
return teleport;
}
public void load() {
FileBasics.FILETYPE config = FileBasics.FILETYPE.CONFIG;
disabledWorlds = config.getStringList("DisabledWorlds");
maxAttempts = config.getInt("Settings.MaxAttempts");
delayTime = config.getInt("Settings.Delay.Time");
cancelOnMove = config.getBoolean("Settings.Delay.CancelOnMove");
cancelOnDamage = config.getBoolean("Settings.Delay.CancelOnDamage");
blockList = config.getStringList("BlacklistedBlocks");
//OVER-RIDES
try {
overriden.clear();
List<Map<?, ?>> override_map = config.getMapList("Overrides");
for (Map<?, ?> m : override_map)
for (Map.Entry<?, ?> entry : m.entrySet()) {
overriden.put(entry.getKey().toString(), entry.getValue().toString());
if (getPl().getSettings().debug)
getPl().getLogger().info("- Override '" + entry.getKey() + "' -> '" + entry.getValue() + "' added");
}
} catch (Exception e) {
//No Overrides
}
try {
world_type.clear();
for (World world : Bukkit.getWorlds())
world_type.put(world.getName(), WORLD_TYPE.NORMAL);
List<Map<?, ?>> world_map = config.getMapList("WorldType");
for (Map<?, ?> m : world_map)
for (Map.Entry<?, ?> entry : m.entrySet()) {
if (world_type.containsKey(entry.getKey())) {
try {
WORLD_TYPE type = WORLD_TYPE.valueOf(entry.getValue().toString().toUpperCase());
world_type.put(entry.getKey().toString(), type);
} catch(IllegalArgumentException e) {
StringBuilder valids = new StringBuilder();
for (WORLD_TYPE type : WORLD_TYPE.values())
valids.append(type.name()).append(", ");
valids.replace(valids.length() - 2, valids.length(), "");
getPl().getLogger().severe("World Type for '" + entry.getKey() + "' is INVALID '" + entry.getValue() +
"'. Valid ID's are: " + valids.toString());
//Wrong rtp world type
}
}/* else {
if (getPl().getSettings().debug)
getPl().getLogger().info("- World Type failed for '" + entry.getKey() + "' is it loaded?");
}*/
}
if (getPl().getSettings().debug)
for (String world : world_type.keySet())
Main.debug("- World Type for '" + world + "' set to '" + world_type.get(world) + "'");
} catch (Exception e) {
e.printStackTrace();
//No World Types
}
loadWorldSettings();
teleport.load(); //Load teleporting stuff
permConfig.load(); //Load permission configs
}
public void loadWorldSettings() {
FileBasics.FILETYPE config = FileBasics.FILETYPE.CONFIG;
defaultWorld.setup();
//CUSTOM WORLDS
try {
customWorlds.clear();
List<Map<?, ?>> map = config.getMapList("CustomWorlds");
for (Map<?, ?> m : map)
for (Map.Entry<?, ?> entry : m.entrySet()) {
customWorlds.put(entry.getKey().toString(), new WorldCustom(entry.getKey().toString()));
if (getPl().getSettings().debug)
Main.debug("- Custom World '" + entry.getKey() + "' registered");
}
} catch (Exception e) {
//No Custom Worlds
}
}
public List<String> disabledWorlds() {
return disabledWorlds;
}
public List<String> getDisabledWorlds() {
return disabledWorlds;
}
public WorldPlayer getPlayerWorld(CommandSender sendi, String world_name, List<String> biomes, boolean personal) {
WorldPlayer pWorld = new WorldPlayer(sendi, Bukkit.getWorld(world_name));
// Set all methods
if (customWorlds.containsKey(world_name)) {
RTPWorld cWorld = customWorlds.get(pWorld.getWorld().getName());
pWorld.setup(cWorld, cWorld.getPrice(), biomes, personal);
} else
pWorld.setup(defaultWorld, defaultWorld.getPrice(), biomes, personal);
//World type
WORLD_TYPE world_type = WORLD_TYPE.NORMAL; //World rtp type
if (this.world_type.containsKey(world_name))
world_type = this.world_type.get(world_name);
pWorld.setWorldtype(world_type);
return pWorld;
}
private Main getPl() {
return Main.getInstance();
}
public void start(Player p, CommandSender sendi, String world_name, List<String> biomes, boolean delay, RTP_TYPE rtpType) {
// Check overrides
if (world_name == null) {
world_name = p.getWorld().getName();
} else { // Check if nulled or world doesnt exist
World _world = Bukkit.getWorld(world_name);
if (_world == null) { //Check if world has spaces instead of underscores
_world = Bukkit.getWorld(world_name.replace("_", " "));
world_name = world_name.replace("_", "");
}
if (_world == null) {
getPl().getText().getNotExist(sendi, world_name);
return;
}
}
if (overriden.containsKey(world_name))
world_name = overriden.get(world_name);
// Not forced and has 'betterrtp.world.<world>'
if (sendi == p && !getPl().getPerms().getAWorld(sendi, world_name)) {
getPl().getText().getNoPermissionWorld(p, world_name);
return;
}
// Check disabled worlds
if (disabledWorlds.contains(world_name)) {
getPl().getText().getDisabledWorld(sendi, world_name);
return;
}
WorldPlayer pWorld = getPlayerWorld(p, world_name, biomes, true);
// Economy
if (!getPl().getEco().hasBalance(sendi, pWorld))
return;
Main.getInstance().getpInfo().setRTPType(p, rtpType);
rtp(sendi, pWorld, delay);
}
private void rtp(CommandSender sendi, WorldPlayer pWorld, boolean delay) {
//Cooldown
Player p = pWorld.getPlayer();
getPl().getCmd().cooldowns.add(p.getUniqueId());
getPl().getCmd().rtping.put(p.getUniqueId(), true); //Cache player so they cant run '/rtp' again while rtp'ing
//Setup player rtp methods
RTPPlayer rtp = new RTPPlayer(p, this, pWorld);
// Delaying? Else, just go
if (getPl().getSettings().delayEnabled && delay) {
new RTPDelay(sendi, rtp, delayTime, cancelOnMove, cancelOnDamage);
} else {
teleport.beforeTeleportInstant(sendi, p);
rtp.randomlyTeleport(sendi);
}
}
}

View File

@@ -1,144 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.UUID;
public class RTPCooldown {
private final HashMap<UUID, Long> cooldowns = new HashMap<>(); //Cooldown timer for each player
private HashMap<UUID, Integer> locked = null; //Players locked from rtp'ing ever again
public boolean enabled;
private int
timer, //Cooldown timer
lockedAfter; //Rtp's before being locked
public void load() {
cooldowns.clear();
if (locked != null)
locked.clear();
FileBasics.FILETYPE config = FileBasics.FILETYPE.CONFIG;
enabled = config.getBoolean("Settings.Cooldown.Enabled");
if (enabled) {
timer = config.getInt("Settings.Cooldown.Time");
lockedAfter = config.getInt("Settings.Cooldown.LockAfter");
if (lockedAfter > 0)
locked = new HashMap<>();
loadFile();
}
}
public void add(UUID id) {
if (!enabled) return;
cooldowns.put(id, System.currentTimeMillis());
if (lockedAfter > 0) {
if (locked.containsKey(id))
locked.put(id, locked.get(id) + 1);
else
locked.put(id, 1);
savePlayer(id, true, cooldowns.get(id), locked.get(id));
} else
savePlayer(id, true, cooldowns.get(id), 0);
}
public boolean exists(UUID id) {
return cooldowns.containsKey(id);
}
public long timeLeft(UUID id) {
long cooldown = cooldowns.getOrDefault(id, 0L);
return ((cooldown / 1000) + timer) - (System.currentTimeMillis() / 1000);
}
public boolean locked(UUID id) {
if (locked != null && locked.containsKey(id))
return locked.get(id) >= lockedAfter;
return false;
}
public void remove(UUID id) {
if (!enabled) return;
if (lockedAfter > 0) {
locked.put(id, locked.getOrDefault(id, 1) - 1);
if (locked.get(id) <= 0) { //Remove from file as well
savePlayer(id, false, 0L, 0);
} else { //Keep the player cached
savePlayer(id, false, cooldowns.get(id), locked.get(id));
}
cooldowns.remove(id);
} else { //Remove completely
cooldowns.remove(id);
savePlayer(id, false, 0L, 0);
}
}
private void savePlayer(UUID id, boolean adding, long time, int attempts) {
YamlConfiguration config = getFile();
if (config == null) return;
if (adding) { //Add player to file
config.set(id.toString() + ".Time", time);
if (attempts > 0)
config.set(id.toString() + ".Attempts", attempts);
} else { //Remove player from the file
config.set(id.toString(), null);
}
try {
config.save(configfile);
} catch (IOException e) {
e.printStackTrace();
}
}
private YamlConfiguration config;
private File configfile;
private YamlConfiguration getFile() {
if (config != null) {
return config;
} else {
if (!configfile.exists()) {
try {
configfile.getParentFile().mkdir();
configfile.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
config = new YamlConfiguration();
config.load(configfile);
return config;
} catch (IOException | InvalidConfigurationException e) {
e.printStackTrace();
}
return null;
}
}
private void loadFile() {
config = null;
configfile = new File(Main.getInstance().getDataFolder(), "data/cooldowns.yml");
YamlConfiguration config = getFile();
if (config != null)
for (String id : config.getKeys(false)) {
try {
UUID uuid = UUID.fromString(id);
Long time = config.getLong(id + ".Time");
cooldowns.put(uuid, time);
if (lockedAfter > 0) {
int attempts = config.getInt(id + ".Attempts");
locked.put(uuid, attempts);
}
} catch (IllegalArgumentException e) {
Main.getInstance().getLogger().info("UUID of `" + id + "` is invalid, please delete this!");
//Bad uuid
}
}
}
}

View File

@@ -1,79 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.references.worlds.WorldPlayer;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerMoveEvent;
class RTPDelay implements Listener {
private int run;
private final boolean cancelOnMove, cancelOnDamage;
private final RTPPlayer rtp;
RTPDelay(CommandSender sendi, RTPPlayer rtp, int delay, boolean cancelOnMove, boolean cancelOnDamage) {
this.cancelOnMove = cancelOnMove;
this.cancelOnDamage = cancelOnDamage;
this.rtp = rtp;
delay(sendi, delay);
}
private void delay(CommandSender sendi, int delay) {
getPl().getRTP().getTeleport().beforeTeleportDelay(rtp.getPlayer(), delay);
run = Bukkit.getScheduler().scheduleSyncDelayedTask(Main.getInstance(), run(sendi, this), delay * 20);
if (cancelOnMove || cancelOnDamage)
Bukkit.getPluginManager().registerEvents(this, Main.getInstance());
}
@EventHandler
@SuppressWarnings("unused")
private void event(PlayerMoveEvent e) {
if (cancelOnMove)
if (e.getPlayer().equals(rtp.getPlayer()) &&
(e.getTo() != null &&
(e.getTo().getBlockX() != e.getFrom().getBlockX() ||
e.getTo().getBlockY() != e.getFrom().getBlockY() ||
e.getTo().getBlockZ() != e.getFrom().getBlockZ()))
) {
cancel();
}
}
@EventHandler
@SuppressWarnings("unused")
private void event(EntityDamageEvent e) {
if (cancelOnDamage)
if (e.getEntity() instanceof Player){
if (e.getEntity().equals(rtp.getPlayer()))
cancel();
}
}
private void cancel() {
Bukkit.getScheduler().cancelTask(run);
if (!Bukkit.getScheduler().isCurrentlyRunning(run)) {
HandlerList.unregisterAll(this);
getPl().getRTP().getTeleport().cancelledTeleport(rtp.getPlayer());
//getPl().getEco().unCharge(rtp.getPlayer(), rtp.pWorld);
getPl().getCmd().cooldowns.remove(rtp.getPlayer().getUniqueId());
getPl().getCmd().rtping.put(rtp.getPlayer().getUniqueId(), false);
}
}
private Runnable run(final CommandSender sendi, final RTPDelay cls) {
return () -> {
HandlerList.unregisterAll(cls);
if (getPl().getCmd().rtping.containsKey(rtp.getPlayer().getUniqueId()))
rtp.randomlyTeleport(sendi);
};
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@@ -1,111 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import xyz.xenondevs.particle.ParticleEffect;
import java.util.Arrays;
import java.util.Random;
//---
//Credit to @ByteZ1337 for ParticleLib - https://github.com/ByteZ1337/ParticleLib
//
//Use of particle creation
//---
public class RTPParticles {
private boolean enabled;
private ParticleEffect effect;
private String shape;
private final int
radius = 30,
precision = 180; //Vector weirdness if allowed to be editable
private final double pHeight = 1.75;
//Some particles act very differently and might not care how they are shaped before animating, ex: EXPLOSION_NORMAL
public static String[] shapeTypes = {
"SCAN", //Body scan
"EXPLODE", //Make an explosive entrance
"TELEPORT" //Startrek type of portal
};
void load() {
FileBasics.FILETYPE config = getPl().getFiles().getType(FileBasics.FILETYPE.EFFECTS);
enabled = config.getBoolean("Particles.Enabled");
if (!enabled) return;
//Enabled? Load all this junk
String type = config.getString("Particles.Type");
try {
effect = ParticleEffect.valueOf(type.toUpperCase());
} catch (IllegalArgumentException | NullPointerException e) {
effect = ParticleEffect.ASH;
getPl().getLogger().severe("The particle '" + type + "' doesn't exist! Default particle enabled... " +
"Try using '/rtp info particles' to get a list of available particles");
}
shape = config.getString("Particles.Shape").toUpperCase();
if (!Arrays.asList(shapeTypes).contains(shape)) {
getPl().getLogger().severe("The particle shape '" + shape + "' doesn't exist! Default particle shape enabled...");
getPl().getLogger().severe("Try using '/rtp info shapes' to get a list of shapes, or: " + Arrays.asList(shapeTypes).toString());
shape = shapeTypes[0];
}
}
void display(Player p) {
if (!enabled) return;
try { //Incase the library errors out
switch (shape) {
case "TELEPORT": partTeleport(p); break;
case "EXPLODE": partExplosion(p); break;
default: //Super redundant, but... just future proofing
case "SCAN": partScan(p); break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void partScan(Player p) { //Particles with negative velocity
Location loc = p.getLocation().add(new Vector(0, pHeight, 0));
for (int index = 1; index < precision; index++) {
Vector vec = getVecCircle(index, precision, radius);
effect.display(loc.clone().add(vec), new Vector(0, -0.125, 0), 1f, 0, null);
}
}
private void partTeleport(Player p) { //Static particles in a shape
Random ran = new Random();
Location loc = p.getLocation().add(new Vector(0, 0, 0));
for (int index = 1; index < precision; index++) {
double yran = ran.nextGaussian() * pHeight;
Vector vec = getVecCircle(index, precision, radius).add(new Vector(0, yran, 0));
effect.display(loc.clone().add(vec));
}
}
private void partExplosion(Player p) { //Particles with a shape and forward velocity
Location loc = p.getLocation().add(new Vector(0, 1, 0));
for (int index = 1; index < precision; index++) {
Vector vec = getVecCircle(index, precision, radius);
effect.display(loc.clone().add(vec), vec, 1.5f, 0, null);
}
}
private Vector getVecCircle(int index, int precise, int rad) {
double p1 = (index * Math.PI) / (precise / 2);
double p2 = (index - 1) * Math.PI / (precise / 2);
//Positions
double x1 = Math.cos(p1) * rad;
double x2 = Math.cos(p2) * rad;
double z1 = Math.sin(p1) * rad;
double z2 = Math.sin(p2) * rad;
return new Vector(x2 - x1, 0, z2 - z1);
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@@ -1,118 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import java.util.*;
@SuppressWarnings("rawtypes")
public class RTPPermissionGroup {
private final List<RTPPermConfiguration> groups = new ArrayList<>();
public RTPPermConfiguration getGroup(CommandSender p) {
for (RTPPermConfiguration group : groups)
if (Main.getInstance().getPerms().getPermissionGroup(p, group.name))
return group;
return null;
}
public void load() {
for (RTPPermConfiguration group : groups)
group.worlds.clear();
groups.clear();
YamlConfiguration config = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG).getConfig();
if (!config.getBoolean("PermissionGroup.Enabled")) return;
List<Map<?, ?>> list = config.getMapList("PermissionGroup.Groups");
for (Map<?, ?> m : list)
for (Map.Entry<?, ?> entry : m.entrySet()) {
RTPPermConfiguration group = new RTPPermConfiguration(entry);
if (group.isValid()) {
groups.add(group);
Main.debug("- Group " + group.name + " has " + group.worlds.size() + " worlds setup, permission: 'betterrtp.group." + group.name + "'");
for (RTPPermConfigurationWorld world : group.worlds) {
Main.debug(" - World '" + world.name + "' MaxRad = " + world.maxRad + ", MinRad = " + world.minRad);
}
} else {
Main.debug("ERROR! Group " + group.name + " was not setup correctly!");
}
}
}
public static class RTPPermConfiguration {
boolean valid;
public String name;
public List<RTPPermConfigurationWorld> worlds = new ArrayList<>();
RTPPermConfiguration(Map.Entry<?, ?> fields) {
String group = fields.getKey().toString();
Object value = fields.getValue();
for (Object worlds : ((ArrayList) value)) {
for (Object hash : ((HashMap) worlds).entrySet()) {
RTPPermConfigurationWorld worldConfig = new RTPPermConfigurationWorld(hash, group);
if (worldConfig.isValid())
this.worlds.add(worldConfig);
else
Main.debug("ERROR! Group " + group + " world " + worldConfig.name + " was not setup correctly!");
}
}
this.name = group;
valid = worlds.size() > 0 && group != null;
}
boolean isValid() {
return valid;
}
}
public static class RTPPermConfigurationWorld {
boolean valid;
public int maxRad = -1;
public int minRad = -1;
public int price = -1;
public int centerx = -1;
public int centerz = -1;
public Object useworldborder = null;
public String name;
RTPPermConfigurationWorld(Object hash, String group) {
Map.Entry world = (Map.Entry) hash;
this.name = world.getKey().toString();
//Main.getInstance().getLogger().info("World added to '" + group +"': '" + world.getKey() + "'");
for (Object hash2 : ((HashMap) world.getValue()).entrySet()) {
Map.Entry hash3 = (Map.Entry) hash2;
String field = hash3.getKey().toString();
if (field.equalsIgnoreCase("MaxRadius")) { //MaxRadius
maxRad = getInt(hash3.getValue().toString());
} else if (field.equalsIgnoreCase("MinRadius")) { //MinRadius
minRad = getInt(hash3.getValue().toString());
} else if (field.equalsIgnoreCase("Price")) { //MinRadius
price = getInt(hash3.getValue().toString());
} else if (field.equalsIgnoreCase("UseWorldBorder")) { //UseWorldBorder
useworldborder = Boolean.valueOf(hash3.getValue().toString());
} else if (field.equalsIgnoreCase("CenterX")) { //Center X
centerx = getInt(hash3.getValue().toString());
} else if (field.equalsIgnoreCase("CenterZ")) { //Center Z
centerz = getInt(hash3.getValue().toString());
}
}
//Main.getInstance().getLogger().info("World MaxRad '" + world.getKey() + "' is " + maxRad);
//Main.getInstance().getLogger().info("World MinRad '" + world.getKey() + "' is " + minRad);
valid = this.name != null && (minRad != -1 || maxRad != -1);
}
private int getInt(String input) {
return Integer.parseInt(input);
}
boolean isValid() {
return valid;
}
}
}

View File

@@ -1,139 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import io.papermc.lib.PaperLib;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.worlds.*;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.concurrent.CompletableFuture;
public class RTPPlayer {
private final Player p;
private final RTP settings;
WorldPlayer pWorld;
RTPPlayer(Player p, RTP settings, WorldPlayer pWorld) {
this.p = p;
this.settings = settings;
this.pWorld = pWorld;
}
public Player getPlayer() {
return p;
}
void randomlyTeleport(CommandSender sendi) {
if (pWorld.getAttempts() >= settings.maxAttempts) //Cancel out, too many tries
metMax(sendi, p);
else { //Try again to find a safe location
Location loc = pWorld.generateRandomXZ(settings.defaultWorld); //randomLoc(pWorld);
CompletableFuture<Chunk> chunk = PaperLib.getChunkAtAsync(pWorld.getWorld(), loc.getBlockX(), loc.getBlockZ());
chunk.thenAccept(result -> {
Main.debug("Checking location for " + p.getName());
Location tpLoc;
float yaw = p.getLocation().getYaw();
float pitch = p.getLocation().getPitch();
switch (pWorld.getWorldtype()) { //Get a Y position and check for bad blocks
case NETHER:
tpLoc = getLocAtNether(loc.getBlockX(), loc.getBlockZ(), pWorld.getWorld(), yaw, pitch, pWorld); break;
case NORMAL:
default:
tpLoc = getLocAtNormal(loc.getBlockX(), loc.getBlockZ(), pWorld.getWorld(), yaw, pitch, pWorld);
}
//Valid location?
if (tpLoc != null && checkDepends(tpLoc)) {
if (getPl().getEco().charge(p, pWorld)) {
settings.teleport.sendPlayer(sendi, p, tpLoc, pWorld.getPrice(), pWorld.getAttempts());
}
} else
randomlyTeleport(sendi);
});
}
}
// Compressed code for MaxAttempts being met
private void metMax(CommandSender sendi, Player p) {
settings.teleport.failedTeleport(p, sendi);
/*if (p == sendi)
getPl().getText().getFailedNotSafe(sendi, settings.maxAttempts);
else
getPl().getText().getOtherNotSafe(sendi, settings.maxAttempts, p.getName());*/
getPl().getCmd().cooldowns.remove(p.getUniqueId());
//getPl().getEco().unCharge(p, pWorld);
getPl().getCmd().rtping.put(p.getUniqueId(), false);
}
private Location getLocAtNormal(int x, int z, World world, Float yaw, Float pitch, WorldPlayer pWorld) {
Block b = world.getHighestBlockAt(x, z);
if (b.getType().toString().endsWith("AIR")) //1.15.1 or less
b = world.getBlockAt(x, b.getY() - 1, z);
else if (!b.getType().isSolid()) { //Water, lava, shrubs...
if (!badBlock(b.getType().name(), x, z, pWorld.getWorld(), null)) { //Make sure it's not an invalid block (ex: water, lava...)
//int y = world.getHighestBlockYAt(x, z);
b = world.getBlockAt(x, b.getY() - 1, z);
}
}
//System.out.println(b.getType().name());
if (b.getY() > 0 && !badBlock(b.getType().name(), x, z, pWorld.getWorld(), pWorld.getBiomes())) {
return new Location(world, (x + 0.5), b.getY() + 1, (z + 0.5), yaw, pitch);
}
return null;
}
private Location getLocAtNether(int x, int z, World world, Float yaw, Float pitch, WorldPlayer pWorld) {
//System.out.println("-----------");
for (int y = 1; y < world.getMaxHeight(); y++) {
// System.out.println("--");
Block block_current = world.getBlockAt(x, y, z);
//System.out.println(block_current.getType().name());
if (block_current.getType().name().endsWith("AIR") || !block_current.getType().isSolid()) {
//System.out.println(block_current.getType().name());
if (!block_current.getType().name().endsWith("AIR") &&
!block_current.getType().isSolid()) { //Block is not a solid (ex: lava, water...)
String block_in = block_current.getType().name();
if (badBlock(block_in, x, z, pWorld.getWorld(), null))
continue;//return null;
}
//System.out.println(block_current.getType().name());
String block = world.getBlockAt(x, y - 1, z).getType().name();
if (block.endsWith("AIR")) //Block below is air, skip
continue;
if (world.getBlockAt(x, y + 1, z).getType().name().endsWith("AIR") //Head space
&& !badBlock(block, x, z, pWorld.getWorld(), pWorld.getBiomes())) //Valid block
return new Location(world, (x + 0.5), y, (z + 0.5), yaw, pitch);
}
}
return null;
}
private boolean checkDepends(Location loc) {
return settings.softDepends.checkLocation(loc);
}
// Bad blocks, or bad biome
private boolean badBlock(String block, int x, int z, World world, List<String> biomes) {
for (String currentBlock : settings.blockList) //Check Block
if (currentBlock.toUpperCase().equals(block))
return true;
//Check Biomes
if (biomes == null || biomes.isEmpty())
return false;
String biomeCurrent = world.getBiome(x, z).name();
for (String biome : biomes)
if (biomeCurrent.toUpperCase().contains(biome.toUpperCase()))
return false;
return true;
//FALSE MEANS NO BAD BLOCKS/BIOME WHERE FOUND!
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@@ -1,143 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import br.net.fabiozumbi12.RedProtect.Bukkit.RedProtect;
import com.bekvon.bukkit.residence.Residence;
import com.massivecraft.factions.Board;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
import com.palmergames.bukkit.towny.TownyAPI;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.protection.ApplicableRegionSet;
import com.sk89q.worldguard.protection.regions.RegionContainer;
import com.sk89q.worldguard.protection.regions.RegionQuery;
import me.SuperRonanCraft.BetterRTP.Main;
import me.angeschossen.lands.api.integration.LandsIntegration;
import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Location;
public class RTPPluginValidation { //Safe locations depending on enabled dependencies
boolean checkLocation(Location loc) {
boolean plugin_worldguard = getWorlguard(loc);
boolean plugin_griefPrevention = getGriefprevention(loc);
boolean plugin_towny = getTowny(loc);
boolean plugin_redProtect = getRedProtect(loc);
boolean plugin_factionsUUID = getFactionsUUID(loc);
boolean plugin_lands = getLands(loc);
boolean plugin_residence = getResidence(loc);
return plugin_worldguard
&& plugin_griefPrevention
&& plugin_towny
&& plugin_redProtect
&& plugin_factionsUUID
&& plugin_lands
&& plugin_residence;
}
// TESTED (v2.12.3)
// Worldguard (v7.0.4 B1), WorldEdit (v7.2.0 B5)
// https://dev.bukkit.org/projects/worldguard
private boolean getWorlguard(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isWorldguard())
try {
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
RegionQuery query = container.createQuery();
ApplicableRegionSet set = query.getApplicableRegions(BukkitAdapter.adapt(loc));
result = set.size() == 0;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
// TESTED (v2.13.0)
// GriefPrevention (v16.15.0)
// https://www.spigotmc.org/resources/griefprevention.1884/
private boolean getGriefprevention(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isGriefprevention())
try {
result = GriefPrevention.instance.dataStore.getClaimAt(loc, true, null) == null;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
// NOT TESTED (2.13.0)
// Towny (v0.96.1.11)
// https://www.spigotmc.org/resources/towny.72694/
private boolean getTowny(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isTowny())
try {
result = TownyAPI.getInstance().isWilderness(loc);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
// TESTED (2.13.0)
// RedProtect (v7.7.2)
// https://www.spigotmc.org/resources/redprotect.15841/
private boolean getRedProtect(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isRedProtect())
try {
result = RedProtect.get().getAPI().getRegion(loc) == null;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
// NOT TESTED (2.13.2)
// FactionsUUID (v1.6.9.5-U0.5.16)
// https://www.spigotmc.org/resources/factionsuuid.1035/
private boolean getFactionsUUID(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isFactionsUUID())
try {
Faction faction = Board.getInstance().getFactionAt(new FLocation(loc));
result = faction.isWilderness() || faction.isWarZone() || faction.isSafeZone();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
// NOT TESTED (2.14.3)
// Lands (v4.9.4)
// https://www.spigotmc.org/resources/lands.53313/
private boolean getLands(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isLands())
try {
result = new LandsIntegration(Main.getInstance()).isClaimed(loc);
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
// NOT TESTED (2.14.3)
// Residence (v4.9.1.9)
// https://www.spigotmc.org/resources/residence.11480/
private boolean getResidence(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isResidence())
try {
result = Residence.getInstance().getResidenceManager().getByLoc(loc) == null;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@@ -1,66 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class RTPPotions { //Potions AND Invincibility
private boolean potionEnabled;
private final HashMap<PotionEffectType, Integer[]> potionEffects = new HashMap<>();
private boolean invincibleEnabled;
private int invincibleTime;
void load() {
potionEffects.clear();
FileBasics.FILETYPE config = FileBasics.FILETYPE.EFFECTS;
//Invincible
invincibleEnabled = config.getBoolean("Invincible.Enabled");
if (invincibleEnabled)
invincibleTime = config.getInt("Invincible.Seconds");
//Potions
potionEnabled = config.getBoolean("Potions.Enabled");
if (potionEnabled) {
List<String> list = config.getStringList("Potions.Types");
for (String p : list) {
String[] ary = p.replaceAll(" ", "").split(":");
String type = ary[0].trim();
PotionEffectType effect = PotionEffectType.getByName(type);
if (effect != null) {
try {
int duration = ary.length >= 2 ? Integer.parseInt(ary[1]) : 60;
int amplifier = ary.length >= 3 ? Integer.parseInt(ary[2]) : 1;
potionEffects.put(effect, new Integer[] {duration, amplifier});
} catch (NumberFormatException e) {
Main.getInstance().getLogger().info("The potion duration or amplifier `" + ary[1] + "` is not an integer. Effect was removed!");
}
} else
Main.getInstance().getLogger().info("The potion effect `" + type + "` does not exist! " +
"Please fix or remove this potion effect! Try '/rtp info potion_effects' to get a list of valid effects!");
}
}
}
void giveEffects(Player p) {
if (invincibleEnabled)
p.setNoDamageTicks(invincibleTime * 20);
if (potionEnabled) {
List<PotionEffect> effects = new ArrayList<>();
for (PotionEffectType e : potionEffects.keySet()) {
Integer[] mods = potionEffects.get(e);
int duration = mods[0];
int amplifier = mods[1];
effects.add(new PotionEffect(e, duration, amplifier, false, false));
}
p.addPotionEffects(effects);
}
}
}

View File

@@ -1,46 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
public class RTPSounds {
private boolean enabled;
private Sound
soundTeleport,
soundDelay;
void load() {
FileBasics.FILETYPE config = FileBasics.FILETYPE.EFFECTS;
enabled = config.getBoolean("Sounds.Enabled");
if (enabled) {
soundTeleport = getSound(config.getString("Sounds.Success"));
soundDelay = getSound(config.getString("Sounds.Delay"));
}
}
void playTeleport(Player p) {
if (!enabled) return;
if (soundTeleport != null)
p.playSound(p.getLocation(), soundTeleport, 1F, 1F);
}
void playDelay(Player p) {
if (!enabled) return;
if (soundDelay != null)
p.playSound(p.getLocation(), soundDelay, 1F, 1F);
}
private Sound getSound(String sound) {
try {
return Sound.valueOf(sound.toUpperCase());
} catch (IllegalArgumentException e) {
Main.getInstance().getLogger().info("The sound '" + sound + "' is invalid!");
return null;
}
}
}

View File

@@ -1,154 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import io.papermc.lib.PaperLib;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
//---
//Credit to @PaperMC for PaperLib - https://github.com/PaperMC/PaperLib
//
//Use of asyncronous chunk loading and teleporting
//---
public class RTPTeleport {
private final RTPParticles eParticles = new RTPParticles();
private final RTPPotions ePotions = new RTPPotions();
private final RTPSounds eSounds = new RTPSounds();
private final RTPTitles eTitles = new RTPTitles();
//public HashMap<Player, List<CompletableFuture<Chunk>>> playerLoads = new HashMap<>();
void load() {
eParticles.load();
ePotions.load();
eSounds.load();
eTitles.load();
}
// void cancel(Player p) { //Cancel loading chunks/teleporting
// if (!playerLoads.containsKey(p)) return;
// List<CompletableFuture<Chunk>> asyncChunks = playerLoads.get(p);
// CompletableFuture.allOf(asyncChunks.toArray(new CompletableFuture[] {})).cancel(true);
// }
void sendPlayer(final CommandSender sendi, final Player p, final Location loc, final int price,
final int attempts) throws NullPointerException {
loadingTeleport(p, sendi); //Send loading message to player who requested
List<CompletableFuture<Chunk>> asyncChunks = getChunks(loc); //Get a list of chunks
//playerLoads.put(p, asyncChunks);
CompletableFuture.allOf(asyncChunks.toArray(new CompletableFuture[] {})).thenRun(() -> { //Async chunk load
new BukkitRunnable() { //Run synchronously
@Override
public void run() {
try {
PaperLib.teleportAsync(p, loc).thenRun(new BukkitRunnable() { //Async teleport
@Override
public void run() {
afterTeleport(p, loc, price, attempts);
if (sendi != p) //Tell player who requested that the player rtp'd
sendSuccessMsg(sendi, p.getName(), loc, price, false, attempts);
getPl().getCmd().rtping.remove(p.getUniqueId()); //No longer rtp'ing
//Save respawn location if first join
if (Main.getInstance().getpInfo().getRTPType(p) == RTP_TYPE.JOIN) //RTP Type was Join
if (Main.getInstance().getSettings().rtpOnFirstJoin_SetAsRespawn) //Save as respawn is enabled
p.setBedSpawnLocation(loc, true); //True means to force a respawn even without a valid bed
}
});
} catch (Exception e) {
getPl().getCmd().rtping.remove(p.getUniqueId()); //No longer rtp'ing (errored)
e.printStackTrace();
}
}
}.runTask(getPl());
});
}
//Effects
public void afterTeleport(Player p, Location loc, int price, int attempts) { //Only a successful rtp should run this OR '/rtp test'
eSounds.playTeleport(p);
eParticles.display(p);
ePotions.giveEffects(p);
eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.TELEPORT, p, loc, attempts, 0);
if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.TELEPORT))
sendSuccessMsg(p, p.getName(), loc, price, true, attempts);
}
public void beforeTeleportInstant(CommandSender sendi, Player p) {
eSounds.playDelay(p);
eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.NODELAY, p, p.getLocation(), 0, 0);
if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.NODELAY))
getPl().getText().getSuccessTeleport(sendi);
}
public void beforeTeleportDelay(Player p, int delay) { //Only Delays should call this
eSounds.playDelay(p);
eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.DELAY, p, p.getLocation(), 0, delay);
if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.DELAY))
getPl().getText().getDelay(p, delay);
}
public void cancelledTeleport(Player p) { //Only Delays should call this
eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.CANCEL, p, p.getLocation(), 0, 0);
if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.CANCEL))
getPl().getText().getMoved(p);
}
private void loadingTeleport(Player p, CommandSender sendi) {
eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.LOADING, p, p.getLocation(), 0, 0);
if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.LOADING) || sendi != p) //Show msg if enabled or if not same player
getPl().getText().getSuccessLoading(sendi);
}
public void failedTeleport(Player p, CommandSender sendi) {
eTitles.showTitle(RTPTitles.RTP_TITLE_TYPE.FAILED, p, p.getLocation(), 0, 0);
if (eTitles.sendMsg(RTPTitles.RTP_TITLE_TYPE.FAILED))
if (p == sendi)
getPl().getText().getFailedNotSafe(sendi, Main.getInstance().getRTP().maxAttempts);
else
getPl().getText().getOtherNotSafe(sendi, Main.getInstance().getRTP().maxAttempts, p.getName());
}
//Processing
private List<CompletableFuture<Chunk>> getChunks(Location loc) { //List all chunks in range to load
List<CompletableFuture<Chunk>> asyncChunks = new ArrayList<>();
int range = Math.round(Math.max(0, Math.min(16, getPl().getSettings().preloadRadius)));
for (int x = -range; x <= range; x++) {
for (int z = -range; z <= range; z++) {
Location locLoad = new Location(loc.getWorld(), loc.getX() + (x * 16), loc.getY(), loc.getZ() + (z * 16));
CompletableFuture<Chunk> chunk = PaperLib.getChunkAtAsync(locLoad, true);
asyncChunks.add(chunk);
}
}
return asyncChunks;
}
private void sendSuccessMsg(CommandSender sendi, String player, Location loc, int price, boolean sameAsPlayer,
int attempts) {
String x = Integer.toString(loc.getBlockX());
String y = Integer.toString(loc.getBlockY());
String z = Integer.toString(loc.getBlockZ());
String world = loc.getWorld().getName();
if (sameAsPlayer) {
if (price == 0)
getPl().getText().getSuccessBypass(sendi, x, y, z, world, attempts);
else
getPl().getText().getSuccessPaid(sendi, price, x, y, z, world, attempts);
} else
getPl().getText().getOtherSuccess(sendi, player, x, y, z, world, attempts);
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@@ -1,76 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import net.md_5.bungee.api.ChatMessageType;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.HashMap;
public class RTPTitles {
boolean enabled = false;
private final HashMap<RTP_TITLE_TYPE, RTP_TITLE> titles = new HashMap<>();
void load() {
titles.clear();
FileBasics.FILETYPE config = FileBasics.FILETYPE.EFFECTS;
enabled = config.getBoolean("Titles.Enabled");
if (enabled)
for (RTP_TITLE_TYPE type : RTP_TITLE_TYPE.values())
titles.put(type, new RTP_TITLE(type.path));
}
void showTitle(RTP_TITLE_TYPE type, Player p, Location loc, int attempts, int delay) {
if (titles.containsKey(type)) {
String title = getPlaceholders(titles.get(type).title, p, loc, attempts, delay);
String sub = getPlaceholders(titles.get(type).subTitle, p, loc, attempts, delay);
show(p, title, sub);
}
}
boolean sendMsg(RTP_TITLE_TYPE type) {
return titles.containsKey(type) && titles.get(type).send_message || !enabled;
}
private String getPlaceholders(String str, Player p, Location loc, int attempts, int delay) {
return str.replace("%player%", p.getName())
.replace("%x%", String.valueOf(loc.getBlockX()))
.replace("%y%", String.valueOf(loc.getBlockY()))
.replace("%z%", String.valueOf(loc.getBlockZ()))
.replace("%attempts%", String.valueOf(attempts))
.replace("%time%", String.valueOf(delay));
}
private void show(Player p, String title, String sub) {
// int fadeIn = getPl().text.getFadeIn();
// int stay = text.getStay();
// int fadeOut = text.getFadeOut();
title = Main.getInstance().getText().color(title);
sub = Main.getInstance().getText().color(sub);
p.sendTitle(title, sub);
// player.sendTitle(title, subTitle, fadeIn, stay, fadeOut);
}
enum RTP_TITLE_TYPE {
NODELAY("NoDelay"), TELEPORT("Teleport"), DELAY("Delay"), CANCEL("Cancelled"), LOADING("Loading"), FAILED("Failed");
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

@@ -1,7 +0,0 @@
package me.SuperRonanCraft.BetterRTP.player.rtp;
public enum RTP_TYPE {
COMMAND, //Player executed command
FORCED, //Player was forced to rtp (/rtp player <player>)
JOIN //Player joined and was rtp'd automatically
}

View File

@@ -1,101 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references;
import me.SuperRonanCraft.BetterRTP.references.depends.DepPerms;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
public class Permissions {
private final DepPerms depPerms = new DepPerms();
public void register() {
depPerms.register();
}
private final String pre = "betterrtp.";
public boolean getUse(CommandSender sendi) {
return perm(pre + "use", sendi);
}
public boolean getBypassEconomy(CommandSender sendi) {
return perm(pre + "bypass.economy", sendi);
}
public boolean getBypassHunger(CommandSender sendi) {
return perm(pre + "bypass.hunger", sendi);
}
public boolean getBypassCooldown(CommandSender sendi) {
return perm(pre + "bypass.cooldown", sendi);
}
public boolean getBypassDelay(CommandSender sendi) {
return perm(pre + "bypass.delay", sendi);
}
public boolean getReload(CommandSender sendi) {
return perm(pre + "reload", sendi);
}
public boolean getSettings(CommandSender sendi) {
return perm(pre + "settings", sendi);
}
public boolean getInfo(CommandSender sendi) {
return perm(pre + "info", sendi);
}
public boolean getUpdate(CommandSender sendi) {
return perm(pre + "updater", sendi);
}
public boolean getRtpOther(CommandSender sendi) {
return perm(pre + "player", sendi);
}
public boolean getBiome(CommandSender sendi) {
return perm(pre + "biome", sendi);
}
public boolean getWorld(CommandSender sendi) {
return perm(pre + "world", sendi);
}
public boolean getSignCreate(CommandSender sendi) {
return perm(pre + "sign", sendi);
}
public boolean getTest(CommandSender sendi) {
return perm(pre + "test", sendi);
}
public boolean getVersion(CommandSender sendi) {
return perm(pre + "version", sendi);
}
public boolean getAWorld(CommandSender sendi, String world) {
if (perm(pre + "world.*", sendi))
return true;
else if (world == null) {
for (World w : Bukkit.getWorlds())
if (perm(pre + "world." + w.getName(), sendi))
return true;
} else
return perm(pre + "world." + world, sendi);
return false;
}
public boolean getEdit(CommandSender sendi) {
return perm(pre + "edit", sendi);
}
public boolean getPermissionGroup(CommandSender sendi, String group) {
return perm(pre + "group." + group, sendi);
}
private boolean perm(String str, CommandSender sendi) {
return depPerms.hasPerm(str, sendi);
}
}

View File

@@ -1,32 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.Bukkit;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
public class Updater {
public static String updatedVersion;
public Updater(Main pl) {
try {
URLConnection con = new URL(getUrl() + project()).openConnection();
updatedVersion = new BufferedReader(new InputStreamReader(con.getInputStream())).readLine();
} catch (Exception ex) {
Bukkit.getConsoleSender().sendMessage("[BetterRTP] Failed to check for an update on spigot");
updatedVersion = pl.getDescription().getVersion();
}
}
private String getUrl() {
return "https://api.spigotmc.org/legacy/update.php?resource=";
}
private String project() {
return "36081";
}
}

View File

@@ -1,114 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.depends;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.worlds.WorldPlayer;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.economy.EconomyResponse;
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.RegisteredServiceProvider;
public class DepEconomy {
private Economy e;
private int hunger = 0;
private boolean checked = false;
public boolean charge(CommandSender sendi, WorldPlayer pWorld) {
check(false);
Player player = pWorld.getPlayer();
//Hunger Stuff
boolean took_food = false;
if (hunger != 0
&& sendi == player
&& (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE)) {
boolean has_hunger = player.getFoodLevel() > hunger;
if (!has_hunger) {
Main.getInstance().getText().getFailedHunger(sendi);
return false;
} else {
player.setFoodLevel(player.getFoodLevel() - hunger);
took_food = true;
}
}
//Economy Stuff
if (e != null && pWorld.getPrice() != 0 && !Main.getInstance().getPerms().getBypassEconomy(sendi)) {
try {
EconomyResponse r = e.withdrawPlayer(player, pWorld.getPrice());
boolean passed_economy = r.transactionSuccess();
if (!passed_economy) {
Main.getInstance().getText().getFailedPrice(sendi, pWorld.getPrice());
if (took_food)
player.setFoodLevel(player.getFoodLevel() + hunger);
} else
pWorld.eco_money_taken = true;
return passed_economy;
} catch (Exception e) {
e.printStackTrace();
}
}
//Default value
return true;
}
public boolean hasBalance(CommandSender sendi, WorldPlayer pWorld) {
check(false);
Player player = pWorld.getPlayer();
//Hunger Stuff
if (hunger != 0
&& !Main.getInstance().getPerms().getBypassHunger(sendi)
&& (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE)) {
boolean has_hunger = player.getFoodLevel() > hunger;
if (!has_hunger) {
Main.getInstance().getText().getFailedHunger(sendi);
return false;
}
}
//Economy Stuff
if (e != null && pWorld.getPrice() != 0 && !Main.getInstance().getPerms().getBypassEconomy(sendi)) {
try {
boolean passed_economy = e.getBalance(player) >= pWorld.getPrice();
if (!passed_economy) {
Main.getInstance().getText().getFailedPrice(sendi, pWorld.getPrice());
return false;
}
} catch (Exception e) {
e.printStackTrace();
}
}
//Default value
return true;
}
/*public void unCharge(Player p, WorldPlayer pWorld) {
if (e != null && pWorld.getPrice() != 0 && pWorld.eco_money_taken)
e.depositPlayer(p, pWorld.getPrice());
}*/
public void load() {
check(true);
}
private void check(boolean force) {
if (!checked || force)
registerEconomy();
if (Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getBoolean("Hunger.Enabled"))
hunger = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getInt("Hunger.Honches");
else
hunger = 0;
}
private void registerEconomy() {
try {
if (Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getBoolean("Economy.Enabled"))
if (Main.getInstance().getServer().getPluginManager().isPluginEnabled("Vault")) {
RegisteredServiceProvider<Economy> rsp = Main.getInstance().getServer().getServicesManager().getRegistration(Economy.class);
e = rsp.getProvider();
}
} catch (NullPointerException e) {
//
}
checked = true;
}
}

View File

@@ -1,30 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.depends;
import me.SuperRonanCraft.BetterRTP.Main;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.RegisteredServiceProvider;
public class DepPerms {
public Permission p = null;
public boolean hasPerm(String perm, CommandSender sendi) {
//sendi.sendMessage(perm);
if (p != null)
return p.has(sendi, perm);
return sendi.hasPermission(perm);
}
public void register() {
try {
if (Main.getInstance().getServer().getPluginManager().isPluginEnabled("Vault")) {
RegisteredServiceProvider<Permission> permissionProvider = Main.getInstance().getServer()
.getServicesManager().getRegistration(Permission.class);
p = permissionProvider.getProvider();
} else
p = null;
} catch (NullPointerException e) {
//Vault but no Perms
}
}
}

View File

@@ -1,64 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.file;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
public class EcoFile {
private YamlConfiguration lang = new YamlConfiguration();
private File langFile;
void load() {
Main pl = Main.getInstance();
langFile = new File(pl.getDataFolder(), "economy.yml");
if (!langFile.exists())
pl.saveResource("economy.yml", false);
loadFile();
}
public String getString(String path) {
if (lang.isString(path))
return lang.getString(path);
return "SOMETHING WENT WRONG";
}
@SuppressWarnings("all")
public List<String> getStringList(String path) {
if (lang.isList(path))
return lang.getStringList(path);
return Arrays.asList("SOMETHING WENT WRONG!");
}
public int getInt(String path) {
return lang.getInt(path);
}
public boolean getBoolean(String path) {
return lang.getBoolean(path);
}
private void loadFile() {
try {
lang.load(langFile);
setDefaults();
lang.save(langFile);
} catch (Exception e) {
e.printStackTrace();
}
}
private void setDefaults() {
final InputStream defConfigStream = Main.getInstance().getResource("economy.yml");
if (defConfigStream == null)
return;
lang.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(defConfigStream)));
lang.options().copyDefaults(true);
}
}

View File

@@ -1,110 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.file;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class FileBasics {
List<FILETYPE> types = new ArrayList<>();
void load() {
types.clear();
for (FILETYPE type : FILETYPE.values()) {
type.load();
types.add(type);
}
}
public enum FILETYPE {
CONFIG("config"), ECO("economy"), SIGNS("signs"), EFFECTS("effects");
private final String fileName;
private final YamlConfiguration config = new YamlConfiguration();
private final File file;
FILETYPE(String str) {
this.fileName = str + ".yml";
this.file = new File(Main.getInstance().getDataFolder(), fileName);
}
//PUBLIC
public String getString(String path) {
if (config.isString(path))
return config.getString(path);
return "SOMETHING WENT WRONG";
}
public boolean getBoolean(String path) {
return config.getBoolean(path);
}
public int getInt(String path) {
return config.getInt(path);
}
public List<String> getStringList(String path) {
if (config.isList(path))
return config.getStringList(path);
return new ArrayList<>();
}
public ConfigurationSection getConfigurationSection(String path) {
return config.getConfigurationSection(path);
}
public boolean isString(String path) {
return config.isString(path);
}
public boolean isList(String path) {
return config.isList(path);
}
public List<Map<?, ?>> getMapList(String path) {
return config.getMapList(path);
}
public YamlConfiguration getConfig() {
return config;
}
public File getFile() {
return file;
}
public void setValue(String path, Object value) {
config.set(path, value);
}
//PROCCESSING
private void load() {
if (!file.exists()) {
Main.getInstance().saveResource(fileName, false);
try {
config.load(file);
} catch (Exception e) {
e.printStackTrace();
}
} else {
try {
config.load(file);
final InputStream in = Main.getInstance().getResource(fileName);
if (in != null) {
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(in)));
config.options().copyDefaults(true);
in.close();
}
config.save(file);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}

View File

@@ -1,20 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.file;
public class Files {
private final LangFile langFile = new LangFile();
private final FileBasics basics = new FileBasics();
LangFile getLang() {
return langFile;
}
public FileBasics.FILETYPE getType(FileBasics.FILETYPE type) {
return basics.types.get(basics.types.indexOf(type));
}
public void loadAll() {
basics.load();
langFile.load();
}
}

View File

@@ -1,95 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.file;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.configuration.file.YamlConfiguration;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
public class LangFile {
private YamlConfiguration config = new YamlConfiguration();
String getString(String path) {
if (config.isString(path))
return config.getString(path);
return "SOMETHING WENT WRONG";
}
@SuppressWarnings("all")
public List<String> getStringList(String path) {
if (config.isList(path))
return config.getStringList(path);
return Arrays.asList("SOMETHING WENT WRONG!");
}
public boolean getBoolean(String path) {
return config.getBoolean(path);
}
@SuppressWarnings("all")
public void load() {
generateDefaults();
String fileName = "lang" + File.separator + getPl().getFiles().getType(FileBasics.FILETYPE.CONFIG).getString("Language-File");
File file = new File(getPl().getDataFolder(), fileName);
if (!file.exists()) {
fileName = "lang" + File.separator + defaultLangs[0]; //Default to english
file = new File(getPl().getDataFolder(), fileName);
}
try {
config.load(file);
InputStream in = Main.getInstance().getResource(fileName);
if (in == null)
in = getPl().getResource(fileName.replace(File.separator, "/"));
if (in != null) {
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(in)));
config.options().copyDefaults(true);
in.close();
}
config.save(file);
} catch (Exception e) {
e.printStackTrace();
}
}
private final String[] defaultLangs = {"en.yml", "fr.yml", "ja.yml", "ru.yml", "chs.yml", "cht.yml", "du.yml", "es.yml", "cs.yml"};
private void generateDefaults() {
//Generate all language files
for (String yaml : defaultLangs) {
generateDefaultConfig(yaml, yaml); //Generate its own defaults
if (!yaml.equals(defaultLangs[0]))
generateDefaultConfig(yaml, defaultLangs[0]); //Generate the english defaults (incase)
}
}
private void generateDefaultConfig(String fName, String fNameDef /*Name of file to generate defaults*/) {
String fileName = "lang" + File.separator + fName;
File file = new File(getPl().getDataFolder(), fileName);
if (!file.exists())
getPl().saveResource(fileName, false);
try {
YamlConfiguration config = new YamlConfiguration();
config.load(file);
String fileNameDef = "lang" + File.separator + fNameDef;
InputStream in = Main.getInstance().getResource(fileNameDef);
if (in == null)
in = getPl().getResource(fileNameDef.replace(File.separator, "/"));
if (in != null) {
config.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(in)));
config.options().copyDefaults(true);
in.close();
}
config.save(file);
} catch (Exception e) {
e.printStackTrace();
}
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@@ -1,233 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.file;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.command.CommandSender;
import java.util.Arrays;
import java.util.List;
public class Messages {
private final String preM = "Messages.", preH = "Help.", preU = "Usage.";
private LangFile getLang() {
return Main.getInstance().getFiles().getLang();
}
public void sms(CommandSender sendi, String msg) {
if (!msg.equals(""))
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
public void getSuccessPaid(CommandSender sendi, int price, String x, String y, String z, String world, int
attempts) {
sms(sendi, getLang().getString(preM + "Success.Paid").replaceAll("%price%", String.valueOf(price)).replaceAll
("%x%", x).replaceAll("%y%", y).replaceAll("%z%", z).replaceAll("%world%", world).replaceAll
("%attempts%", Integer.toString(attempts)));
}
public void getSuccessBypass(CommandSender sendi, String x, String y, String z, String world, int attemtps) {
sms(sendi, getLang().getString(preM + "Success.Bypass").replaceAll("%x%", x).replaceAll("%y%", y).replaceAll
("%z%", z).replaceAll("%world%", world).replaceAll("%attempts%", Integer.toString(attemtps)));
}
public void getSuccessLoading(CommandSender sendi) {
sms(sendi, getLang().getString(preM + "Success.Loading"));
}
public void getSuccessTeleport(CommandSender sendi) {
sms(sendi, getLang().getString(preM + "Success.Teleport"));
}
//FAILED
public void getFailedNotSafe(CommandSender sendi, int attempts) {
sms(sendi, getLang().getString(preM + "Failed.NotSafe").replaceAll("%attempts%", Integer.toString(attempts)));
}
public void getFailedPrice(CommandSender sendi, int price) {
sms(sendi, getLang().getString(preM + "Failed.Price").replaceAll("%price%", String.valueOf(price)));
}
public void getFailedHunger(CommandSender sendi) {
sms(sendi, getLang().getString(preM + "Failed.Hunger"));
}
public void getOtherNotSafe(CommandSender sendi, int attempts, String player) {
sms(sendi, getLang().getString(preM + "Other.NotSafe").replaceAll("%attempts%", Integer.toString(attempts))
.replaceAll("%player%", player));
}
public void getOtherSuccess(CommandSender sendi, String player, String x, String y, String z, String world, int
attempts) {
sms(sendi, getLang().getString(preM + "Other.Success").replaceAll("%player%", player).replaceAll("%x%", x)
.replaceAll("%y%", y).replaceAll("%z%", z).replaceAll("%world%", world).replaceAll("%attempts%",
Integer.toString(attempts)));
}
public void getOtherBiome(CommandSender sendi, String biome) {
sms(sendi, getLang().getString(preM + "Other.Biome").replaceAll("%biome%", biome));
}
public void getNotExist(CommandSender sendi, String world) {
sms(sendi, getLang().getString(preM + "NotExist").replaceAll("%world%", world));
}
public void getReload(CommandSender sendi) {
sms(sendi, getLang().getString(preM + "Reload"));
}
public void getNoPermission(CommandSender sendi) {
sms(sendi, getLang().getString(preM + "NoPermission.Basic"));
}
public void getNoPermissionWorld(CommandSender sendi, String world) {
sms(sendi, getLang().getString(preM + "NoPermission.World").replaceAll("%world%", world));
}
public void getDisabledWorld(CommandSender sendi, String world) {
sms(sendi, getLang().getString(preM + "DisabledWorld").replaceAll("%world%", world));
}
public void getCooldown(CommandSender sendi, String time) {
sms(sendi, getLang().getString(preM + "Cooldown").replaceAll("%time%", time));
}
public void getInvalid(CommandSender sendi, String cmd) {
sms(sendi, getLang().getString(preM + "Invalid").replaceAll("%command%", cmd));
}
public void getNotOnline(CommandSender sendi, String player) {
sms(sendi, getLang().getString(preM + "NotOnline").replaceAll("%player%", player));
}
public void getDelay(CommandSender sendi, int time) {
sms(sendi, getLang().getString(preM + "Delay").replaceAll("%time%", String.valueOf(time)));
}
public void getSignCreated(CommandSender sendi, String cmd) {
sms(sendi, getLang().getString(preM + "Sign").replaceAll("%command%", cmd));
}
public void getMoved(CommandSender sendi) {
sms(sendi, getLang().getString(preM + "Moved"));
}
public void getAlready(CommandSender sendi) {
sms(sendi, getLang().getString(preM + "Already"));
}
private String getPrefix() {
return getLang().getString(preM + "Prefix");
}
public String color(String str) {
return ChatColor.translateAlternateColorCodes('&', str);
}
public String colorPre(String 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
public String getHelpPrefix() {
return getLang().getString(preH + "Prefix");
}
public String getHelpMain() { //rtp
return getLang().getString(preH + "Main");
}
public String getHelpBiome() { //rtp biome
return getLang().getString(preH + "Biome");
}
public String getHelpEdit() { //rtp edit
return getLang().getString(preH + "Edit");
}
public String getHelpHelp() { //rtp help
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() {
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
public void getUsageRTPOther(CommandSender sendi, String cmd) {
sms(sendi, getLang().getString(preU + "Player").replaceAll("%command%", cmd));
}
public void getUsageWorld(CommandSender sendi, String cmd) {
sms(sendi, getLang().getString(preU + "World").replaceAll("%command%", cmd));
}
public void getUsageBiome(CommandSender sendi, String cmd) {
sms(sendi, getLang().getString(preU + "Biome").replaceAll("%command%", cmd));
}
public void getUsageEdit(CommandSender sendi, String cmd) {
sms(sendi, getLang().getString(preU + "Edit.Base").replaceAll("%command%", cmd));
}
public void getUsageEditDefault(CommandSender sendi, String cmd) {
sms(sendi, getLang().getString(preU + "Edit.Default").replaceAll("%command%", cmd));
}
public void getUsageEditWorld(CommandSender sendi, String cmd) {
sms(sendi, getLang().getString(preU + "Edit.World").replaceAll("%command%", cmd));
}
// Not Found
public void error(CommandSender sendi) {
sms(sendi, "&cERROR &7Seems like your Administrator did not update their language file!");
}
}

View File

@@ -1,35 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory_Defaults;
import me.SuperRonanCraft.BetterRTP.Main;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.HashMap;
public class RTPInventories {
private HashMap<RTP_INV_SETTINGS, RTPInventory_Defaults> invs = new HashMap<>();
public void load() {
invs.clear();
for (RTP_INV_SETTINGS type : RTP_INV_SETTINGS.values()) {
type.load(type);
invs.put(type, type.getInv());
}
}
public void closeAll() {
Main main = Main.getInstance();
for (Player p : Bukkit.getOnlinePlayers())
if (main.getpInfo().playerExists(p)) {
//main.getText().getReloadMenu(p);
main.getpInfo().clear(p);
p.closeInventory();
}
}
public RTPInventory_Defaults getInv(RTP_INV_SETTINGS type) {
return invs.get(type);
}
}

View File

@@ -1,34 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory;
import me.SuperRonanCraft.BetterRTP.references.invs.types.RTPInvBlacklist;
import me.SuperRonanCraft.BetterRTP.references.invs.types.RTPInvCoordinates;
import me.SuperRonanCraft.BetterRTP.references.invs.types.RTPInvMain;
import me.SuperRonanCraft.BetterRTP.references.invs.types.RTPInvWorlds;
public enum RTP_INV_SETTINGS {
MAIN(new RTPInvMain(), false),
BLACKLIST(new RTPInvBlacklist(), true),
COORDINATES(new RTPInvCoordinates(), true),
WORLDS(new RTPInvWorlds(), false);
private RTPInventory inv;
private boolean showInMain;
RTP_INV_SETTINGS(RTPInventory inv, boolean showInMain) {
this.inv = inv;
this.showInMain = showInMain;
}
public RTPInventory getInv() {
return inv;
}
public Boolean getShowMain() {
return showInMain;
}
void load(RTP_INV_SETTINGS type) {
inv.load(type);
}
}

View File

@@ -1,82 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics.FILETYPE;
public enum RTP_SETTINGS {
BLACKLIST( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Template.Enabled",
new Object[]{true, "Templates", "&7Toggle Templates system", "paper"});
SETTINGS_TYPE type;
FILETYPE filetype;
String path;
String[] condition = null;
Object[] info; // = new Object[]{false}; //ENABLED, NAME, DESCRIPTION, ITEM
RTP_SETTINGS(SETTINGS_TYPE type, FILETYPE filetype, String path, Object[] info) {
this.type = type;
this.filetype = filetype;
this.path = path;
this.info = info;
}
RTP_SETTINGS(SETTINGS_TYPE type, FILETYPE filetype, String[] arry, Object[] info) {
this.type = type;
this.filetype = filetype;
this.path = null;
this.info = info;
//Condition
this.condition = arry;
}
void setValue(Object value) {
Main.getInstance().getFiles().getType(filetype).setValue(path, value);
}
public Object[] getInfo() {return info;}
public Object getValue() {
String path = this.path;
if (path == null && condition != null) {
if (Main.getInstance().getFiles().getType(filetype).getBoolean(condition[0]))
path = condition[1];
else
path = condition[2];
}
return getValuePath(path);
}
private Object getValuePath(String path) {
if (path != null) {
if (getType() == SETTINGS_TYPE.BOOLEAN)
return Main.getInstance().getFiles().getType(filetype).getBoolean(path);
else if (getType() == SETTINGS_TYPE.STRING)
return Main.getInstance().getFiles().getType(filetype).getString(path);
else if (getType() == SETTINGS_TYPE.INTEGER)
return Main.getInstance().getFiles().getType(filetype).getInt(path);
}
return null;
}
public SETTINGS_TYPE getType() {
return type;
}
public FILETYPE getFiletype() {
return filetype;
}
}
enum SETTINGS_TYPE {
BOOLEAN(Boolean.class), STRING(String.class), INTEGER(Integer.class);
private Class cla;
SETTINGS_TYPE(Class cla) {
this.cla = cla;
}
Class getCla() {
return cla;
}
}

View File

@@ -1,12 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs.enums;
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
public abstract class RTPInventory implements RTPInventory_Defaults {
public RTP_INV_SETTINGS type;
public void load(RTP_INV_SETTINGS type) {
this.type = type;
}
}

View File

@@ -1,46 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs.enums;
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import java.util.List;
public interface RTPInventory_Defaults {
void show(Player p);
void clickEvent(InventoryClickEvent event);
default ItemStack createItem(String item, int amount, String name, List<String> lore) {
Material mat = Material.valueOf(item.toUpperCase());
ItemStack _stack = new ItemStack(mat, amount);
ItemMeta _meta = _stack.getItemMeta();
if (_meta != null) {
if (lore != null)
_meta.setLore(lore);
if (name != null)
_meta.setDisplayName(Main.getInstance().getText().color(name));
}
_stack.setItemMeta(_meta);
return _stack;
}
default void cacheInv(Player p, Inventory inv, RTP_INV_SETTINGS type) {
PlayerInfo info = Main.getInstance().getpInfo();
info.setInv(p, inv);
info.setInvType(p, type);
}
default Inventory createInv(int size, String title) {
title = Main.getInstance().getText().color(title);
return Bukkit.createInventory(null, size, title);
}
}

View File

@@ -1,21 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs.enums;
public enum RTP_INV_ITEMS {
NORMAL("paper", 1),
BACK("book", 1, "Back", 0);
public String item, name;
public int amt, slot = -1;
RTP_INV_ITEMS(String item, int amt) {
this.item = item;
this.amt = amt;
}
RTP_INV_ITEMS(String item, int amt, String name, int slot) {
this.item = item;
this.amt = amt;
this.name = name;
this.slot = slot;
}
}

View File

@@ -1,50 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTP_INV_ITEMS;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class RTPInvBlacklist extends RTPInventory {
public void show(Player p) {
int slots = (Bukkit.getWorlds().size() - (Bukkit.getWorlds().size() % 9) + 1) * 9;
if (slots < 6 * 9)
slots += 9;
Inventory inv = this.createInv(slots, "Settings: &lBlacklist");
int _index = 0;
for (World world : Bukkit.getWorlds()) {
if (_index > 9 * 5)
break;
ItemStack _item = createItem(RTP_INV_ITEMS.NORMAL.item, RTP_INV_ITEMS.NORMAL.amt, world.getName(), null);
inv.setItem(_index, _item);
_index ++;
}
ItemStack _item = createItem(RTP_INV_ITEMS.BACK.item, RTP_INV_ITEMS.BACK.amt, RTP_INV_ITEMS.BACK.name, null);
inv.setItem(inv.getSize() - 9 + RTP_INV_ITEMS.BACK.slot, _item);
p.openInventory(inv);
this.cacheInv(p, inv, this.type);
}
@Override
public void clickEvent(InventoryClickEvent e) {
int slot = e.getSlot();
for (RTP_INV_ITEMS type : RTP_INV_ITEMS.values()) {
if (type.slot != -1) {
switch (type) {
case BACK:
if (slot == e.getInventory().getSize() - 9 + type.slot)
Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show((Player) e.getWhoClicked());
default:
break;
}
}
}
}
}

View File

@@ -1,146 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs.types;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics.FILETYPE;
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTP_INV_ITEMS;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import java.util.ArrayList;
public class RTPInvCoordinates extends RTPInventory {
public void show(Player p) {
if (Main.getInstance().getpInfo().getInvWorld(p) == null) {
Main.getInstance().getpInfo().setNextInv(p, this.type);
Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.WORLDS).show(p);
return;
}
int slots = (RTP_COORDINATES_SETTINGS.values().length - (RTP_COORDINATES_SETTINGS.values().length % 9) + 1) * 9;
if (slots < 6 * 9)
slots += 9;
Inventory inv = this.createInv(slots, "Settings: &lCoordinates");
int index = 0;
for (RTP_COORDINATES_SETTINGS set : RTP_COORDINATES_SETTINGS.values()) {
ItemStack _item = createItem(RTP_INV_ITEMS.NORMAL.item, RTP_INV_ITEMS.NORMAL.amt, "&a&l" + set.getInfo()[1], null);
inv.setItem(index, _item);
index++;
}
ItemStack _item = createItem(RTP_INV_ITEMS.BACK.item, RTP_INV_ITEMS.BACK.amt, RTP_INV_ITEMS.BACK.name, null);
inv.setItem(inv.getSize() - 9 + RTP_INV_ITEMS.BACK.slot, _item);
p.openInventory(inv);
this.cacheInv(p, inv, this.type);
}
@Override
public void clickEvent(InventoryClickEvent e) {
int slot = e.getSlot();
for (RTP_COORDINATES_SETTINGS set : RTP_COORDINATES_SETTINGS.values()) {
}
for (RTP_INV_ITEMS type : RTP_INV_ITEMS.values()) {
if (type.slot != -1) {
switch (type) {
case BACK:
if (slot == e.getInventory().getSize() - 9 + type.slot)
Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show((Player) e.getWhoClicked());
default:
break;
}
}
}
}
}
enum RTP_COORDINATES_SETTINGS {
CENTER_Z( SETTINGS_TYPE.INTEGER, FILETYPE.CONFIG, "Settings.Importance.Enabled",
new Object[]{true, "Center Z", "&7Toggle Categories system", "paper"}),
CENTER_X( SETTINGS_TYPE.INTEGER, FILETYPE.CONFIG, "Settings.Cooldown.Enabled",
new Object[]{true, "Center X", "&7Toggle Cooldown system", "paper"}),
USE_WORLDBORDER( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Settings.Cooldown.Time",
new Object[]{true, "Cooldown Time", new ArrayList<String>() {{
add("&7Set the time (in minutes)");
add("&7between making a new ticket");
}}, "paper"}),
/*DEBUG( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Settings.Debug",
new Object[]{true, "Debug", "&7Toggle debugger", "paper"}),
TEMPLATE( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Template.Enabled",
new Object[]{true, "Templates", "&7Toggle Templates system", "paper"});*/;
SETTINGS_TYPE type;
FILETYPE filetype;
String path;
String[] condition = null;
Object[] info; // = new Object[]{false}; //ENABLED, NAME, DESCRIPTION, ITEM
RTP_COORDINATES_SETTINGS(SETTINGS_TYPE type, FILETYPE filetype, String path, Object[] info) {
this.type = type;
this.filetype = filetype;
this.path = path;
this.info = info;
}
RTP_COORDINATES_SETTINGS(SETTINGS_TYPE type, FILETYPE filetype, String[] arry, Object[] info) {
this.type = type;
this.filetype = filetype;
this.path = null;
this.info = info;
//Condition
this.condition = arry;
}
void setValue(Object value) {
Main.getInstance().getFiles().getType(filetype).setValue(path, value);
}
public Object[] getInfo() {return info;}
public Object getValue() {
String path = this.path;
if (path == null && condition != null) {
if (Main.getInstance().getFiles().getType(filetype).getBoolean(condition[0]))
path = condition[1];
else
path = condition[2];
}
return getValuePath(path);
}
private Object getValuePath(String path) {
if (path != null) {
if (getType() == SETTINGS_TYPE.BOOLEAN)
return Main.getInstance().getFiles().getType(filetype).getBoolean(path);
else if (getType() == SETTINGS_TYPE.STRING)
return Main.getInstance().getFiles().getType(filetype).getString(path);
else if (getType() == SETTINGS_TYPE.INTEGER)
return Main.getInstance().getFiles().getType(filetype).getInt(path);
}
return null;
}
public SETTINGS_TYPE getType() {
return type;
}
public FILETYPE getFiletype() {
return filetype;
}
enum SETTINGS_TYPE {
BOOLEAN(Boolean.class), STRING(String.class), INTEGER(Integer.class);
private Class cla;
SETTINGS_TYPE(Class cla) {
this.cla = cla;
}
Class getCla() {
return cla;
}
}
}

View File

@@ -1,43 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs.types;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory;
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class RTPInvMain extends RTPInventory {
public void show(Player p) {
Inventory inv = this.createInv(9, "&lSettings");
int _index = 0;
for (RTP_INV_SETTINGS type : RTP_INV_SETTINGS.values()) {
if (type.getShowMain()) {
String _name = type.name();
_name = _name.substring(0, 1).toUpperCase() + _name.substring(1).toLowerCase();
ItemStack _item = createItem("paper", 1, _name, null);
inv.setItem(_index, _item);
_index ++;
}
}
p.openInventory(inv);
this.cacheInv(p, inv, this.type);
}
@Override
public void clickEvent(InventoryClickEvent event) {
Player p = (Player) event.getWhoClicked();
int slot = event.getSlot();
int _index = 0;
for (RTP_INV_SETTINGS type : RTP_INV_SETTINGS.values()) {
if (type.getShowMain()) {
if (_index == slot) {
type.getInv().show(p);
return;
}
_index++;
}
}
}
}

View File

@@ -1,62 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.invs.types;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory;
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTP_INV_ITEMS;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class RTPInvWorlds extends RTPInventory {
public void show(Player p) {
int slots = (Bukkit.getWorlds().size() - (Bukkit.getWorlds().size() % 9) + 1) * 9;
if (slots < 6 * 9)
slots += 9;
Inventory inv = this.createInv(slots, "&lSelect a world to edit!");
int _index = 0;
for (World world : Bukkit.getWorlds()) {
if (_index > 9 * 5)
break;
ItemStack _item = createItem(RTP_INV_ITEMS.NORMAL.item, RTP_INV_ITEMS.NORMAL.amt, world.getName(), null);
inv.setItem(_index, _item);
_index ++;
}
ItemStack _item = createItem(RTP_INV_ITEMS.BACK.item, RTP_INV_ITEMS.BACK.amt, RTP_INV_ITEMS.BACK.name, null);
inv.setItem(inv.getSize() - 9 + RTP_INV_ITEMS.BACK.slot, _item);
p.openInventory(inv);
this.cacheInv(p, inv, this.type);
}
@Override
public void clickEvent(InventoryClickEvent e) {
Player p = (Player) e.getWhoClicked();
int slot = e.getSlot();
for (RTP_INV_ITEMS type : RTP_INV_ITEMS.values()) {
if (type.slot != -1) {
switch (type) {
case BACK:
if (slot == e.getInventory().getSize() - 9 + type.slot) {
Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.MAIN).show(p);
return;
}
default:
break;
}
}
}
int _index = 0;
for (World world : Bukkit.getWorlds()) {
if (_index == slot) {
Main.getInstance().getpInfo().setInvWorld(p, world);
Main.getInstance().getInvs().getInv(Main.getInstance().getpInfo().getNextInv(p)).show(p);
}
_index ++;
}
}
}

View File

@@ -1,35 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.settings;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
public class Settings {
public boolean debug;
public boolean delayEnabled;
public boolean rtpOnFirstJoin_Enabled;
public String rtpOnFirstJoin_World;
public boolean rtpOnFirstJoin_SetAsRespawn;
public int preloadRadius; //Amount of chunks to load around a safe rtp location (clamped (0 - 16))
//Dependencies
private final SoftDepends depends = new SoftDepends();
public void load() { //Load Settings
FileBasics.FILETYPE config = getPl().getFiles().getType(FileBasics.FILETYPE.CONFIG);
debug = config.getBoolean("Settings.Debugger");
delayEnabled = config.getBoolean("Settings.Delay.Enabled");
rtpOnFirstJoin_Enabled = config.getBoolean("Settings.RtpOnFirstJoin.Enabled");
rtpOnFirstJoin_World = config.getString("Settings.RtpOnFirstJoin.World");
rtpOnFirstJoin_SetAsRespawn = config.getBoolean("Settings.RtpOnFirstJoin.SetAsRespawn");
preloadRadius = config.getInt("Settings.PreloadRadius");
depends.load();
}
public SoftDepends getsDepends() {
return depends;
}
private Main getPl() {
return Main.getInstance();
}
}

View File

@@ -1,120 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.settings;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.Bukkit;
import java.util.logging.Level;
public class SoftDepends {
private boolean respect_worldguard = false;
private boolean respect_griefprevention = false;
private boolean respect_towny = false;
private boolean respect_redProtect = false;
private boolean respect_factionsUUID = false;
private boolean respect_lands = false;
private boolean respect_residence = false;
//RETURNABLES
private boolean worldguard = false;
private boolean griefprevention = false;
private boolean towny = false;
private boolean redProtect = false;
private boolean factionsUUID = false;
private boolean lands = false;
private boolean residence = false;
public boolean isWorldguard() {
return worldguard;
}
public boolean isGriefprevention() {
return griefprevention;
}
public boolean isTowny() {
return towny;
}
public boolean isRedProtect() {
return redProtect;
}
public boolean isFactionsUUID() {
return factionsUUID;
}
public boolean isLands() {
return lands;
}
public boolean isResidence() {
return residence;
}
void load() {
FileBasics.FILETYPE config = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
String pre = "Settings.Respect.";
respect_worldguard = config.getBoolean( pre + "WorldGuard");
respect_griefprevention = config.getBoolean(pre + "GriefPrevention");
respect_towny = config.getBoolean( pre + "Towny");
respect_redProtect = config.getBoolean( pre + "RedProtect");
respect_factionsUUID = config.getBoolean( pre + "FactionsUUID");
respect_lands = config.getBoolean( pre + "Lands");
respect_residence = config.getBoolean( pre + "Residence");
registerWorldguard();
registerGriefPrevention();
registerTowny();
registerRedProtect();
registerFactionsUUID();
registerLands();
registerResidence();
}
public void registerWorldguard() {
worldguard = respect_worldguard && Bukkit.getPluginManager().isPluginEnabled("WorldGuard");
if (respect_worldguard)
debug("Respecting `WorldGuard` was " + (worldguard ? "SUCCESSFULLY" : "NOT") + " registered");
}
public void registerGriefPrevention() {
griefprevention = respect_griefprevention && Bukkit.getPluginManager().isPluginEnabled("GriefPrevention");
if (respect_griefprevention)
debug("Respecting `GriefPrevention` was " + (griefprevention ? "SUCCESSFULLY" : "NOT") + " registered");
}
public void registerTowny() {
towny = respect_towny && Bukkit.getPluginManager().isPluginEnabled("Towny");
if (respect_towny)
debug("Respecting `Towny` was " + (towny ? "SUCCESSFULLY" : "NOT") + " registered");
}
public void registerRedProtect() {
redProtect = respect_redProtect && Bukkit.getPluginManager().isPluginEnabled("RedProtect");
if (respect_redProtect)
debug("Respecting `RedProtect` was " + (redProtect ? "SUCCESSFULLY" : "NOT") + " registered");
}
public void registerFactionsUUID() {
factionsUUID = respect_factionsUUID && Bukkit.getPluginManager().isPluginEnabled("Factions");
if (respect_factionsUUID)
debug("Respecting `FactionsUUID` was " + (factionsUUID ? "SUCCESSFULLY" : "NOT") + " registered");
}
public void registerLands() {
lands = respect_lands && Bukkit.getPluginManager().isPluginEnabled("Lands");
if (respect_lands)
debug("Respecting `Lands` was " + (lands ? "SUCCESSFULLY" : "NOT") + " registered");
}
public void registerResidence() {
residence = respect_residence && Bukkit.getPluginManager().isPluginEnabled("Residence");
if (respect_residence)
debug("Respecting `Residence` was " + (residence ? "SUCCESSFULLY" : "NOT") + " registered");
}
private void debug(String str) {
if (Main.getInstance().getSettings().debug)
Main.getInstance().getLogger().log(Level.INFO, str);
}
}

View File

@@ -1,293 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.web;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import javax.net.ssl.HttpsURLConnection;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.Timer;
import java.util.TimerTask;
import java.util.UUID;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;
/**
* bStats collects some data for plugin authors.
*
* Check out https://bStats.org/ to learn more about bStats!
*/
@SuppressWarnings("unchecked")
public class Metrics {
static {
// Maven's Relocate is clever and changes strings, too. So we have to use this little "trick" ... :D
final String defaultPackage = new String(new byte[] { 'o', 'r', 'g', '.', 'b', 's', 't', 'a', 't', 's' });
final String examplePackage = new String(new byte[] { 'y', 'o', 'u', 'r', '.', 'p', 'a', 'c', 'k', 'a', 'g', 'e' });
// We want to make sure nobody just copy & pastes the example and use the wrong package names
if (Metrics.class.getPackage().getName().equals(defaultPackage) || Metrics.class.getPackage().getName().equals(examplePackage)) {
throw new IllegalStateException("bStats Metrics class has not been relocated correctly!");
}
}
// The version of this bStats class
public static final int B_STATS_VERSION = 1;
// The url to which the data is sent
private static final String URL = "https://bStats.org/submitData/bukkit";
// Should failed requests be logged?
private static boolean logFailedRequests;
// The uuid of the server
private static String serverUUID;
// The plugin
private final JavaPlugin plugin;
/**
* Class constructor.
*
* @param plugin The plugin which stats should be submitted.
*/
public Metrics(JavaPlugin plugin) {
if (plugin == null) {
throw new IllegalArgumentException("Plugin cannot be null!");
}
this.plugin = plugin;
// Get the config file
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats");
File configFile = new File(bStatsFolder, "config.yml");
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
// Check if the config file exists
if (!config.isSet("serverUuid")) {
// Add default values
config.addDefault("enabled", true);
// Every server gets it's unique random id.
config.addDefault("serverUuid", UUID.randomUUID().toString());
// Should failed request be logged?
config.addDefault("logFailedRequests", false);
// Inform the server owners about bStats
config.options().header(
"bStats collects some data for plugin authors like how many servers are using their plugins.\n" +
"To honor their work, you should not disable it.\n" +
"This has nearly no effect on the server performance!\n" +
"Check out https://bStats.org/ to learn more :)"
).copyDefaults(true);
try {
config.save(configFile);
} catch (IOException ignored) { }
}
// Load the data
serverUUID = config.getString("serverUuid");
logFailedRequests = config.getBoolean("logFailedRequests", false);
if (config.getBoolean("enabled", true)) {
boolean found = false;
// Search for all other bStats Metrics classes to see if we are the first one
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION"); // Our identifier :)
found = true; // We aren't the first
break;
} catch (NoSuchFieldException ignored) { }
}
// Register our service
Bukkit.getServicesManager().register(Metrics.class, this, plugin, ServicePriority.Normal);
if (!found) {
// We are the first!
startSubmitting();
}
}
}
/**
* Starts the Scheduler which submits our data every 30 minutes.
*/
private void startSubmitting() {
final Timer timer = new Timer(true); // We use a timer cause the Bukkit scheduler is affected by server lags
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
if (!plugin.isEnabled()) { // Plugin was disabled
timer.cancel();
return;
}
// Nevertheless we want our code to run in the Bukkit main thread, so we have to use the Bukkit scheduler
// Don't be afraid! The connection to the bStats server is still async, only the stats collection is sync ;)
Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
submitData();
}
});
}
}, 1000*60*5, 1000*60*30);
// Submit the data every 30 minutes, first time after 5 minutes to give other plugins enough time to start
// WARNING: Changing the frequency has no effect but your plugin WILL be blocked/deleted!
// WARNING: Just don't do it!
}
/**
* Gets the plugin specific data.
* This method is called using Reflection.
*
* @return The plugin specific data.
*/
public JSONObject getPluginData() {
JSONObject data = new JSONObject();
String pluginName = plugin.getDescription().getName();
String pluginVersion = plugin.getDescription().getVersion();
data.put("pluginName", pluginName); // Append the name of the plugin
data.put("pluginVersion", pluginVersion); // Append the version of the plugin
JSONArray customCharts = new JSONArray();
data.put("customCharts", customCharts);
return data;
}
/**
* Gets the server specific data.
*
* @return The server specific data.
*/
private JSONObject getServerData() {
// Minecraft specific data
int playerAmount = Bukkit.getOnlinePlayers().size();
int onlineMode = Bukkit.getOnlineMode() ? 1 : 0;
String bukkitVersion = Bukkit.getVersion();
bukkitVersion = bukkitVersion.substring(bukkitVersion.indexOf("MC: ") + 4, bukkitVersion.length() - 1);
// OS/Java specific data
String javaVersion = System.getProperty("java.version");
String osName = System.getProperty("os.name");
String osArch = System.getProperty("os.arch");
String osVersion = System.getProperty("os.version");
int coreCount = Runtime.getRuntime().availableProcessors();
JSONObject data = new JSONObject();
data.put("serverUUID", serverUUID);
data.put("playerAmount", playerAmount);
data.put("onlineMode", onlineMode);
data.put("bukkitVersion", bukkitVersion);
data.put("javaVersion", javaVersion);
data.put("osName", osName);
data.put("osArch", osArch);
data.put("osVersion", osVersion);
data.put("coreCount", coreCount);
return data;
}
/**
* Collects the data and sends it afterwards.
*/
private void submitData() {
final JSONObject data = getServerData();
JSONArray pluginData = new JSONArray();
// Search for all other bStats Metrics classes to get their plugin data
for (Class<?> service : Bukkit.getServicesManager().getKnownServices()) {
try {
service.getField("B_STATS_VERSION"); // Our identifier :)
} catch (NoSuchFieldException ignored) {
continue; // Continue "searching"
}
// Found one!
try {
pluginData.add(service.getMethod("getPluginData").invoke(Bukkit.getServicesManager().load(service)));
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ignored) { }
}
data.put("plugins", pluginData);
// Create a new thread for the connection to the bStats server
new Thread(new Runnable() {
@Override
public void run() {
try {
// Send the data
sendData(data);
} catch (Exception e) {
// Something went wrong! :(
if (logFailedRequests) {
plugin.getLogger().log(Level.WARNING, "Could not submit plugin stats of " + plugin.getName(), e);
}
}
}
}).start();
}
/**
* Sends the data to the bStats server.
*
* @param data The data to send.
* @throws Exception If the request failed.
*/
private static void sendData(JSONObject data) throws Exception {
if (data == null) {
throw new IllegalArgumentException("Data cannot be null!");
}
if (Bukkit.isPrimaryThread()) {
throw new IllegalAccessException("This method must not be called from the main thread!");
}
HttpsURLConnection connection = (HttpsURLConnection) new URL(URL).openConnection();
// Compress the data to save bandwidth
byte[] compressedData = compress(data.toString());
// Add headers
connection.setRequestMethod("POST");
connection.addRequestProperty("Accept", "application/json");
connection.addRequestProperty("Connection", "close");
connection.addRequestProperty("Content-Encoding", "gzip"); // We gzip our request
connection.addRequestProperty("Content-Length", String.valueOf(compressedData.length));
connection.setRequestProperty("Content-Type", "application/json"); // We send our data in JSON format
connection.setRequestProperty("User-Agent", "MC-Server/" + B_STATS_VERSION);
// Send data
connection.setDoOutput(true);
DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream());
outputStream.write(compressedData);
outputStream.flush();
outputStream.close();
connection.getInputStream().close(); // We don't care about the response - Just send our data :)
}
/**
* Gzips the given String.
*
* @param str The string to gzip.
* @return The gzipped String.
* @throws IOException If the compression failed.
*/
private static byte[] compress(final String str) throws IOException {
if (str == null) {
return null;
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
GZIPOutputStream gzip = new GZIPOutputStream(outputStream);
gzip.write(str.getBytes("UTF-8"));
gzip.close();
return outputStream.toByteArray();
}
}

View File

@@ -1,24 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.worlds;
import org.bukkit.World;
import java.util.List;
public interface RTPWorld {
boolean getUseWorldborder();
int getCenterX();
int getCenterZ();
int getMaxRad();
int getMinRad();
int getPrice();
List<String> getBiomes();
World getWorld();
}

View File

@@ -1,6 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.worlds;
public enum WORLD_TYPE {
NORMAL, //Normal world type finds the tallest safe block
NETHER //Nether world types finds the lowest safe block
}

View File

@@ -1,148 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.worlds;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.Bukkit;
import org.bukkit.World;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class WorldCustom implements RTPWorld {
public String world;
private boolean useWorldborder = false;
private int CenterX, CenterZ, maxBorderRad, minBorderRad, price;
private List<String> Biomes;
public WorldCustom(String world) {
String pre = "CustomWorlds.";
FileBasics.FILETYPE config = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
List<Map<?, ?>> map = config.getMapList("CustomWorlds");
this.world = world;
//Find Custom World and cache values
for (Map<?, ?> m : map) {
for (Map.Entry<?, ?> entry : m.entrySet()) {
String key = entry.getKey().toString();
if (!key.equals(world))
continue;
Map<?, ?> test = ((Map<?, ?>) m.get(key));
if (test == null)
continue;
if (test.get("UseWorldBorder") != null) {
if (test.get("UseWorldBorder").getClass() == Boolean.class)
useWorldborder = Boolean.parseBoolean(test.get("UseWorldBorder").toString());
}
if (test.get("CenterX") != null) {
if (test.get("CenterX").getClass() == Integer.class)
CenterX = Integer.parseInt((test.get("CenterX")).toString());
}
if (test.get("CenterZ") != null) {
if (test.get("CenterZ").getClass() == Integer.class)
CenterZ = Integer.parseInt((test.get("CenterZ")).toString());
}
if (test.get("MaxRadius") != null) {
if (test.get("MaxRadius").getClass() == Integer.class)
maxBorderRad = Integer.parseInt((test.get("MaxRadius")).toString());
if (maxBorderRad <= 0) {
Main.getInstance().getText().sms(Bukkit.getConsoleSender(),
"WARNING! Custom world '" + world + "' Maximum radius of '" + maxBorderRad + "' is not allowed! Set to default value!");
maxBorderRad = Main.getInstance().getRTP().defaultWorld.getMaxRad();
}
}
if (test.get("MinRadius") != null) {
if (test.get("MinRadius").getClass() == Integer.class)
minBorderRad = Integer.parseInt((test.get("MinRadius")).toString());
if (minBorderRad < 0 || minBorderRad >= maxBorderRad) {
Main.getInstance().getText().sms(Bukkit.getConsoleSender(),
"WARNING! Custom world '" + world + "' Minimum radius of '" + minBorderRad + "' is not allowed! Set to default value!");
minBorderRad = Main.getInstance().getRTP().defaultWorld.getMinRad();
if (minBorderRad >= maxBorderRad)
maxBorderRad = Main.getInstance().getRTP().defaultWorld.getMaxRad();
}
}
if (test.get("Biomes") != null) {
if (test.get("Biomes").getClass() == ArrayList.class)
this.Biomes = new ArrayList<>((ArrayList) test.get("Biomes"));
}
}
}
//Booleans
/*useWorldborder = config.getBoolean(pre + world + ".UseWorldBorder");
//Integers
CenterX = config.getInt(pre + world + ".CenterX");
CenterZ = config.getInt(pre + world + ".CenterZ");
maxBorderRad = config.getInt(pre + world + ".MaxRadius");
if (maxBorderRad <= 0) {
Main.getInstance().getText().sms(Bukkit.getConsoleSender(),
"WARNING! Custom world '" + world + "' Maximum radius of '" + maxBorderRad + "' is not allowed! Set to default value!");
maxBorderRad = Main.getInstance().getRTP().Default.getMaxRad();
}
minBorderRad = config.getInt(pre + world + ".MinRadius");
if (minBorderRad <= 0 || minBorderRad >= maxBorderRad) {
Main.getInstance().getText().sms(Bukkit.getConsoleSender(),
"WARNING! Custom world '" + world + "' Minimum radius of '" + minBorderRad + "' is not allowed! Set to default value!");
minBorderRad = Main.getInstance().getRTP().Default.getMinRad();
}
*/
if (Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getBoolean("Economy.Enabled"))
if (Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getBoolean(pre + "Enabled")) {
map.clear();
map = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getMapList("CustomWorlds");
for (Map<?, ?> m : map)
for (Map.Entry<?, ?> entry : m.entrySet()) {
String key = entry.getKey().toString();
Map<?, ?> test = ((Map<?, ?>) m.get(key));
if (!key.equals(world))
continue;
if (test.get("Price") != null)
if (test.get("Price").getClass() == Integer.class)
price = Integer.valueOf((test.get("Price")).toString());
}
} else
price = Main.getInstance().getRTP().defaultWorld.getPrice();
//Other
this.Biomes = config.getStringList(pre + world + ".Biomes");
}
@Override
public boolean getUseWorldborder() {
return useWorldborder;
}
@Override
public int getCenterX() {
return CenterX;
}
@Override
public int getCenterZ() {
return CenterZ;
}
@Override
public int getMaxRad() {
return maxBorderRad;
}
@Override
public int getMinRad() {
return minBorderRad;
}
@Override
public int getPrice() {
return price;
}
@Override
public List<String> getBiomes() {
return Biomes;
}
@Override
public World getWorld() {
return Bukkit.getWorld(world);
}
}

View File

@@ -1,85 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.worlds;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import org.bukkit.Bukkit;
import org.bukkit.World;
import java.util.HashMap;
import java.util.List;
public class WorldDefault implements RTPWorld {
private boolean useWorldborder;
private int CenterX, CenterZ, maxBorderRad, minBorderRad, price;
private List<String> Biomes;
public void setup() {
//Setups
String pre = "Default";
FileBasics.FILETYPE config = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
//Booleans
useWorldborder = config.getBoolean(pre + ".UseWorldBorder");
//Integers
CenterX = config.getInt(pre + ".CenterX");
CenterZ = config.getInt(pre + ".CenterZ");
maxBorderRad = config.getInt(pre + ".MaxRadius");
if (maxBorderRad <= 0) {
Main.getInstance().getText().sms(Bukkit.getConsoleSender(),
"WARNING! Default Maximum radius of '" + maxBorderRad + "' is not allowed! Set to '1000'");
maxBorderRad = 1000;
}
minBorderRad = config.getInt(pre + ".MinRadius");
if (minBorderRad < 0 || minBorderRad >= maxBorderRad) {
Main.getInstance().getText().sms(Bukkit.getConsoleSender(),
"WARNING! Default Minimum radius of '" + minBorderRad + "' is not allowed! Set to '0'");
minBorderRad = 0;
}
if (Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getBoolean("Economy.Enabled"))
price = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.ECO).getInt("Economy.Price");
else
price = 0;
//Other
this.Biomes = config.getStringList(pre + ".Biomes");
}
@Override
public boolean getUseWorldborder() {
return useWorldborder;
}
@Override
public int getCenterX() {
return CenterX;
}
@Override
public int getCenterZ() {
return CenterZ;
}
@Override
public int getMaxRad() {
return maxBorderRad;
}
@Override
public int getMinRad() {
return minBorderRad;
}
@Override
public int getPrice() {
return price;
}
@Override
public List<String> getBiomes() {
return Biomes;
}
@Override
public World getWorld() {
return null;
}
}

View File

@@ -1,206 +0,0 @@
package me.SuperRonanCraft.BetterRTP.references.worlds;
import me.SuperRonanCraft.BetterRTP.Main;
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPPermissionGroup;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.WorldBorder;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class WorldPlayer implements RTPWorld {
private boolean useWorldborder;
private int CenterX, CenterZ, maxBorderRad, minBorderRad, price, attempts;
private List<String> Biomes;
private final CommandSender p;
private final World world;
private WORLD_TYPE world_type;
private RTPPermissionGroup.RTPPermConfiguration config = null;
//Economy
public boolean eco_money_taken = false;
public WorldPlayer(CommandSender p, World world) {
this.p = p;
this.world = world;
}
public void setup(RTPWorld world, int price, List<String> biomes, boolean personal) {
setUseWorldborder(world.getUseWorldborder());
setCenterX(world.getCenterX());
setCenterZ(world.getCenterZ());
setMaxRad(world.getMaxRad());
setMinRad(world.getMinRad());
setPrice(price);
List<String> list = new ArrayList<>(world.getBiomes());
if (biomes != null)
list.addAll(biomes);
setBiomes(list);
if (personal)
setupGroup(Main.getInstance().getRTP().permConfig);
//Make sure our borders will not cause an invalid integer
if (getMaxRad() <= getMinRad()) {
setMinRad(Main.getInstance().getRTP().defaultWorld.getMinRad());
if (getMaxRad() <= getMinRad())
setMinRad(0);
}
//World border protection
if (getUseWorldborder()) {
WorldBorder border = getWorld().getWorldBorder();
int _borderRad = (int) border.getSize() / 2;
if (getMaxRad() > _borderRad)
setMaxRad(_borderRad);
setCenterX(border.getCenter().getBlockX());
setCenterZ(border.getCenter().getBlockZ());
}
}
private void setupGroup(RTPPermissionGroup permConfig) {
RTPPermissionGroup.RTPPermConfiguration config = permConfig.getGroup(p);
if (config != null) {
for (RTPPermissionGroup.RTPPermConfigurationWorld world : config.worlds) {
if (getWorld().getName().equals(world.name)) {
if (world.maxRad != -1)
setMaxRad(world.maxRad);
if (world.minRad != -1)
setMinRad(world.minRad);
if (world.price != -1)
setPrice(world.price);
if (world.centerx != -1)
setCenterX(world.centerx);
if (world.centerz != -1)
setCenterZ(world.centerz);
if (world.useworldborder != null)
setUseWorldborder((Boolean) world.useworldborder);
this.config = config;
break;
}
}
}
}
public Player getPlayer() {
return (Player) p;
}
public Location generateRandomXZ(WorldDefault defaultWorld) {
int borderRad = getMaxRad();
int minVal = getMinRad();
//Generate a random X and Z based off the quadrant selected
int max = borderRad - minVal;
int x, z;
int quadrant = new Random().nextInt(4);
switch (quadrant) {
case 0: // Positive X and Z
x = new Random().nextInt(max) + minVal;
z = new Random().nextInt(max) + minVal; break;
case 1: // Negative X and Z
x = -new Random().nextInt(max) - minVal;
z = -(new Random().nextInt(max) + minVal); break;
case 2: // Negative X and Positive Z
x = -new Random().nextInt(max) - minVal;
z = new Random().nextInt(max) + minVal; break;
default: // Positive X and Negative Z
x = new Random().nextInt(max) + minVal;
z = -(new Random().nextInt(max) + minVal); break;
}
x += getCenterX();
z += getCenterZ();
addAttempt();
//System.out.println(quadrant);
return new Location(getWorld(), x, 0, z);
}
@Override
public World getWorld() {
return world;
}
@Override
public boolean getUseWorldborder() {
return useWorldborder;
}
@Override
public int getCenterX() {
return CenterX;
}
@Override
public int getCenterZ() {
return CenterZ;
}
@Override
public int getMaxRad() {
return maxBorderRad;
}
@Override
public int getMinRad() {
return minBorderRad;
}
@Override
public int getPrice() {
return price;
}
public int getAttempts() {return attempts; }
@Override
public List<String> getBiomes() {
return Biomes;
}
private void setUseWorldborder(boolean bool) {
useWorldborder = bool;
}
private void setCenterX(int x) {
CenterX = x;
}
private void setCenterZ(int z) {
CenterZ = z;
}
//Modifiable
private void setMaxRad(int max) {
maxBorderRad = max;
}
private void setMinRad(int min) {
minBorderRad = min;
}
private void setPrice(int price) {
this.price = price;
}
public void addAttempt() {
this.attempts++;
}
//
private void setBiomes(List<String> biomes) {
this.Biomes = biomes;
}
//Custom World type
public void setWorldtype(WORLD_TYPE type) {
this.world_type = type;
}
public RTPPermissionGroup.RTPPermConfiguration getConfig() {
return this.config;
}
public WORLD_TYPE getWorldtype() {
return this.world_type;
}
}

View File

@@ -1,127 +0,0 @@
# BetterRTP plugin by SuperRonanCraft! (Join my Public Server mc.RonanCraft.net) #
# Need help? go to https://ronancraft.net/discord! #
Language-File: 'en.yml'
Settings:
Respect:
## Respect WorldGuard areas (https://dev.bukkit.org/projects/worldguard)
WorldGuard: false
## Respect GriefPrevention areas (https://www.spigotmc.org/resources/griefprevention.1884/)
GriefPrevention: false
## Respect Towny areas (https://www.spigotmc.org/resources/towny.72694/)
Towny: false
## Respect RedProtect areas (https://www.spigotmc.org/resources/redprotect.15841/)
RedProtect: false
## Respect FactionsUUID areas (https://www.spigotmc.org/resources/factionsuuid.1035/)
FactionsUUID: false
## Respect Lands areas (https://www.spigotmc.org/resources/lands.53313/)
Lands: false
## Respect Residence areas (https://www.spigotmc.org/resources/residence.11480/)
Residence: false
## Output to console some debugging info
Debugger: false
## Amount of chunks to preload around a safe location
PreloadRadius: 5
## Maximum amount of tries before BetterRTP gives up and sends a NotSafeMessage #
MaxAttempts: 32
RtpOnFirstJoin: # Will execute as console to override delays
Enabled: false # Make the player rtp when joining the server for the first time
World: 'world' # World to first rtp in
SetAsRespawn: false # Save this first rtp as players new spawn point
Cooldown:
Enabled: true # Enabled or disabled cooldown timer
LockAfter: 0 # Lock the player in an infinite cooldown after # rtp's (0 to disable)
Time: 600 # in SECONDS
## Time between command and actually rtp'ing, time is in SECONDS. Set to "0" to disable delay timer #
Delay:
Enabled: true
Time: 5
CancelOnMove: true
DisableUpdater: false
Default:
UseWorldBorder: false
## "Biomes: []" means all biomes are allowed! #
## Biomes are optional, more biomes at https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Biome.html #
Biomes: []
MaxRadius: 1000
MinRadius: 10
## If "UseWorldBorder" is set to true above, Center X and Z will be ignored! #
CenterX: 0
CenterZ: 0
## Blocks BetterRTP will NOT teleport onto. More Blocks at: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html #
BlacklistedBlocks:
- stationary_water
- stationary_lava
- water
- flowing_water
- lava
- flowing_lava
- cactus
- leaves
- leaves_2
- air
- void_air
- bedrock
- oak_leaves
- jungle_leaves
## Worlds to NOT allow /rtp in, unless there is an override to another enabled world #
DisabledWorlds:
- prison
- creative
## Worlds you want to have a custom min/max and spawn center in #
## [MaxRadius] and [MinRadius] MUST be positive! These cannot be equal to each other!
CustomWorlds:
- custom_world_1:
UseWorldBorder: false
## If UseWorldBorder is true, everything will be ignored EXCEPT "MinRadius"!
MaxRadius: 1000
MinRadius: 100
CenterX: 0
CenterZ: 0
Price: 75
- other_custom_world:
MaxRadius: 100000
MinRadius: 1000
CenterX: 123
CenterZ: -123
## Biomes are optional, but useful! More biomes: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Biome.html
Biomes:
- 'desert'
- 'forest'
## Override a world and rtp a player executing the command in one world, to another
Overrides:
#FORMAT - <CURRENT WORLD>:<DESIRED WORLD>
- master_world: 'world'
- creative_world: 'world'
WorldType: # Available types are NORMAL, NETHER
- world: NORMAL
- world_nether: NETHER
- world_the_end: NORMAL
PermissionGroup: #Player requires "betterrtp.group.<world_name>" to trigger these configs
Enabled: false
Groups:
- vip: # permission: betterrtp.config.vip
- Build_World: #World named "Build_World"
MaxRadius: 10000
MinRadius: 1000
Price: 100
- Survival_World:
UseWorldBorder: false
MaxRadius: 5000
MinRadius: 1000
CenterX: 10
CenterZ: 10
Price: 10
- vip2: # permission: betterrtp.config.vip2
- Build_World:
MaxRadius: 25000
MinRadius: 10000
Price: 15

View File

@@ -1,19 +0,0 @@
Economy:
## Enable world charges? ALL Worlds included, even custom worlds!
Enabled: false
## Set to "0" to not charge for rtp, "Success.Bypass" message will be sent!
## Give players the permission "betterrtp.eco.bypass" to bypass economy
Price: 5
Hunger: #Make rtp'ing take up hunger to avoid exploits
Enabled: false
Honches: 4
CustomWorlds:
## Enable custom world charging
Enabled: true
Worlds:
## PlayerWorld will be charged "5" when typing /rtp, if they do not have "betterrtp.eco.bypass"
world: 5
## Setting the price to "0" will make the "Success.Bypass" message show
world_end: 0

View File

@@ -1,44 +0,0 @@
Sounds:
Enabled: true
## More sounds at https://www.spigotmc.org/wiki/cc-sounds-list/
Delay: 'entity_tnt_primed'
Success: 'entity_generic_explode'
Titles:
Enabled: true # Enable the titles effect feature
## All support %player% %x% %y% and %z% placeholders
NoDelay: #Only triggers when there is no delay
Title: '&6Teleporting...'
Subtitle: '&8please wait'
SendMessage: true
Teleport:
Title: '&6Teleported!'
Subtitle: '&fx=%x% y=%y% z=%z% in %attempts% attempts'
SendMessage: true # Allow the teleport success message in chat
Delay:
Title: ''
Subtitle: '&fTeleporting in %time% seconds...'
SendMessage: true # Allow the teleport delay message in chat
Cancelled:
Title: '&eYou moved...'
Subtitle: '&cRtp was cancelled!'
SendMessage: true # Allow the cancelled message in chat too
Loading:
Title: ''
Subtitle: '&7loading chunks... please wait'
SendMessage: true # Allow the loading message in chat
Failed:
Title: ''
Subtitle: '&cFailed! No safe spots located'
SendMessage: true
Particles: #Use `rtp info particles` for a list of particles
Enabled: true
Type: 'EXPLOSION_NORMAL' #list of particle types at https://github.com/ByteZ1337/ParticleLib/blob/master/src/main/java/xyz/xenondevs/particle/ParticleEffect.java
Shape: 'EXPLODE' #Types available are "Scan, Teleport and Explode", or use `/rtp info shapes` for a list of shapes
Invincible: #Amount of time a player should not take damage for
Enabled: true
Seconds: 5
Potions: #Use `/rtp info potion_effects` for a list of effects
Enabled: true
Types: #Format <potion_name>:[duration_ticks]:[amplifier] #Default duration=60, amplifier=1
- 'Blindness:60:1'
- 'Invisibility:60:1'

View File

@@ -1,21 +0,0 @@
<p align="center">
<b><a>Welcome to BetterRTP's language files!</a></b>
</p>
## Wheres the Wiki?
The wiki is available [here](https://github.com/SuperRonanCraft/BetterRTP/wiki)!
## Want to Contribute translating?
Fork one of the language files above and help translate!
<p align="center">
<b>Chat with us on Discord</b><br/>
<a href="https://discord.gg/8Kt4wKm"><img src="https://img.shields.io/discord/182633513474850818.svg?longCache=true&style=flat-square&label=Discord" alt="Discord" /></a><br/>
<b>Have a Suggestion? Make an issue!</b><br/>
<a href="../../issues"><img src="https://img.shields.io/github/issues-raw/SuperRonanCraft/BetterRTP.svg?longCache=true&style=flat-square&label=Issues" alt="GitHub issues" /></a><br/>
<br/>
<a href="https://www.spigotmc.org/resources/36081/">Thank you for viewing the Wiki for BetterRTP!</a><br/>
<i><a>Did this wiki help you out? Please give it a <b>Star</b> so I know it's getting use!</a></i><br/>
<br/>
<b><i><a href="https://www.spigotmc.org/resources/authors/superronancraft.13025/">Check out my other plugins!</a></i></b>
</p>

View File

@@ -1,58 +0,0 @@
# Translation author: OasisAkari (GitHub)
Messages:
Prefix: '&7[&6BetterRTP&7] '
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: '&a安全位置已定位&7加载区块中……'
Teleport: '&a传送中……&f直到我们找到安全的位置之前请等一下'
Failed:
Price: '&c你的钱不够了&7你至少要有$%price%&7才能随机传送'
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7你未被传送'
Hunger: '&7你太饿了&c传送之前先吃点东西再说'
Other:
Success: '&a%player%被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次'
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7%player%未被传送!'
Biome: '&c看上去&7%biome%&c群系不存在&7试试使用Tab表查找'
Reload: '&e配置成功重载'
NoPermission:
Basic: '&c对不起&7你没有权限使用此命令'
World: '&c对不起&7你并没有被准许在%world%世界传送!'
## %world% 是被设置为玩家无法随机传送的世界。#
DisabledWorld: '&c%world%世界已被禁止使用此命令,&7无法传送'
Cooldown: '&c对不起&7你需要在&c%time%&7秒后才能传送'
Locked: '&c对不起&7你已经用完了你的随机传送次数了'
Invalid: '&c无效的参数使用''/%command% help''查看帮助。'
NotOnline: '&c玩家&7%player%&c不在线'
Delay: '&a即将在&f%time%&a秒后传送乖乖站好'
Moved: '&c你移动了&7随机传送被取消了'
NotExist: '&c看上去&7%world%&c世界并不存在'
Already: '&c啊嘞嘞&7看上去你已经在随机传送中了请耐心点'
Sign: '&7命令标记已被创建&7命令为''&f/rtp %command%&7'''
Edit:
Error: '&c错误&7提供的参数无效'
Set: '&b成功&7%type%设置为%value%。'
Remove: '&c已移除&7你移除了自定义世界%world%。'
Help:
Prefix: '&e&m-----&6&l BetterRTP &8| 帮助菜单 &e&m-----'
Main: ' &7- &e/%command% &7- 将你随机传送!'
Biome: ' &7- &e/%command% biome <生物群系1, 生物群系2...> &7- 在这些指定的群系中随机传送。'
Edit: ' &7- &e/%command% edit <默认/世界> [参数...] &7- 修改插件设置。'
Help: ' &7- &e/%command% help &7- 打开帮助菜单。'
Info: ' &7- &e/%command% info [world/particles/shapes/potion_effects] &7- 查看有关插件参数的特定信息。'
Player: ' &7- &e/%command% player <玩家> [世界] [生物群系1生物群系2...] &7- 指定一个玩家随机传送。'
Reload: ' &7- &e/%command% reload &7- 重载插件。'
Settings: ' &7- &e/%command% settings &7- 打开GUI设置。'
Test: ' &7- &e/%command% test &7- 测试传送后的插件效果。'
Version: ' &7- &e/%command% version &7- 显示目前使用的插件版本。'
World: ' &7- &e/%command% world <世界> [生物群系1, 生物群系2...] &7- 在其他世界随机传送。'
Usage:
Player: '&c用法&7/%command% player <玩家> [世界] [生物群系1, 生物群系2]'
World: '&c用法&7/%command% world <世界> [生物群系1, 生物群系2...]'
Biome: '&c用法&7/%command% biome <生物群系1, 生物群系2...>'
Edit:
Base: '&c用法&7/%command% edit <default/世界> [参数...]'
Default: '&c用法&7/%command% edit default <max/min/useworldborder/center> <值>'
World: '&c用法&7/%command% edit world <world> <max/min/useworldborder/center> <值>'

View File

@@ -1,58 +0,0 @@
# Translation author: OasisAkari (GitHub)
Messages:
Prefix: '&7[&6BetterRTP&7] '
Success: ## Placeholders! %x% %y% 和 %z% 是玩家要被傳送到的對應 x y z 座標! #
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: '&a已定位安全位置! &7正在讀取區塊...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&c您的資金不夠了&7您需要有$%price%&7才能嘗試RTP'
NotSafe: '&c由於%attempts%次嘗試內未能找到適合的地方傳送,&7您未被傳送'
# 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%未被傳送!'
Biome: '&c看上去&7%biome%&c生態域不存在&7試試使用Tab清單查找吧'
Reload: '&e配置成功重新加載'
NoPermission:
Basic: '&c抱歉&7您沒有權限使用此指令'
World: '&c抱歉&7您不能在%world%世界傳送!'
## %world% 是玩家嘗試傳送到但設定已禁用的世界! #
DisabledWorld: '&c%world%世界已被禁止使用此指令,&7您無法傳送'
Cooldown: '&c抱歉&7您需要在&c%time%&7秒後才能嘗試傳送'
Locked: '&cSorry! &7You''ve used up all your RTP''s!'
Invalid: '&c無效的參數請使用''/%command% help''查看幫助。'
NotOnline: '&c玩家&7%player%&c不在線'
Delay: '&a即將在&f%time%&a秒後傳送請站好'
Moved: '&c您移動了&7RTP被取消了'
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%'
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: ' &7- &e/%command% edit <default/world> [args...] &7- Edit some plugin settings'
Help: ' &7- &e/%command% help &7- 打開幫助菜單。'
# Info: ' &7- &e/%command% info [world/particles/shapes/potion_effects] &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'
World: ' &7- &e/%command% world <世界> [生態域1, 生態域2...] &7- 在其他世界隨機傳送。'
Usage:
Player: '&cUsage&7: /%command% player <玩家> [世界] [生態域1, 生態域2]'
World: '&cUsage&7: /%command% world <世界> [生態域1, 生態域2...]'
Biome: '&cUsage&7: /%command% biome <生態域1, 生態域2...>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@@ -1,57 +0,0 @@
# Translation author: Lewisparkle (Discord)
Messages:
Prefix: '&7[&6BetterRTP&7] '
Success:
Paid: '&aByl/a jsi teleportován/a na&7 x=%x% y=%y% z=%z% za &c$%price%&7 po &f%attempts% &7pokusech!'
Bypass: '&aByl/a jsi teleportován/a na&7 x=%x% y=%y% z=%z% po &f%attempts% &7pokusech!'
Loading: '&aNalezeno bezpečné místo! &7Načítám chunky...'
Teleport: '&aTeleportuji... &fProsím, počkejte, než nalezneme bezpečné místo!'
Failed:
Price: '&cNebyl/a jsi teleportován, protože nemáš dostatek peněz! &7Musíš mít alespoň $%price% &7pro teleport!'
NotSafe: '&cNepodařilo se najít bezpečné místo po %attempts% pokusech! &7Nebyl/a jsi teleportován/a!'
Hunger: '&cNebyl/a jsi teleportován, protože jsi... &7příliš hladový/á.&c Sněz něco, kámo!'
Other:
Success: '&a%player% byl/a teleportován/a na&7 x=%x% y=%y% z=%z% po &f%attempts% &7pokusech!'
NotSafe: '&cNepodařilo se najít bezpečné místo po %attempts% pokusech! &7%player% nebyl/a teleportován/a!'
Biome: '&cVypadá to, že biom&7 %biome%&c neexistuje! &7Zkus použít tabulátor!'
Reload: '&eConfig úspěšně načten!'
NoPermission:
Basic: '&cPozor! &7Na tento příkaz nemáš práva!'
World: '&cPozor! &7Ve světě %world% se nelze teleportovat!'
DisabledWorld: '&cSvět %world% je uzamčen! &7Teleport nebyl možný!'
Cooldown: '&cPozor! &7Nemůžeš se teleportovat ještě &c%time% &7sekund!'
Locked: '&cPozor! &7Využil/a jsi všechny své teleporty!'
Invalid: '&cNeplatný příkaz. Zkus ''/%command% help''.'
NotOnline: '&cHráč &7%player% &cnení online!'
Delay: '&aTeleportuji za &f%time% &asekund! Nehýbej se!'
Moved: '&cPohl/a jsi se! &7Teleport byl zrušen!'
NotExist: '&cVypadá to, že svět &7%world% &cneexistuje!'
Already: '&cUps! &7Vypadá to, že se už teleportuješ! Měj trochu strpení!'
Sign: '&7Cedulka s příkazem vytvořena! &7Příkaz je... ''&f/rtp %command%&7''.'
Edit:
Error: '&cError! &7Zadána neplatná hodnota!'
Set: '&bÚspěch! &7%type% nastaveno na %value%'
Remove: '&cOdstraněno! &7Vymazal jsi vlastní svět %world%'
Help:
Prefix: '&e&m-----&6&l BetterRTP &8| Pomoc &e&m-----'
Main: ' &7- &e/%command% &7- Náhodně tě teleportuje!'
Biome: ' &7- &e/%command% biome <biom1, biom2...> &7- Náhodně tě teleportuje do zadaných biomů'
Edit: ' &7- &e/%command% edit <default/svět> [hodnoty...] &7- Úprava některých nastavení'
Help: ' &7- &e/%command% help &7- Zobrazí pomoc'
Info: ' &7- &e/%command% info [svět/částice/tvary/efekty_lektvarů] &7- Zobrazí konkrétní informace o nastavení pluginu'
Player: ' &7- &e/%command% player <hráč> [svět] [biom1, biom2...] &7- Náhodně teleportuje jiného hráče'
Reload: ' &7- &e/%command% reload &7- Znovu načte plugin'
Settings: ' &7- &e/%command% settings &7- Zobrazí GUI s nastavením'
Test: ' &7- &e/%command% test &7- Vyzkoušet efekty po teleportu bez pohybu'
Version: ' &7- &e/%command% version &7- Zobrazí verzi pluginu'
World: ' &7- &e/%command% world <svět> [biom1, biom2...] &7- Náhodně tě teleportuje do jiného světa'
Usage:
Player: '&cPoužití&7: /%command% player <hráč> [svět] [biom1, biom2]'
World: '&cPoužití&7: /%command% world <svět> [biom1, biom2...]'
Biome: '&cPoužití&7: /%command% biome <biom1, biom2...>'
Edit:
Base: '&cPoužití&7: /%command% edit <default/svět> [hodnoty...]'
Default: '&cPoužití&7: /%command% edit default <max/min/useworldborder/center> <hodnota>'
World: '&cPoužití&7: /%command% edit world <svět> <max/min/useworldborder/center> <hodnota>'

View File

@@ -1,57 +0,0 @@
# Translation author: QuestalNetwork (Spigot)
Messages:
Prefix: '&7[&6BetterRTP&7] '
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
Paid: '&aJe bent getp''d naar&7 x=%x% y=%y% z=%z% for &c$%price%&7 in &f%attempts% &7attempts!'
Bypass: '&aJe bent getp''d naar&7 x=%x% y=%y% z=%z%'
# Loading: '&aSafe spot located! &7Loading chunks...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&cKan niet rtpen vanwege onvoldoende saldo! &7Je moet minstens $%price% &7hebben om te rtpen!'
NotSafe: '&cKon geen veilige plek vinden, Probeer opnieuw! &7Je bent niet ge tp''d!'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player% is getp''d naar&7 x=%x% y=%y% z=%z% in &f%attempts% &7pogingen!'
NotSafe: '&cKon geen veilige plek binnenin %attempts% pogingen! &7%player% is niet gertp''d!'
Biome: '&cHet lijkt er naar dat de biome&7 %biome%&c niet bestaat! &7Probeer de tab list te gebruiken!'
Reload: '&eConfig succesvol herladen!'
NoPermission:
Basic: '&cSorry! &7U heeft geen toestemming om deze command te gebruiken!'
World: '&cSorry! &7Je mag niet rtpen in de %world% wereld!'
## %world% is the world the player is in that is disabled to rtp in! #
DisabledWorld: '&cUitgeschakeld %world%! &7Kon niet RTPen!'
Cooldown: '&cSorry! &7Je kan niet rtpen voor &c%time% &7seconden!'
Invalid: '&cOngeldig argument. probeer ''/%command% help'''
NotOnline: '&cDe speler &7%player% &cis niet online!'
Delay: '&aTeleportering in &f%time% &aseconden! Niet bewegen!'
Moved: '&cJe hebt bewogen! &7RTP was afgelast!'
NotExist: '&cLijkt dat de wereld &7%world% &cniet bestaat!'
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'''
# 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- Teleporteert jou naar een random locatie!'
Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Random teleport in deze biome'
# 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 [world/particles/shapes/potion_effects] &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'
# 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:
Player: '&cUsage&7: /%command% player <player> [world] [biome1, biome2]'
World: '&cUsage&7: /%command% world <world> [biome1, biome2...]'
Biome: '&cUsage&7: /%command% biome <biome1, biome2...>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@@ -1,58 +0,0 @@
# Help translate this file into more languages!
Messages:
Prefix: '&7[&6BetterRTP&7] '
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
Paid: '&aYou have been tp''d to&7 x=%x% y=%y% z=%z% for &c$%price%&7 in &f%attempts% &7attempts!'
Bypass: '&aYou have been tp''d to&7 x=%x% y=%y% z=%z% in &f%attempts% &7attempts'
Loading: '&aSafe spot located! &7Loading chunks...'
Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&cCould not rtp because of insufficent funds! &7You must have atleast $%price% &7to rtp!'
NotSafe: '&cCould not find safe spot within %attempts% attempts! &7You were not RTP''d!'
Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player% has been tp''d to&7 x=%x% y=%y% z=%z% in &f%attempts% &7attempts!'
NotSafe: '&cCould not find safe spot within %attempts% attempts! &7%player% was not rtp''d!'
Biome: '&cSeems like the biome&7 %biome%&c does not exist! &7Try using the tab list!'
Reload: '&eConfig reloaded successfully!'
NoPermission:
Basic: '&cSorry! &7You don''t have permission to use this command!'
World: '&cSorry! &7You are not allowed rtp in the %world% world!'
## %world% is the world the player is in that is disabled to rtp in! #
DisabledWorld: '&cDisabled World %world%! &7Could not RTP!'
Cooldown: '&cSorry! &7You can''t rtp for another &c%time% &7seconds!'
Locked: '&cSorry! &7You''ve used up all your RTP''s!'
Invalid: '&cInvalid argument. Try ''/%command% help'''
NotOnline: '&cThe player &7%player% &cis not online!'
Delay: '&aTeleporting in &f%time% &aseconds! Don''t move!'
Moved: '&cYou have moved! &7RTP was cancelled!'
NotExist: '&cLooks like the world &7%world% &cdoesn''t exist!'
Already: '&cWhoops! &7Looks like you are already rtp''ing, have some patience!'
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:
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: ' &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 [world/particles/shapes/potion_effects] &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'
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:
Player: '&cUsage&7: /%command% player <player> [world] [biome1, biome2]'
World: '&cUsage&7: /%command% world <world> [biome1, biome2...]'
Biome: '&cUsage&7: /%command% biome <biome1, biome2...>'
Edit:
Base: '&cUsage&7: /%command% edit <default/world> [args...]'
Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@@ -1,57 +0,0 @@
# Translation author: emgv (Discord)
Messages:
Prefix: '&7[&6BetterRTP&7] '
Success:
Paid: '&aFuiste teletransportado a las coordenadas &7 x=%x% y=%y% z=%z%!'
Bypass: '&aFuiste teletransportado a las coordenadas &7 x=%x% y=%y% z=%z%!'
Loading: '&aLugar seguro para el TP localizado! &7Cargando chunks...'
Teleport: '&aTeletransportandote... &fpor favor, espera mientras encontramos una ubicación segura!'
Failed:
Price: '&cCould not rtp because of insufficent funds! &7You must have atleast $%price% &7to rtp!'
NotSafe: '&cNo pudimos encontrar un lugar seguro :( ! &7No fuiste teletransportado!'
Hunger: '&cNo te pudimos teletransportar porque estas hambriento&c, come algo!'
Other:
Success: '&a%player% fue teletransportado a &7 x=%x% y=%y% z=%z%'
NotSafe: '&cNo se puedo encontrar un lugar seguro en %attempts% intentos! &7%player% no fue teletransportado!'
Biome: '&cParece que el bioma &7 %biome%&c no existe! &7Trata de usar la funcion de autcompletado con TAB!'
Reload: '&eConfiguración recargada exitosamente!'
NoPermission:
Basic: '&7No tienes permiso para ejecutar este comando!'
World: '&7No estas autorizado a hacer RTP en %world%!'
DisabledWorld: '&cEl mundo %world% esta desactivado! &7No se pudo hacer RTP!'
Cooldown: '&7Por favor, espera &c 1 hora &7 antes de volver a usar tu RTP!'
Locked: '&7Ya usaste todos tus RTP!'
Invalid: '&cSintaxis o argumento invalido. Prueba ''/%command% help'''
NotOnline: '&cThe player &7%player% &cis not online!'
Delay: '&aTeletransportandote en &f%time% &asegundos! No te muevas!'
Moved: '&cTe moviste! &7El RTP fue cancelado!'
NotExist: '&cParece que el mundo &7%world% &c no existe!'
Already: '&7Ya tienes una teletransportación en curso, por favor, espera.'
Sign: '&7El letrero con comandos ha sido creado! &7El comando es... ''&f/rtp %command%&7'''
Edit:
Error: '&cError! &7Input incorrecto!'
Set: '&bÉxito! &7%type% seteado a %value%'
Remove: '&cRemovido! &7Eliminaste exitosamente el mundo %world%'
Help:
Prefix: '&e&m-----&6&l BetterRTP &8| Ayuda &e&m-----'
Main: ' &7- &e/%command% &7- Te teletransporta aleatoriamente!'
Biome: ' &7- &e/%command% biome <bioma1, bioma2...> &7- Te teletransporta aleatoriamente en alguno de esos biomas'
Edit: ' &7- &e/%command% edit <default/world> [args...] &7- Edita algunos settings del plugin'
Help: ' &7- &e/%command% help &7- Muestra la lista de comandos'
Info: ' &7- &e/%command% info [world/particles/shapes/potion_effects] &7- Visualiza parámetros específicos del plugin'
Player: ' &7- &e/%command% player <jugador> [world] [biome1, biome2...] &7- Teletransporta aleatoriamente a otro jugador'
Reload: ' &7- &e/%command% reload &7- Recarga el plugin'
Settings: ' &7- &e/%command% settings &7- Abre una GUI para editar algunos settings'
Test: ' &7- &e/%command% test &7- Prueba los efectos posteriores a teletransportarse sin moverse del lugar'
Version: ' &7- &e/%command% version &7- Ver la versión actualmente'
World: ' &7- &e/%command% world <mundo> [bioma1, bioma2...] &7- Teletransportarse aleatoriamente en otro mundo'
Usage:
Player: '&cUso&7&7: /%command% player <jugador> [mundo] [bioma1, bioma2]'
World: '&cUso&7&77: /%command% world <mundo> [bioma1, bioma2...]'
Biome: '&cUso&7: /%command% biome <bioma1, bioma2...>'
Edit:
Base: '&cUso&7: /%command% edit <default/world> [args...]'
Default: '&cUso&7: /%command% edit default <max/min/useworldborder/center> <value>'
World: '&cUso&7: /%command% edit world <mundo> <max/min/useworldborder/center> <value>'

View File

@@ -1,58 +0,0 @@
# Translation author: At0micA55 (GitHub)
Messages:
Prefix: '&7[&6BetterRTP&7] '
## Placeholders! %x% %y% et %z% sont les coordonées x, y, et z auxquelles le joueur sera téléporté! #
Success:
Paid: '&aTu a été téléporté à&7 x=%x% y=%y% z=%z% pour &c$%price%&7 en &f%attempts% &7tentatives!'
Bypass: '&aTu a été téléporté à&7 x=%x% y=%y% z=%z% en &f%attempts% &7tentatives!'
# Loading: '&aSafe spot located! &7Loading chunks...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&cTu n''a pas pu être téléporté; Manque de fonds! &7Tu doit avoir au moins $%price% &7pour te téléporter!'
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7Tu n''a pas été téléporté!'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player% a été téléporté à&7 x=%x% y=%y% z=%z% em &f%attempts% &7tentatives!'
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7%player% n''a pas été téléporté!'
Reload: '&eConfiguration rechargée avec succès!'
NoPermission:
Basic: '&cDésoler! &7Il te manque la permission pour utiliser cette commande'
World: '&cDésoler! &7Tu n''est pas autorisé à te téléporter dans le monde %world% !'
## %world% Est le monde dans lequel le joueur est téléporter ! #
DisabledWorld: '&cLe monde %world% est désactivé! &7Impossible de se téléporter!'
Cooldown: '&cDésoler! &7Tu ne peut pas te téléporter pour encore &c%time% &7secondes!'
Locked: '&cSorry! &7You''ve used up all your RTP''s!'
Invalid: '&cArgument invalide. Essaye ''/%command% help'''
NotOnline: '&cLe joueur &7%player% &cn''est pas en ligne!'
Delay: '&aTéléportation dans &f%time% &asecondes! Ne bouge pas!'
Moved: '&cTu a bougé! &7Téléportation annulée!'
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!'
# 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:
# 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: ' &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 [world/particles/shapes/potion_effects] &7- View specific information about plugin parameters'
Player: ' &7- &e/%command% player <joueur> [monde] &7- Téléporte aléatoirement un autre joueur'
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:
Player: '&cUtilisation&7: /%command% player <joeur> [monde]'
World: '&cUtilisation&7: /%command% world <monde>'
Biome: '&cUtilisation&7: /%command% biome <biome1, biome2...>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@@ -1,58 +0,0 @@
# Translation author: ViaSnake (GitHub)
Messages:
Prefix: '&7[&6BetterRTP&7] '
Success:
Paid: '&aあなたは&c$%price%&aで&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でTPされました'
Bypass: '&aあなたは&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でTPされました'
# Loading: '&aSafe spot located! &7Loading chunks...'
# Teleport: '&aTeleporting... &fplease wait while we find a safe location!'
Failed:
Price: '&c資金が不十分のためRTPできませんでした &7RTPには最低$%price%&7が必要です'
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7あなたははRTPされませんでした'
# Hunger: '&cCould not rtp because you are... &7too hungry&c, eat something fella!'
Other:
Success: '&a%player%が&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でテレポートしました'
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7%player%はRTPされませんでした'
# Biome: '&cSeems like the biome&7 %biome%&c does not exist! &7Try using the tab list!'
Reload: '&eコンフィグは正常にリロードされました'
NoPermission:
Basic: '&cごめんなさい &7このコマンドを使う権限がありません'
World: '&cごめんなさい &7ワールド%world%ではrtpが許可されていません'
##
DisabledWorld: '&cワールド%world%は無効です! &7RTPできませんでした'
Cooldown: '&cごめんなさい &7あなたは&c%time%&7秒間RTPできません'
Locked: '&cSorry! &7You''ve used up all your RTP''s!'
Invalid: '&c無効な引数。 ''/%command% help''を試してください。'
NotOnline: '&cプレイヤー&7%player%&cはオンラインではありません'
Delay: '&f%time%&a秒でテレポートします 動かないで!'
Moved: '&cあなたは移動しました &7RTPはキャンセルされました'
NotExist: '&cワールド&7%world%&cが存在しないようです。'
Already: '&cおっと &7あなたはすでにRTPしているように見えます。'
# 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:
# 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 [world/particles/shapes/potion_effects] &7- View specific information about plugin parameters'
Player: ' &7- &e/%command% player <player> [world] &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:
Player: '&c使い方&7: /%command% player <プレイヤー> [ワールド]'
World: '&c使い方&7: /%command% world <ワールド>'
Biome: '&cUsage&7: /%command% biome <biome1, biome2...>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@@ -1,58 +0,0 @@
# Translation author: myfbone (GitHub)
Messages:
Prefix: '&7[&6BetterRTP&7] '
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
Paid: '&aВас телепортировало на&7 x=%x% y=%y% z=%z% за &c$%price%&7, за &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!'
Failed:
Price: '&cУ вас недостаточно денег для телепортации! &7У вас должно быть хотябы $%price% &7для rtp!'
NotSafe: '&cНе удалось найти безопасное место за %attempts% попыток! &7Вас не телепортировало!'
# 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% не был телепортирован!'
# Biome: '&cSeems like the biome&7 %biome%&c does not exist! &7Try using the tab list!'
Reload: '&eКонфиг удачно перезагружен!'
NoPermission:
Basic: '&cИзвините! &7У вас недостаточно прав для использования этой команды!'
World: '&cИзвините! &7Вам запрещено использовать rtp в мире %world%!'
## %world% is the world the player is in that is disabled to rtp in! #
DisabledWorld: '&cОтключенный мир %world%! &7Не удалось телепортироваться!'
Cooldown: '&cИзвините! &7Вы не сможете использовать rtp ближайшие &c%time% &7сек.!'
Locked: '&cSorry! &7You''ve used up all your RTP''s!'
Invalid: '&cНеправильные параметры. Попробуйте ''/%command% help'''
NotOnline: '&cИгрок &7%player% &cне онлайн!'
Delay: '&aТелепортация через &f%time% &aсек.! Не двигайтесь!'
Moved: '&cВы подвинулись! &7RTP отменено!'
NotExist: '&cПохоже что мир &7%world% &cне существует!'
Already: '&cУуупс! &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:
# 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 [world/particles/shapes/potion_effects] &7- View specific information about plugin parameters'
Player: ' &7- &e/%command% player <игрок> [мир] &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:
Player: '&cИспользование&7: /%command% player <игрок> [мир]'
World: '&cИспользование&7: /%command% world <мир>'
Biome: '&cUsage&7: /%command% biome <biome1, biome2...>'
# Edit:
# Base: '&cUsage&7: /%command% edit <default/world> [args...]'
# Default: '&cUsage&7: /%command% edit default <max/min/useworldborder/center> <value>'
# World: '&cUsage&7: /%command% edit world <world> <max/min/useworldborder/center> <value>'

View File

@@ -1,18 +0,0 @@
#Locations where rtp will center upon
#Format:
# LOCATION_NAME:
# World: world
# CenterX: 100
# CenterY: 150
# MaxRadius: 100
# MinRadius: 5
Settings:
Enabled: false
RandomLocations: true #When rtp'ing, a random location will be selected, else the nearest will be selected
Locations:
main_loc:
World: world
CenterX: 100
CenterY: 150
MaxRadius: 100
MinRadius: 5

View File

@@ -1,45 +0,0 @@
permissions:
betterrtp.*:
children:
betterrtp.use: true
betterrtp.world: true
betterrtp.world.*: true
betterrtp.bypass.*: true
betterrtp.player: true
betterrtp.reload: true
betterrtp.updater: true
betterrtp.world:
description: RTP into other worlds
betterrtp.world.*:
description: RTP in all enabled worlds
betterrtp.world.<world>:
description: RTP in <world>
betterrtp.bypass.*:
children:
betterrtp.bypass.cooldown: true
betterrtp.bypass.delay: true
betterrtp.bypass.economy: true
betterrtp.use:
description: Use RTP command
default: true
betterrtp.player:
description: RTP another player
betterrtp.biome:
description: RTP to specific biomes
betterrtp.sign:
description: Ability to create an RTP sign
betterrtp.bypass.cooldown:
description: Bypass cooldowns
betterrtp.bypass.delay:
description: Bypass delays
betterrtp.bypass.economy:
description: Bypass economy
betterrtp.reload:
description: Reload the config
default: op
betterrtp.updater:
description: Get notification on new updates
default: op
betterrtp.test:
description: While debugger enabled, be able to test particles, potion effects and sounds
default: op

View File

@@ -1,68 +0,0 @@
main: me.SuperRonanCraft.BetterRTP.Main
version: '2.14.4'
name: BetterRTP
author: SuperRonanCraft
softdepend: [Vault, WorldGuard, GriefPrevention, Towny, Factions, RedProtect, Lands, Residence]
api-version: '1.13'
commands:
betterrtp:
aliases: [brtp, rtp]
description: Randomly teleport to a location
permissions:
betterrtp.*:
children:
betterrtp.use: true
betterrtp.world.*: true
betterrtp.bypass.*: true
betterrtp.player: true
betterrtp.reload: true
betterrtp.updater: true
betterrtp.biome: true
betterrtp.version: true
betterrtp.world.*:
description: RTP in all enabled worlds
betterrtp.bypass.*:
children:
betterrtp.bypass.cooldown: true
betterrtp.bypass.delay: true
betterrtp.bypass.economy: true
betterrtp.use:
description: Use RTP command
default: true
betterrtp.version:
description: See which version is running
betterrtp.world:
description: Use world command
betterrtp.player:
description: RTP another player
betterrtp.biome:
description: RTP to specific biomes
betterrtp.group.*:
description: Use a permission group to rtp with different restrictions
betterrtp.sign:
description: Ability to create an RTP sign
betterrtp.bypass.cooldown:
description: Bypass cooldowns
betterrtp.bypass.delay:
description: Bypass delays
betterrtp.bypass.economy:
description: Bypass economy
betterrtp.bypass.hunger:
description: Bypass hunger
betterrtp.reload:
description: Reload the config
default: op
betterrtp.updater:
description: Get notification on new updates
default: op
betterrtp.info:
description: View info about all worlds rtp will work in
default: op
betterrtp.test:
description: While debugger enabled, be able to test particles, potion effects and sounds
default: op
betterrtp.edit:
description: Edit a custom/default world rtp center/radius
default: op

View File

@@ -1,3 +0,0 @@
Settings:
Enabled: false
Title: "[RTP]"