mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
2.11.0 Nether Update
This commit is contained in:
parent
bf62655925
commit
8320008118
@ -113,5 +113,6 @@ public class Main extends JavaPlugin {
|
|||||||
rtp.load();
|
rtp.load();
|
||||||
cmd.load();
|
cmd.load();
|
||||||
listener.load();
|
listener.load();
|
||||||
|
eco.load();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,34 +5,38 @@ import me.SuperRonanCraft.BetterRTP.Main;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
|
||||||
class Delay implements Listener {
|
class Delay implements Listener {
|
||||||
private int run;
|
private int run;
|
||||||
private PlayerWorld pWorld;
|
private PlayerWorld pWorld;
|
||||||
private Main pl = Main.getInstance();
|
private boolean cancelOnMove, cancelOnDamage;
|
||||||
|
|
||||||
Delay(CommandSender sendi, PlayerWorld pWorld, int delay, boolean cancelOnMove) {
|
Delay(CommandSender sendi, PlayerWorld pWorld, int delay, boolean cancelOnMove, boolean cancelOnDamage) {
|
||||||
this.pWorld = pWorld;
|
this.pWorld = pWorld;
|
||||||
delay(sendi, delay, cancelOnMove);
|
this.cancelOnMove = cancelOnMove;
|
||||||
|
this.cancelOnDamage = cancelOnDamage;
|
||||||
|
delay(sendi, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
private void delay(CommandSender sendi, int delay, boolean cancelOnMove) {
|
private void delay(CommandSender sendi, int delay) {
|
||||||
Main pl = Main.getInstance();
|
Main pl = Main.getInstance();
|
||||||
if (sendi.equals(pWorld.getPlayer()) && delay != 0 && pl.getText().getTitleDelayChat())
|
if (sendi.equals(pWorld.getPlayer()) && delay != 0 && getPl().getText().getTitleDelayChat())
|
||||||
pl.getText().getDelay(sendi, String.valueOf(delay));
|
getPl().getText().getDelay(sendi, String.valueOf(delay));
|
||||||
if (pl.getText().getSoundsEnabled()) {
|
if (getPl().getText().getSoundsEnabled()) {
|
||||||
Sound sound = pl.getText().getSoundsDelay();
|
Sound sound = getPl().getText().getSoundsDelay();
|
||||||
if (sound != null)
|
if (sound != null)
|
||||||
pWorld.getPlayer().playSound(pWorld.getPlayer().getLocation(), sound, 1F, 1F);
|
pWorld.getPlayer().playSound(pWorld.getPlayer().getLocation(), sound, 1F, 1F);
|
||||||
}
|
}
|
||||||
if (pl.getText().getTitleEnabled()) {
|
if (getPl().getText().getTitleEnabled()) {
|
||||||
String title = pl.getText().getTitleDelay(pWorld.getPlayer().getName(), String.valueOf(delay));
|
String title = getPl().getText().getTitleDelay(pWorld.getPlayer().getName(), String.valueOf(delay));
|
||||||
String subTitle = pl.getText().getSubTitleDelay(pWorld.getPlayer().getName(), String.valueOf(delay));
|
String subTitle = getPl().getText().getSubTitleDelay(pWorld.getPlayer().getName(), String.valueOf(delay));
|
||||||
pWorld.getPlayer().sendTitle(title, subTitle);
|
pWorld.getPlayer().sendTitle(title, subTitle);
|
||||||
// int fadeIn = text.getFadeIn();
|
// int fadeIn = text.getFadeIn();
|
||||||
// int stay = text.getStay();
|
// int stay = text.getStay();
|
||||||
@ -42,39 +46,63 @@ class Delay implements Listener {
|
|||||||
}
|
}
|
||||||
run = Bukkit.getScheduler().scheduleSyncDelayedTask(pl, run(sendi, this), delay * 2 * 10);
|
run = Bukkit.getScheduler().scheduleSyncDelayedTask(pl, run(sendi, this), delay * 2 * 10);
|
||||||
//Bukkit.getScheduler().scheduleSyncRepeatingTask(pl, run(sendi, this), 0, 10);
|
//Bukkit.getScheduler().scheduleSyncRepeatingTask(pl, run(sendi, this), 0, 10);
|
||||||
if (cancelOnMove)
|
if (cancelOnMove || cancelOnDamage)
|
||||||
Bukkit.getPluginManager().registerEvents(this, Main.getInstance());
|
Bukkit.getPluginManager().registerEvents(this, Main.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void event(PlayerMoveEvent e) {
|
private void event(PlayerMoveEvent e) {
|
||||||
if (e.getPlayer().equals(pWorld.getPlayer())) {
|
if (cancelOnMove)
|
||||||
Bukkit.getScheduler().cancelTask(run);
|
if (e.getPlayer().equals(pWorld.getPlayer()) &&
|
||||||
if (!Bukkit.getScheduler().isCurrentlyRunning(run)) {
|
(e.getTo() != null &&
|
||||||
HandlerList.unregisterAll(this);
|
(e.getTo().getX() != e.getFrom().getX() ||
|
||||||
pl.getText().getMoved(pWorld.getPlayer());
|
e.getTo().getY() != e.getFrom().getY() ||
|
||||||
pl.getEco().unCharge(pWorld.getPlayer(), pWorld.getPrice());
|
e.getTo().getZ() != e.getFrom().getZ()))
|
||||||
pl.getCmd().cooldowns.remove(pWorld.getPlayer().getUniqueId());
|
) {
|
||||||
pl.getCmd().rtping.put(pWorld.getPlayer().getUniqueId(), false);
|
cancel();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private void event(EntityDamageEvent e) {
|
||||||
|
if (cancelOnDamage)
|
||||||
|
if (e.getEntity() instanceof Player){
|
||||||
|
if (e.getEntity().equals(pWorld.getPlayer()))
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancel() {
|
||||||
|
Bukkit.getScheduler().cancelTask(run);
|
||||||
|
if (!Bukkit.getScheduler().isCurrentlyRunning(run)) {
|
||||||
|
HandlerList.unregisterAll(this);
|
||||||
|
getPl().getText().getMoved(pWorld.getPlayer());
|
||||||
|
getPl().getEco().unCharge(pWorld.getPlayer(), pWorld.getPrice());
|
||||||
|
getPl().getCmd().cooldowns.remove(pWorld.getPlayer().getUniqueId());
|
||||||
|
getPl().getCmd().rtping.put(pWorld.getPlayer().getUniqueId(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Runnable run(final CommandSender sendi, final Delay cls) {
|
private Runnable run(final CommandSender sendi, final Delay cls) {
|
||||||
return () -> {
|
return () -> {
|
||||||
HandlerList.unregisterAll(cls);
|
HandlerList.unregisterAll(cls);
|
||||||
if (pl.getCmd().rtping.containsKey(pWorld.getPlayer().getUniqueId())) {
|
if (getPl().getCmd().rtping.containsKey(pWorld.getPlayer().getUniqueId())) {
|
||||||
try {
|
try {
|
||||||
pl.getRTP().tp(sendi, pWorld);
|
getPl().getRTP().tp(sendi, pWorld);
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
if (pWorld.getPrice() > 0)
|
if (pWorld.getPrice() > 0)
|
||||||
pl.getEco().unCharge(pWorld.getPlayer(), pWorld.getPrice());
|
getPl().getEco().unCharge(pWorld.getPlayer(), pWorld.getPrice());
|
||||||
}
|
}
|
||||||
pl.getCmd().rtping.put(pWorld.getPlayer().getUniqueId(), false);
|
getPl().getCmd().rtping.put(pWorld.getPlayer().getUniqueId(), false);
|
||||||
} else if (pWorld.getPrice() > 0)
|
} else if (pWorld.getPrice() > 0)
|
||||||
pl.getEco().unCharge(pWorld.getPlayer(), pWorld.getPrice());
|
getPl().getEco().unCharge(pWorld.getPlayer(), pWorld.getPrice());
|
||||||
Bukkit.getScheduler().cancelTask(run);
|
Bukkit.getScheduler().cancelTask(run);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Main getPl() {
|
||||||
|
return Main.getInstance();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ public class RTP {
|
|||||||
private Random rn = new Random();
|
private Random rn = new Random();
|
||||||
private List<String> disabledWorlds, blockList;
|
private List<String> disabledWorlds, blockList;
|
||||||
private int maxAttempts, delayTime;
|
private int maxAttempts, delayTime;
|
||||||
private boolean cancelOnMove;
|
private boolean cancelOnMove, cancelOnDamage;
|
||||||
public HashMap<String, RTP_WORLD_TYPE> world_type = new HashMap<>();
|
public HashMap<String, RTP_WORLD_TYPE> world_type = new HashMap<>();
|
||||||
|
|
||||||
public RTP(Main pl) {
|
public RTP(Main pl) {
|
||||||
@ -43,6 +43,7 @@ public class RTP {
|
|||||||
maxAttempts = config.getInt("Settings.MaxAttempts");
|
maxAttempts = config.getInt("Settings.MaxAttempts");
|
||||||
delayTime = config.getInt("Settings.Delay.Time");
|
delayTime = config.getInt("Settings.Delay.Time");
|
||||||
cancelOnMove = config.getBoolean("Settings.Delay.CancelOnMove");
|
cancelOnMove = config.getBoolean("Settings.Delay.CancelOnMove");
|
||||||
|
cancelOnDamage = config.getBoolean("Settings.Delay.CancelOnDamage");
|
||||||
blockList = config.getStringList("BlacklistedBlocks");
|
blockList = config.getStringList("BlacklistedBlocks");
|
||||||
//OVER-RIDES
|
//OVER-RIDES
|
||||||
try {
|
try {
|
||||||
@ -157,7 +158,7 @@ public class RTP {
|
|||||||
// Delaying? Else, just go
|
// Delaying? Else, just go
|
||||||
if (delay) {
|
if (delay) {
|
||||||
pl.getCmd().rtping.put(p.getUniqueId(), true);
|
pl.getCmd().rtping.put(p.getUniqueId(), true);
|
||||||
new Delay(sendi, pWorld, delayTime, cancelOnMove);
|
new Delay(sendi, pWorld, delayTime, cancelOnMove, cancelOnDamage);
|
||||||
} else
|
} else
|
||||||
tp(sendi, pWorld);
|
tp(sendi, pWorld);
|
||||||
}
|
}
|
||||||
@ -314,15 +315,18 @@ public class RTP {
|
|||||||
|
|
||||||
private Location getLocAtNormal(int x, int z, World world, Float yaw, Float pitch, PlayerWorld pWorld) {
|
private Location getLocAtNormal(int x, int z, World world, Float yaw, Float pitch, PlayerWorld pWorld) {
|
||||||
Block b = world.getHighestBlockAt(x, z);
|
Block b = world.getHighestBlockAt(x, z);
|
||||||
//System.out.println("-----------");
|
if (b.getType().toString().endsWith("AIR")) //1.15.1 or less
|
||||||
//System.out.println(b.getType().isSolid() + " " + b.getType().name());
|
b = world.getBlockAt(x, b.getY() - 1, z);
|
||||||
if (b.getType() == Material.AIR || !b.getType().isSolid()) { //1.15.1 or less
|
else if (!b.getType().isSolid()) { //Water, lava, shrubs...
|
||||||
int y = world.getHighestBlockYAt(x, z);
|
if (!badBlock(b.getType().name(), x, z, pWorld.getWorld(), null)) { //Make sure it's not an invalid block (ex: water, lava...)
|
||||||
b = world.getBlockAt(x, y - 1, z);
|
//int y = world.getHighestBlockYAt(x, z);
|
||||||
|
b = world.getBlockAt(x, b.getY() - 1, z);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//System.out.println(b.getType().isSolid() + " " + b.getType().name());
|
//System.out.println(b.getType().name());
|
||||||
if (b.getY() > 0 && !badBlock(b.getType().name(), x, z, pWorld.getWorld(), pWorld.getBiomes()))
|
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 new Location(world, (x + 0.5), b.getY() + 1, (z + 0.5), yaw, pitch);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,16 +357,25 @@ public class RTP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Location getLocAtNether(int x, int z, World world, Float yaw, Float pitch, PlayerWorld pWorld) {
|
private Location getLocAtNether(int x, int z, World world, Float yaw, Float pitch, PlayerWorld pWorld) {
|
||||||
|
//System.out.println("-----------");
|
||||||
for (int y = 0; y < world.getMaxHeight(); y++) {
|
for (int y = 0; y < world.getMaxHeight(); y++) {
|
||||||
Block b = world.getBlockAt(x, y, z);
|
// System.out.println("--");
|
||||||
if (b.getType().equals(Material.AIR) || !b.getType().isSolid()) {
|
Block block_current = world.getBlockAt(x, y, z);
|
||||||
String block = world.getBlockAt(x, y - 1, z).getType().name();
|
//System.out.println(block_current.getType().name());
|
||||||
if (!b.getType().isSolid()) { //Block is not a solid (ex: lava, water...)
|
if (block_current.getType().name().endsWith("AIR") || !block_current.getType().isSolid()) {
|
||||||
String block_in = b.getType().name();
|
//System.out.println(block_current.getType().name());
|
||||||
if (badBlock(block_in, x, z, pWorld.getWorld(), pWorld.getBiomes()))
|
if (!block_current.getType().name().endsWith("AIR") &&
|
||||||
return null;
|
!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;
|
||||||
}
|
}
|
||||||
if (!badBlock(block, x, z, pWorld.getWorld(), pWorld.getBiomes()))
|
//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 new Location(world, (x + 0.5), y, (z + 0.5), yaw, pitch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ public enum CommandTypes {
|
|||||||
INFO(new CmdInfo()),
|
INFO(new CmdInfo()),
|
||||||
PLAYER(new CmdPlayer()),
|
PLAYER(new CmdPlayer()),
|
||||||
RELOAD(new CmdReload()),
|
RELOAD(new CmdReload()),
|
||||||
SETTINGS(new CmdSettings()),
|
//SETTINGS(new CmdSettings()),
|
||||||
VERSION(new CmdVersion()),
|
VERSION(new CmdVersion()),
|
||||||
WORLD(new CmdWorld());
|
WORLD(new CmdWorld());
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.commands;
|
package me.SuperRonanCraft.BetterRTP.player.commands;
|
||||||
|
|
||||||
import me.SuperRonanCraft.BetterRTP.Main;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.Main;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -18,7 +18,6 @@ public class Commands {
|
|||||||
public HashMap<UUID, Boolean> rtping = new HashMap<>();
|
public HashMap<UUID, Boolean> rtping = new HashMap<>();
|
||||||
private boolean cooldownTimer;
|
private boolean cooldownTimer;
|
||||||
private int timer, cooldown;
|
private int timer, cooldown;
|
||||||
public static String[] cmds = {"help", "player", "world", "version", "reload", "biome"};
|
|
||||||
|
|
||||||
public Commands(Main pl) {
|
public Commands(Main pl) {
|
||||||
this.pl = pl;
|
this.pl = pl;
|
||||||
@ -34,7 +33,7 @@ public class Commands {
|
|||||||
|
|
||||||
public void commandExecuted(CommandSender sendi, String label, String[] args) {
|
public void commandExecuted(CommandSender sendi, String label, String[] args) {
|
||||||
if (pl.getPerms().getUse(sendi)) {
|
if (pl.getPerms().getUse(sendi)) {
|
||||||
if (args.length > 0) {
|
if (args != null && args.length > 0) {
|
||||||
for (CommandTypes cmd : CommandTypes.values()) {
|
for (CommandTypes cmd : CommandTypes.values()) {
|
||||||
if (cmd.name().equalsIgnoreCase(args[0])) {
|
if (cmd.name().equalsIgnoreCase(args[0])) {
|
||||||
if (cmd.getCmd().permission(sendi))
|
if (cmd.getCmd().permission(sendi))
|
||||||
@ -119,7 +118,7 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void tp(Player player, CommandSender sendi, String world, List<String> biomes) {
|
public void tp(Player player, CommandSender sendi, String world, List<String> biomes) {
|
||||||
if (cooldown(sendi, player)) {
|
if (canRtp(sendi, player)) {
|
||||||
boolean delay = false;
|
boolean delay = false;
|
||||||
if (!pl.getPerms().getBypassDelay(player))
|
if (!pl.getPerms().getBypassDelay(player))
|
||||||
if (timer != 0)
|
if (timer != 0)
|
||||||
@ -129,14 +128,17 @@ public class Commands {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean cooldown(CommandSender sendi, Player player) {
|
private boolean canRtp(CommandSender sendi, Player player) {
|
||||||
|
//Bypassing/Forced?
|
||||||
if (sendi != player || pl.getPerms().getBypassCooldown(player))
|
if (sendi != player || pl.getPerms().getBypassCooldown(player))
|
||||||
return true;
|
return true;
|
||||||
|
//Currently rtp'ing?
|
||||||
else if (rtping.containsKey(player.getUniqueId()))
|
else if (rtping.containsKey(player.getUniqueId()))
|
||||||
if (rtping.get(player.getUniqueId())) {
|
if (rtping.get(player.getUniqueId())) {
|
||||||
pl.getText().getAlready(player);
|
pl.getText().getAlready(player);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//Cooling down?
|
||||||
if (cooldownTimer) {
|
if (cooldownTimer) {
|
||||||
Player p = (Player) sendi;
|
Player p = (Player) sendi;
|
||||||
if (cooldowns.containsKey(p.getUniqueId())) {
|
if (cooldowns.containsKey(p.getUniqueId())) {
|
||||||
@ -144,11 +146,12 @@ public class Commands {
|
|||||||
if (!pl.getPerms().getBypassDelay(p))
|
if (!pl.getPerms().getBypassDelay(p))
|
||||||
Left = Left + timer;
|
Left = Left + timer;
|
||||||
if (Left > 0) {
|
if (Left > 0) {
|
||||||
// Still cooling down
|
//Still cooling down
|
||||||
pl.getText().getCooldown(sendi, String.valueOf(Left));
|
pl.getText().getCooldown(sendi, String.valueOf(Left));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
cooldowns.remove(p.getUniqueId());
|
//Reset timer, but allow them to tp
|
||||||
|
cooldowns.put(p.getUniqueId(), System.currentTimeMillis());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.commands.types;
|
package me.SuperRonanCraft.BetterRTP.player.commands.types;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
||||||
import me.SuperRonanCraft.BetterRTP.Main;
|
import me.SuperRonanCraft.BetterRTP.Main;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class CmdBiome implements RTPCommand {
|
public class CmdBiome implements RTPCommand {
|
||||||
@ -17,7 +19,10 @@ public class CmdBiome implements RTPCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> tabComplete(CommandSender sendi, String[] args) {
|
public List<String> tabComplete(CommandSender sendi, String[] args) {
|
||||||
return null;
|
List<String> list = new ArrayList<>();
|
||||||
|
if (args.length == 2)
|
||||||
|
getCmd().addBiomes(list, args);
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean permission(CommandSender sendi) {
|
public boolean permission(CommandSender sendi) {
|
||||||
@ -27,4 +32,8 @@ public class CmdBiome implements RTPCommand {
|
|||||||
public void usage(CommandSender sendi, String label) {
|
public void usage(CommandSender sendi, String label) {
|
||||||
Main.getInstance().getText().getUsageBiome(sendi, label);
|
Main.getInstance().getText().getUsageBiome(sendi, label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Commands getCmd() {
|
||||||
|
return Main.getInstance().getCmd();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,6 @@ public class CmdPlayer implements RTPCommand {
|
|||||||
|
|
||||||
public List<String> tabComplete(CommandSender sendi, String[] args) {
|
public List<String> tabComplete(CommandSender sendi, String[] args) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
System.out.println(this.toString());
|
|
||||||
if (args.length == 2) {
|
if (args.length == 2) {
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
if (p.getDisplayName().toLowerCase().startsWith(args[1].toLowerCase()))
|
if (p.getDisplayName().toLowerCase().startsWith(args[1].toLowerCase()))
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.commands.types;
|
package me.SuperRonanCraft.BetterRTP.player.commands.types;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
|
||||||
import me.SuperRonanCraft.BetterRTP.Main;
|
import me.SuperRonanCraft.BetterRTP.Main;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.events;
|
package me.SuperRonanCraft.BetterRTP.player.events;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.invs.RTPInventories;
|
||||||
import me.SuperRonanCraft.BetterRTP.Main;
|
import me.SuperRonanCraft.BetterRTP.Main;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.invs.RTPInventories;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.events;
|
package me.SuperRonanCraft.BetterRTP.player.events;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.player.commands.CommandTypes;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
||||||
import me.SuperRonanCraft.BetterRTP.Main;
|
import me.SuperRonanCraft.BetterRTP.Main;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -34,8 +34,8 @@ class Interact {
|
|||||||
action(e.getPlayer(), null);
|
action(e.getPlayer(), null);
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
for (String cmd : Commands.cmds)
|
for (CommandTypes cmd : CommandTypes.values())
|
||||||
if (command.equalsIgnoreCase(cmd)) {
|
if (command.equalsIgnoreCase(cmd.name())) {
|
||||||
action(e.getPlayer(), cmd(sign.getLines()).split(" "));
|
action(e.getPlayer(), cmd(sign.getLines()).split(" "));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ public class Econ {
|
|||||||
private boolean checked = false;
|
private boolean checked = false;
|
||||||
|
|
||||||
public boolean charge(Player player, int price) {
|
public boolean charge(Player player, int price) {
|
||||||
check();
|
check(false);
|
||||||
//player.sendMessage("Charging = " + (e != null) + " charge = " + price);
|
//player.sendMessage("Charging = " + (e != null) + " charge = " + price);
|
||||||
if (e != null)
|
if (e != null)
|
||||||
if (price != 0) {
|
if (price != 0) {
|
||||||
@ -31,8 +31,12 @@ public class Econ {
|
|||||||
e.depositPlayer(p, price);
|
e.depositPlayer(p, price);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void check() {
|
public void load() {
|
||||||
if (!checked)
|
check(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void check(boolean force) {
|
||||||
|
if (!checked || force)
|
||||||
registerEconomy();
|
registerEconomy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.invs;
|
package me.SuperRonanCraft.BetterRTP.references.invs;
|
||||||
|
|
||||||
import me.SuperRonanCraft.BetterRTP.Main;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory_Defaults;
|
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory_Defaults;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.Main;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.invs.enums;
|
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.Main;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
import me.SuperRonanCraft.BetterRTP.player.PlayerInfo;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -27,7 +27,7 @@ public interface RTPInventory_Defaults {
|
|||||||
if (lore != null)
|
if (lore != null)
|
||||||
_meta.setLore(lore);
|
_meta.setLore(lore);
|
||||||
if (name != null)
|
if (name != null)
|
||||||
_meta.setDisplayName(name);
|
_meta.setDisplayName(Main.getInstance().getText().color(name));
|
||||||
}
|
}
|
||||||
_stack.setItemMeta(_meta);
|
_stack.setItemMeta(_meta);
|
||||||
return _stack;
|
return _stack;
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.invs.types;
|
package me.SuperRonanCraft.BetterRTP.references.invs.types;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory;
|
||||||
import me.SuperRonanCraft.BetterRTP.Main;
|
import me.SuperRonanCraft.BetterRTP.Main;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics.FILETYPE;
|
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics.FILETYPE;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
|
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 me.SuperRonanCraft.BetterRTP.references.invs.enums.RTP_INV_ITEMS;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
@ -21,11 +20,16 @@ public class RTPInvCoordinates extends RTPInventory {
|
|||||||
Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.WORLDS).show(p);
|
Main.getInstance().getInvs().getInv(RTP_INV_SETTINGS.WORLDS).show(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int slots = (Bukkit.getWorlds().size() - (Bukkit.getWorlds().size() % 9) + 1) * 9;
|
int slots = (RTP_COORDINATES_SETTINGS.values().length - (RTP_COORDINATES_SETTINGS.values().length % 9) + 1) * 9;
|
||||||
if (slots < 6 * 9)
|
if (slots < 6 * 9)
|
||||||
slots += 9;
|
slots += 9;
|
||||||
Inventory inv = this.createInv(slots, "Settings: &lCoordinates");
|
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);
|
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);
|
inv.setItem(inv.getSize() - 9 + RTP_INV_ITEMS.BACK.slot, _item);
|
||||||
p.openInventory(inv);
|
p.openInventory(inv);
|
||||||
@ -35,6 +39,9 @@ public class RTPInvCoordinates extends RTPInventory {
|
|||||||
@Override
|
@Override
|
||||||
public void clickEvent(InventoryClickEvent e) {
|
public void clickEvent(InventoryClickEvent e) {
|
||||||
int slot = e.getSlot();
|
int slot = e.getSlot();
|
||||||
|
for (RTP_COORDINATES_SETTINGS set : RTP_COORDINATES_SETTINGS.values()) {
|
||||||
|
|
||||||
|
}
|
||||||
for (RTP_INV_ITEMS type : RTP_INV_ITEMS.values()) {
|
for (RTP_INV_ITEMS type : RTP_INV_ITEMS.values()) {
|
||||||
if (type.slot != -1) {
|
if (type.slot != -1) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -50,19 +57,19 @@ public class RTPInvCoordinates extends RTPInventory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum RTP_COORDINATES_SETTINGS {
|
enum RTP_COORDINATES_SETTINGS {
|
||||||
CATEGORY( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Settings.Importance.Enabled",
|
CENTER_Z( SETTINGS_TYPE.INTEGER, FILETYPE.CONFIG, "Settings.Importance.Enabled",
|
||||||
new Object[]{true, "Category", "&7Toggle Categories system", "paper"}),
|
new Object[]{true, "Center Z", "&7Toggle Categories system", "paper"}),
|
||||||
COOLDOWN( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Settings.Cooldown.Enabled",
|
CENTER_X( SETTINGS_TYPE.INTEGER, FILETYPE.CONFIG, "Settings.Cooldown.Enabled",
|
||||||
new Object[]{true, "Cooldown", "&7Toggle Cooldown system", "paper"}),
|
new Object[]{true, "Center X", "&7Toggle Cooldown system", "paper"}),
|
||||||
COOLDOWN_TIME( SETTINGS_TYPE.INTEGER, FILETYPE.CONFIG, "Settings.Cooldown.Time",
|
USE_WORLDBORDER( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Settings.Cooldown.Time",
|
||||||
new Object[]{true, "Cooldown Time", new ArrayList<String>() {{
|
new Object[]{true, "Cooldown Time", new ArrayList<String>() {{
|
||||||
add("&7Set the time (in minutes)");
|
add("&7Set the time (in minutes)");
|
||||||
add("&7between making a new ticket");
|
add("&7between making a new ticket");
|
||||||
}}, "paper"}),
|
}}, "paper"}),
|
||||||
DEBUG( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Settings.Debug",
|
/*DEBUG( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Settings.Debug",
|
||||||
new Object[]{true, "Debug", "&7Toggle debugger", "paper"}),
|
new Object[]{true, "Debug", "&7Toggle debugger", "paper"}),
|
||||||
TEMPLATE( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Template.Enabled",
|
TEMPLATE( SETTINGS_TYPE.BOOLEAN, FILETYPE.CONFIG, "Template.Enabled",
|
||||||
new Object[]{true, "Templates", "&7Toggle Templates system", "paper"});
|
new Object[]{true, "Templates", "&7Toggle Templates system", "paper"});*/;
|
||||||
|
|
||||||
SETTINGS_TYPE type;
|
SETTINGS_TYPE type;
|
||||||
FILETYPE filetype;
|
FILETYPE filetype;
|
||||||
@ -122,18 +129,18 @@ enum RTP_COORDINATES_SETTINGS {
|
|||||||
public FILETYPE getFiletype() {
|
public FILETYPE getFiletype() {
|
||||||
return filetype;
|
return filetype;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
enum SETTINGS_TYPE {
|
enum SETTINGS_TYPE {
|
||||||
BOOLEAN(Boolean.class), STRING(String.class), INTEGER(Integer.class);
|
BOOLEAN(Boolean.class), STRING(String.class), INTEGER(Integer.class);
|
||||||
|
|
||||||
private Class cla;
|
private Class cla;
|
||||||
|
|
||||||
SETTINGS_TYPE(Class cla) {
|
SETTINGS_TYPE(Class cla) {
|
||||||
this.cla = cla;
|
this.cla = cla;
|
||||||
}
|
}
|
||||||
|
|
||||||
Class getCla() {
|
Class getCla() {
|
||||||
return cla;
|
return cla;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.invs.types;
|
package me.SuperRonanCraft.BetterRTP.references.invs.types;
|
||||||
|
|
||||||
import me.SuperRonanCraft.BetterRTP.references.invs.RTP_INV_SETTINGS;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.references.invs.enums.RTPInventory;
|
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.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# BetterRTP plugin by SuperRonanCraft! (Join my Public Server mc.RonanCraft.net) #
|
# BetterRTP plugin by SuperRonanCraft! (Join my Public Server mc.RonanCraft.net) #
|
||||||
# Please give me credit, I'm a first time coder, and would love to see more discussions on my Spigot page! #
|
# Need help? go to https://ronancraft.net/discord! #
|
||||||
|
|
||||||
Language-File: 'en.yml'
|
Language-File: 'en.yml'
|
||||||
|
|
||||||
@ -26,17 +26,12 @@ Settings:
|
|||||||
CancelOnMove: true
|
CancelOnMove: true
|
||||||
DisableUpdater: false
|
DisableUpdater: false
|
||||||
|
|
||||||
WorldType: # Available types are NORMAL, NETHER and END
|
|
||||||
- world: NORMAL
|
|
||||||
- world_nether: NETHER
|
|
||||||
- world_the_end: NORMAL
|
|
||||||
|
|
||||||
Default:
|
Default:
|
||||||
UseWorldBorder: true
|
UseWorldBorder: false
|
||||||
## "Biomes: []" means all biomes are allowed! #
|
## "Biomes: []" means all biomes are allowed! #
|
||||||
## Biomes are optional, more biomes at https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Biome.html #
|
## Biomes are optional, more biomes at https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/block/Biome.html #
|
||||||
Biomes: []
|
Biomes: []
|
||||||
MaxRadius: 100
|
MaxRadius: 1000
|
||||||
MinRadius: 10
|
MinRadius: 10
|
||||||
## If "UseWorldBorder" is set to true above, these values WILL be ignored! Except Biomes! #
|
## If "UseWorldBorder" is set to true above, these values WILL be ignored! Except Biomes! #
|
||||||
CenterX: 0
|
CenterX: 0
|
||||||
@ -64,14 +59,14 @@ DisabledWorlds:
|
|||||||
## Worlds you want to have a custom min/max and spawn center in #
|
## 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!
|
## [MaxRadius] and [MinRadius] MUST be positive! These cannot be equal to each other!
|
||||||
CustomWorlds:
|
CustomWorlds:
|
||||||
- world:
|
- custom_world_1:
|
||||||
UseWorldBorder: false
|
UseWorldBorder: false
|
||||||
## If UseWorldBorder is true, everything will be ignored EXEPT "MinRadius"!
|
## If UseWorldBorder is true, everything will be ignored EXEPT "MinRadius"!
|
||||||
MaxRadius: 1000
|
MaxRadius: 1000
|
||||||
MinRadius: 100
|
MinRadius: 100
|
||||||
CenterX: 0
|
CenterX: 0
|
||||||
CenterZ: 0
|
CenterZ: 0
|
||||||
- nether:
|
- other_custom_world:
|
||||||
MaxRadius: 100000
|
MaxRadius: 100000
|
||||||
MinRadius: 1000
|
MinRadius: 1000
|
||||||
CenterX: 123
|
CenterX: 123
|
||||||
@ -83,7 +78,11 @@ CustomWorlds:
|
|||||||
|
|
||||||
## Override a world and rtp a player executing the command in one world, to another
|
## Override a world and rtp a player executing the command in one world, to another
|
||||||
Overrides:
|
Overrides:
|
||||||
#FORMAT <CURRENT>:<OTHER>
|
#FORMAT - <CURRENT>:<OTHER>
|
||||||
- world_nether: 'world'
|
- master_world: 'world'
|
||||||
- creative: 'world'
|
- creative_world: 'world'
|
||||||
|
|
||||||
|
WorldType: # Available types are NORMAL, NETHER
|
||||||
|
- world: NORMAL
|
||||||
|
- world_nether: NETHER
|
||||||
|
- world_the_end: NORMAL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user