mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 00:55:45 +00:00
cooldown can be set per world type + addons fix
This commit is contained in:
parent
201f645c43
commit
5ebee9590b
@ -7,7 +7,7 @@
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTPAddons</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.8.2</version>
|
||||
<version>1.8.3</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
@ -109,7 +109,7 @@
|
||||
<dependency>
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- ProtocolLib -->
|
||||
|
@ -91,7 +91,7 @@ public class AddonRTPMenu implements Addon, Listener {
|
||||
if (validClick(e)) {
|
||||
e.setCancelled(true);
|
||||
MenuData data = getData((Player) e.getWhoClicked());
|
||||
CmdTeleport.teleport(e.getWhoClicked(), "rtp", data.getWorldSlots().get(e.getSlot()).getName(), null);
|
||||
CmdTeleport.teleport(e.getWhoClicked(), "rtp", data.getWorldSlots().get(e.getSlot()), null);
|
||||
e.getWhoClicked().closeInventory();
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package me.SuperRonanCraft.BetterRTPAddons.addons.rtpmenu;
|
||||
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import me.SuperRonanCraft.BetterRTP.player.commands.types.CmdTeleport;
|
||||
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
||||
import me.SuperRonanCraft.BetterRTPAddons.util.Files;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -23,7 +24,7 @@ public class RTPMenu_SelectWorld {
|
||||
List<World> bukkit_worlds = Bukkit.getWorlds();
|
||||
List<World> actual_worlds = new ArrayList<>();
|
||||
for (World world : bukkit_worlds) {
|
||||
if (pl.getWorlds().containsKey(world.getName()) && BetterRTP.getInstance().getPerms().getAWorld(p, world.getName()))
|
||||
if (pl.getWorlds().containsKey(world.getName()) && PermissionNode.getAWorld(p, world.getName()))
|
||||
actual_worlds.add(world);
|
||||
}
|
||||
if (actual_worlds.isEmpty() || (actual_worlds.size() <= 1 && !BetterRTP.getInstance().getSettings().isDebug())) {
|
||||
|
@ -140,10 +140,11 @@ public class CmdInfo implements RTPCommand, RTPCommandHelpable {
|
||||
info.add("&7- &6Min Y&7: &f" + _rtpworld.getMinY());
|
||||
info.add("&7- &eMax Y&7: &f" + _rtpworld.getMaxY());
|
||||
info.add("&7- &6Price&7: &f" + _rtpworld.getPrice() + getInfo(_rtpworld, worldDefault, "price"));
|
||||
info.add("&7- &eBiomes&7: &f" + _rtpworld.getBiomes().toString());
|
||||
info.add("&7- &6Shape&7: &f" + _rtpworld.getShape().toString() + getInfo(_rtpworld, worldDefault, "shape"));
|
||||
info.add("&7- &ePermission Group&7: " + (_rtpworld.getConfig() != null ? "&a" + _rtpworld.getConfig().getGroupName() : "&cN/A"));
|
||||
info.add("&7- &6Queue Available&7: " + QueueHandler.getApplicable(_rtpworld).size());
|
||||
info.add("&7- &eCooldown&7: &f" + _rtpworld.getCooldown() + getInfo(_rtpworld, worldDefault, "cooldown"));
|
||||
info.add("&7- &6Biomes&7: &f" + _rtpworld.getBiomes().toString());
|
||||
info.add("&7- &eShape&7: &f" + _rtpworld.getShape().toString() + getInfo(_rtpworld, worldDefault, "shape"));
|
||||
info.add("&7- &6Permission Group&7: " + (_rtpworld.getConfig() != null ? "&a" + _rtpworld.getConfig().getGroupName() : "&cN/A"));
|
||||
info.add("&7- &eQueue Available&7: " + QueueHandler.getApplicable(_rtpworld).size());
|
||||
}
|
||||
}
|
||||
return info;
|
||||
@ -169,6 +170,8 @@ public class CmdInfo implements RTPCommand, RTPCommandHelpable {
|
||||
return worldPlayer.getShape() == worldDefault.getShape() ? " &8(default)" : "";
|
||||
case "setup":
|
||||
return worldPlayer.setup_type == RTP_SETUP_TYPE.LOCATION ? " &7(" + worldPlayer.setup_name + ")" : "";
|
||||
case "cooldown":
|
||||
return worldPlayer.getPlayer() != null ? PermissionNode.BYPASS_COOLDOWN.check(worldPlayer.getPlayer()) ? " &8(bypassing)" : "" : "&cN/A";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class RTP {
|
||||
break;
|
||||
}
|
||||
}
|
||||
pWorld.setup(setup_name, setup_info.getLocation(), setup_info.getLocation().getBiomes(), setup_info.isPersonalized());
|
||||
pWorld.setup(setup_name, setup_info.getLocation(), setup_info.getLocation().getBiomes());
|
||||
}
|
||||
|
||||
if (!pWorld.isSetup()) {
|
||||
@ -113,17 +113,17 @@ public class RTP {
|
||||
|
||||
//Permission Group
|
||||
if (group != null) {
|
||||
pWorld.setup(null, group, setup_info.getBiomes(), setup_info.isPersonalized());
|
||||
pWorld.setup(null, group, setup_info.getBiomes());
|
||||
pWorld.config = group;
|
||||
}
|
||||
//Custom World
|
||||
else if (RTPcustomWorld.containsKey(setup_info.getWorld().getName())) {
|
||||
RTPWorld cWorld = RTPcustomWorld.get(pWorld.getWorld().getName());
|
||||
pWorld.setup(null, cWorld, setup_info.getBiomes(), setup_info.isPersonalized());
|
||||
pWorld.setup(null, cWorld, setup_info.getBiomes());
|
||||
}
|
||||
//Default World
|
||||
else
|
||||
pWorld.setup(null, RTPdefaultWorld, setup_info.getBiomes(), setup_info.isPersonalized());
|
||||
pWorld.setup(null, RTPdefaultWorld, setup_info.getBiomes());
|
||||
}
|
||||
//World type
|
||||
pWorld.setWorldtype(getWorldType(pWorld));
|
||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
public class CooldownHandler {
|
||||
|
||||
@Getter boolean enabled, loaded, cooldownByWorld;
|
||||
@Getter private int cooldownTime; //Global Cooldown timer
|
||||
@Getter private int defaultCooldownTime; //Global Cooldown timer
|
||||
private int lockedAfter; //Rtp's before being locked
|
||||
private final List<Player> downloading = new ArrayList<>();
|
||||
//private final DatabaseCooldownsGlobal globalCooldown = new DatabaseCooldownsGlobal();
|
||||
@ -34,7 +34,7 @@ public class CooldownHandler {
|
||||
downloading.clear();
|
||||
loaded = false;
|
||||
if (enabled) {
|
||||
cooldownTime = config.getInt("Settings.Cooldown.Time");
|
||||
defaultCooldownTime = config.getInt("Settings.Cooldown.Time");
|
||||
lockedAfter = config.getInt("Settings.Cooldown.LockAfter");
|
||||
cooldownByWorld = config.getBoolean("Settings.Cooldown.PerWorld");
|
||||
}
|
||||
|
@ -38,7 +38,5 @@ public interface RTPWorld {
|
||||
return null;
|
||||
}
|
||||
|
||||
default long getCooldown() {
|
||||
return BetterRTP.getInstance().getCooldowns().getCooldownTime();
|
||||
}
|
||||
long getCooldown();
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ public interface RTPWorld_Defaulted {
|
||||
|
||||
void setMaxY(int value);
|
||||
|
||||
void setCooldown(long value);
|
||||
|
||||
default void setupDefaults() {
|
||||
setAllFrom(BetterRTP.getInstance().getRTP().RTPdefaultWorld);
|
||||
}
|
||||
@ -45,5 +47,6 @@ public interface RTPWorld_Defaulted {
|
||||
setShape(rtpWorld.getShape());
|
||||
setMinY(rtpWorld.getMinY());
|
||||
setMaxY(rtpWorld.getMaxY());
|
||||
setCooldown(rtpWorld.getCooldown());
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ public class WorldCustom implements RTPWorld, RTPWorld_Defaulted {
|
||||
public World world;
|
||||
private boolean useWorldborder;
|
||||
private int centerX, centerZ, maxRad, minRad, price, miny, maxy;
|
||||
private long cooldown;
|
||||
private List<String> biomes;
|
||||
private RTP_SHAPE shape;
|
||||
|
||||
@ -98,6 +99,10 @@ public class WorldCustom implements RTPWorld, RTPWorld_Defaulted {
|
||||
if (test.get("MaxY").getClass() == Integer.class)
|
||||
this.maxy = Integer.parseInt((test.get("MaxY")).toString());
|
||||
}
|
||||
if (test.get("Cooldown") != null) {
|
||||
if (test.get("Cooldown").getClass() == Long.class)
|
||||
this.cooldown = Long.parseLong((test.get("Cooldown")).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
//Booleans
|
||||
@ -209,6 +214,11 @@ public class WorldCustom implements RTPWorld, RTPWorld_Defaulted {
|
||||
return maxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
|
||||
//Setters
|
||||
@Override
|
||||
public void setUseWorldBorder(boolean value) {
|
||||
@ -264,4 +274,9 @@ public class WorldCustom implements RTPWorld, RTPWorld_Defaulted {
|
||||
public void setMaxY(int value) {
|
||||
this.maxy = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCooldown(long value) {
|
||||
this.cooldown = value;
|
||||
}
|
||||
}
|
||||
|
@ -143,4 +143,9 @@ public class WorldDefault implements RTPWorld {
|
||||
public int getMaxY() {
|
||||
return maxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCooldown() {
|
||||
return BetterRTP.getInstance().getCooldowns().getDefaultCooldownTime();
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import java.util.Map;
|
||||
public class WorldLocations implements RTPWorld, RTPWorld_Defaulted {
|
||||
private boolean useWorldborder;
|
||||
private int centerX, centerZ, maxRad, minRad, price, miny, maxy;
|
||||
private long cooldown;
|
||||
private List<String> biomes;
|
||||
private World world;
|
||||
private RTP_SHAPE shape;
|
||||
@ -114,6 +115,9 @@ public class WorldLocations implements RTPWorld, RTPWorld_Defaulted {
|
||||
if (test.get("MaxY") != null)
|
||||
if (test.get("MaxY").getClass() == Integer.class)
|
||||
this.maxy = Integer.parseInt(test.get("MaxY").toString());
|
||||
if (test.get("Cooldown") != null)
|
||||
if (test.get("Cooldown").getClass() == Long.class)
|
||||
this.cooldown = Long.parseLong(test.get("Cooldown").toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -184,6 +188,10 @@ public class WorldLocations implements RTPWorld, RTPWorld_Defaulted {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
//Setters
|
||||
|
||||
@Override
|
||||
@ -240,4 +248,9 @@ public class WorldLocations implements RTPWorld, RTPWorld_Defaulted {
|
||||
public void setMaxY(int value) {
|
||||
this.maxy = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCooldown(long value) {
|
||||
this.cooldown = value;
|
||||
}
|
||||
}
|
||||
|
@ -240,6 +240,11 @@ public class WorldPermissionGroup implements RTPWorld, RTPWorld_Defaulted {
|
||||
this.maxy = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCooldown(long value) {
|
||||
this.cooldown = value;
|
||||
}
|
||||
|
||||
/*public static class RTPPermConfiguration {
|
||||
|
||||
boolean valid;
|
||||
|
@ -15,6 +15,7 @@ import java.util.*;
|
||||
public class WorldPlayer implements RTPWorld, RTPWorld_Defaulted {
|
||||
private boolean useWorldborder;
|
||||
private int CenterX, CenterZ, maxRad, minRad, price, min_y, max_y;
|
||||
private long cooldown;
|
||||
private List<String> Biomes;
|
||||
@Getter private final Player player;
|
||||
private final World world;
|
||||
@ -32,7 +33,7 @@ public class WorldPlayer implements RTPWorld, RTPWorld_Defaulted {
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
public void setup(String setup_name, RTPWorld world, List<String> biomes, boolean personal) {
|
||||
public void setup(String setup_name, RTPWorld world, List<String> biomes) {
|
||||
if (world instanceof WorldLocations) {
|
||||
setup_type = RTP_SETUP_TYPE.LOCATION;
|
||||
} else if (world instanceof WorldCustom) {
|
||||
@ -74,7 +75,8 @@ public class WorldPlayer implements RTPWorld, RTPWorld_Defaulted {
|
||||
//MinY
|
||||
setMinY(world.getMinY());
|
||||
setMaxY(world.getMaxY());
|
||||
//min_y = world.getWorld().getBlockAt(0, -1, 0).getType() != Material.AIR ?
|
||||
//Cooldown
|
||||
setCooldown(world.getCooldown());
|
||||
setup = true;
|
||||
}
|
||||
|
||||
@ -264,6 +266,11 @@ public class WorldPlayer implements RTPWorld, RTPWorld_Defaulted {
|
||||
this.max_y = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCooldown(long value) {
|
||||
this.cooldown = value;
|
||||
}
|
||||
|
||||
public WorldPermissionGroup getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
@ -280,4 +287,9 @@ public class WorldPlayer implements RTPWorld, RTPWorld_Defaulted {
|
||||
public int getMaxY() {
|
||||
return max_y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getCooldown() {
|
||||
return cooldown;
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ CustomWorlds:
|
||||
Shape: 'square'
|
||||
MaxY: 320
|
||||
MinY: 0
|
||||
Cooldown: 60
|
||||
- other_custom_world:
|
||||
MaxRadius: 10000
|
||||
MinRadius: 150
|
||||
|
@ -12,7 +12,6 @@
|
||||
Enabled: false #enable the locations feature
|
||||
RequirePermission: false #Require players to have `betterrtp.location.<world_name>`
|
||||
UseLocationIfAvailable: true #Will choose a location upon `/rtp` if location(s) is available in the world
|
||||
#OnlyAllowInWorld: true #Only allow players to use locations that correspond to the world they are standing in #coming soon
|
||||
|
||||
Locations:
|
||||
- main_loc:
|
||||
@ -24,3 +23,4 @@ Locations:
|
||||
Shape: square #optional
|
||||
MinY: 0 #optional
|
||||
MaxY: 320 #optional
|
||||
Cooldown: 300 #optional
|
Loading…
x
Reference in New Issue
Block a user