mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
short hand coding changes + kingdoms updated to 1.12.3
This commit is contained in:
parent
303fba912d
commit
934b246615
@ -109,7 +109,7 @@
|
||||
<dependency>
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<version>3.2.3</version>
|
||||
<version>3.2.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- ProtocolLib -->
|
||||
|
4
pom.xml
4
pom.xml
@ -7,7 +7,7 @@
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>3.2.3</version>
|
||||
<version>3.2.4</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
@ -258,7 +258,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.cryptomorin</groupId>
|
||||
<artifactId>kingdoms</artifactId>
|
||||
<version>1.11.15</version>
|
||||
<version>1.12.3</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -127,7 +127,7 @@ public class BetterRTP extends JavaPlugin {
|
||||
}
|
||||
|
||||
public static void debug(String str) {
|
||||
if (getInstance().getSettings().debug)
|
||||
if (getInstance().getSettings().isDebug())
|
||||
getInstance().getLogger().info(str);
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class Commands {
|
||||
}
|
||||
|
||||
public void registerCommand(RTPCommand cmd, boolean forced) {
|
||||
if (!cmd.isDebugOnly() || pl.getSettings().debug || forced) //If debug only, can it be enabled?
|
||||
if (!cmd.isDebugOnly() || pl.getSettings().isDebug() || forced) //If debug only, can it be enabled?
|
||||
commands.add(cmd);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@ public class Join {
|
||||
|
||||
//RTP on first join
|
||||
private void rtpOnFirstJoin(Player p) {
|
||||
if (getPl().getSettings().rtpOnFirstJoin_Enabled && !p.hasPlayedBefore())
|
||||
HelperRTP.tp(p, Bukkit.getConsoleSender(), getPl().getSettings().rtpOnFirstJoin_World, null, RTP_TYPE.JOIN); //Console is sender to override delays
|
||||
if (getPl().getSettings().isRtpOnFirstJoin_Enabled() && !p.hasPlayedBefore())
|
||||
HelperRTP.tp(p, Bukkit.getConsoleSender(), getPl().getSettings().getRtpOnFirstJoin_World(), null, RTP_TYPE.JOIN); //Console is sender to override delays
|
||||
}
|
||||
|
||||
private BetterRTP getPl() {
|
||||
|
@ -56,54 +56,54 @@ public class RTP {
|
||||
}
|
||||
|
||||
public WorldPlayer getPlayerWorld(RTPSetupInformation setup_info) {
|
||||
WorldPlayer pWorld = new WorldPlayer(setup_info.player, Bukkit.getWorld(setup_info.world));
|
||||
WorldPlayer pWorld = new WorldPlayer(setup_info.getPlayer(), Bukkit.getWorld(setup_info.getWorld()));
|
||||
|
||||
//Locations
|
||||
if (setup_info.location == null) {
|
||||
if (setup_info.getLocation() == null) {
|
||||
List<RTPWorld> locationsList = new ArrayList<>();
|
||||
for (Map.Entry<String, RTPWorld> location_set : worldLocations.entrySet()) {
|
||||
RTPWorld location = location_set.getValue();
|
||||
if (location.getWorld().getName().equals(setup_info.world))
|
||||
if (location.getWorld().getName().equals(setup_info.getWorld()))
|
||||
locationsList.add(location_set.getValue());
|
||||
}
|
||||
if (!locationsList.isEmpty()) {
|
||||
RTPWorld location = locationsList.size() > 1 ? locationsList.get((new Random()).nextInt(locationsList.size() - 1)) : locationsList.get(0);
|
||||
|
||||
setup_info.location = (WorldLocations) location;
|
||||
setup_info.setLocation((WorldLocations) location);
|
||||
}
|
||||
}
|
||||
|
||||
if (setup_info.location != null) {
|
||||
if (setup_info.getLocation() != null) {
|
||||
String setup_name = null;
|
||||
for (Map.Entry<String, RTPWorld> location_set : worldLocations.entrySet()) {
|
||||
RTPWorld location = location_set.getValue();
|
||||
if (location == setup_info.location) {
|
||||
if (location == setup_info.getLocation()) {
|
||||
setup_name = location_set.getKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
pWorld.setup(setup_name, setup_info.location, setup_info.location.getBiomes(), setup_info.personalized);
|
||||
pWorld.setup(setup_name, setup_info.getLocation(), setup_info.getLocation().getBiomes(), setup_info.isPersonalized());
|
||||
}
|
||||
|
||||
|
||||
if (!pWorld.isSetup()) {
|
||||
//Custom World
|
||||
if (customWorlds.containsKey(setup_info.world)) {
|
||||
if (customWorlds.containsKey(setup_info.getWorld())) {
|
||||
RTPWorld cWorld = customWorlds.get(pWorld.getWorld().getName());
|
||||
pWorld.setup(null, cWorld, setup_info.biomes, setup_info.personalized);
|
||||
pWorld.setup(null, cWorld, setup_info.getBiomes(), setup_info.isPersonalized());
|
||||
}
|
||||
//Default World
|
||||
else
|
||||
pWorld.setup(null, defaultWorld, setup_info.biomes, setup_info.personalized);
|
||||
pWorld.setup(null, defaultWorld, setup_info.getBiomes(), setup_info.isPersonalized());
|
||||
}
|
||||
//World type
|
||||
WORLD_TYPE world_type; //World rtp type
|
||||
if (this.world_type.containsKey(setup_info.world))
|
||||
world_type = this.world_type.get(setup_info.world);
|
||||
if (this.world_type.containsKey(setup_info.getWorld()))
|
||||
world_type = this.world_type.get(setup_info.getWorld());
|
||||
else {
|
||||
world_type = WORLD_TYPE.NORMAL;
|
||||
this.world_type.put(setup_info.world, world_type); //Defaults this so the error message isn't spammed
|
||||
getPl().getLogger().warning("Seems like the world `" + setup_info.world + "` does not have a `WorldType` declared. " +
|
||||
this.world_type.put(setup_info.getWorld(), world_type); //Defaults this so the error message isn't spammed
|
||||
getPl().getLogger().warning("Seems like the world `" + setup_info.getWorld() + "` does not have a `WorldType` declared. " +
|
||||
"Please add/fix this in the config.yml file! " +
|
||||
"This world will be treated as an overworld!");
|
||||
}
|
||||
@ -112,22 +112,22 @@ public class RTP {
|
||||
}
|
||||
|
||||
public void start(RTPSetupInformation setup_info) {
|
||||
RTP_SettingUpEvent setup = new RTP_SettingUpEvent(setup_info.player);
|
||||
RTP_SettingUpEvent setup = new RTP_SettingUpEvent(setup_info.getPlayer());
|
||||
Bukkit.getPluginManager().callEvent(setup);
|
||||
if (setup.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String world_name = setup_info.world;
|
||||
Player p = setup_info.player;
|
||||
CommandSender sendi = setup_info.sender;
|
||||
String world_name = setup_info.getWorld();
|
||||
Player p = setup_info.getPlayer();
|
||||
CommandSender sendi = setup_info.getSender();
|
||||
|
||||
// Locations
|
||||
if (setup_info.location != null) {
|
||||
WorldLocations location = setup_info.location;
|
||||
if (setup_info.getLocation() != null) {
|
||||
WorldLocations location = setup_info.getLocation();
|
||||
world_name = location.getWorld().getName();
|
||||
setup_info.world = world_name;
|
||||
setup_info.biomes = location.getBiomes();
|
||||
setup_info.setWorld(world_name);
|
||||
setup_info.setBiomes(location.getBiomes());
|
||||
}
|
||||
|
||||
// Check overrides
|
||||
@ -146,7 +146,7 @@ public class RTP {
|
||||
}
|
||||
if (overriden.containsKey(world_name)) {
|
||||
world_name = overriden.get(world_name);
|
||||
setup_info.world = world_name;
|
||||
setup_info.setWorld(world_name);
|
||||
}
|
||||
// Not forced and has 'betterrtp.world.<world>'
|
||||
if (sendi == p && !getPl().getPerms().getAWorld(sendi, world_name)) {
|
||||
@ -162,7 +162,7 @@ public class RTP {
|
||||
// Economy
|
||||
if (!getPl().getEco().hasBalance(sendi, pWorld))
|
||||
return;
|
||||
rtp(sendi, pWorld, setup_info.delay, setup_info.rtp_type, setup_info.cooldown);
|
||||
rtp(sendi, pWorld, setup_info.isDelay(), setup_info.getRtp_type(), setup_info.isCooldown());
|
||||
}
|
||||
|
||||
private void rtp(CommandSender sendi, WorldPlayer pWorld, boolean delay, RTP_TYPE type, boolean cooldown) {
|
||||
@ -175,7 +175,7 @@ public class RTP {
|
||||
//Setup player rtp methods
|
||||
RTPPlayer rtpPlayer = new RTPPlayer(p, this, pWorld, type);
|
||||
// Delaying? Else, just go
|
||||
if (getPl().getSettings().delayEnabled && delay) {
|
||||
if (getPl().getSettings().isDelayEnabled() && delay) {
|
||||
new RTPDelay(sendi, rtpPlayer, delayTime, cancelOnMove, cancelOnDamage);
|
||||
} else {
|
||||
teleport.beforeTeleportInstant(sendi, p);
|
||||
|
@ -22,7 +22,7 @@ public class RTPLoader {
|
||||
for (Map<?, ?> m : map)
|
||||
for (Map.Entry<?, ?> entry : m.entrySet()) {
|
||||
customWorlds.put(entry.getKey().toString(), new WorldCustom(entry.getKey().toString()));
|
||||
if (getPl().getSettings().debug)
|
||||
if (getPl().getSettings().isDebug())
|
||||
BetterRTP.debug("- Custom World '" + entry.getKey() + "' registered");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -38,7 +38,7 @@ public class RTPLoader {
|
||||
for (Map<?, ?> m : override_map)
|
||||
for (Map.Entry<?, ?> entry : m.entrySet()) {
|
||||
overriden.put(entry.getKey().toString(), entry.getValue().toString());
|
||||
if (getPl().getSettings().debug)
|
||||
if (getPl().getSettings().isDebug())
|
||||
getPl().getLogger().info("- Override '" + entry.getKey() + "' -> '" + entry.getValue() + "' added");
|
||||
if (Bukkit.getWorld(entry.getValue().toString()) == null)
|
||||
getPl().getLogger().warning("The world `" + entry.getValue() + "` doesn't seem to exist! Please update `" + entry.getKey() + "'s` override! Maybe there are capital letters?");
|
||||
@ -75,7 +75,7 @@ public class RTPLoader {
|
||||
getPl().getLogger().info("- World Type failed for '" + entry.getKey() + "' is it loaded?");
|
||||
}*/
|
||||
}
|
||||
if (getPl().getSettings().debug)
|
||||
if (getPl().getSettings().isDebug())
|
||||
for (String world : world_type.keySet())
|
||||
BetterRTP.debug("- World Type for '" + world + "' set to '" + world_type.get(world) + "'");
|
||||
} catch (Exception e) {
|
||||
@ -95,7 +95,7 @@ public class RTPLoader {
|
||||
WorldLocations location = new WorldLocations(entry.getKey().toString());
|
||||
if (location.isValid()) {
|
||||
worlds.put(entry.getKey().toString(), location);
|
||||
if (getPl().getSettings().debug)
|
||||
if (getPl().getSettings().isDebug())
|
||||
BetterRTP.debug("- Location '" + entry.getKey() + "' registered");
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
|
||||
// https://www.spigotmc.org/resources/kingdomsx.77670/
|
||||
private boolean getKingdomsx(Location loc) {
|
||||
boolean result = true;
|
||||
if (getDepends().isKingdomsX())
|
||||
if (getDepends().isKingdomsx())
|
||||
try {
|
||||
org.kingdoms.constants.land.Land land = org.kingdoms.constants.land.Land.getLand(loc);
|
||||
result = land == null || !land.isClaimed();
|
||||
@ -176,7 +176,7 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
|
||||
// https://www.spigotmc.org/resources/hclaims.90540/ (Local Repo)
|
||||
private boolean gethClaims(Location loc) {
|
||||
boolean result = true;
|
||||
if (getDepends().ishClaims())
|
||||
if (getDepends().isHClaims())
|
||||
try {
|
||||
result = ClaimAPI.getInstance().isClaimed(loc);
|
||||
} catch (Exception e) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package me.SuperRonanCraft.BetterRTP.player.rtp;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.worlds.WorldLocations;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -8,14 +10,15 @@ import java.util.List;
|
||||
|
||||
public class RTPSetupInformation {
|
||||
//Will provide information to setup an RTP attempt
|
||||
public String world;
|
||||
public CommandSender sender;
|
||||
public Player player;
|
||||
public boolean personalized, cooldown;
|
||||
public List<String> biomes;
|
||||
public WorldLocations location;
|
||||
public boolean delay;
|
||||
public RTP_TYPE rtp_type;
|
||||
@Getter @Setter private String world;
|
||||
@Getter private final CommandSender sender;
|
||||
@Getter private final Player player;
|
||||
@Getter private final boolean personalized;
|
||||
@Getter private final boolean cooldown;
|
||||
@Getter @Setter private List<String> biomes;
|
||||
@Getter @Setter private WorldLocations location;
|
||||
@Getter private final boolean delay;
|
||||
@Getter private final RTP_TYPE rtp_type;
|
||||
|
||||
public RTPSetupInformation(String world, CommandSender sender, Player player, boolean personalized) {
|
||||
this(world, sender, player, personalized, null, false, null, null);
|
||||
|
@ -67,7 +67,7 @@ public class RTPTeleport {
|
||||
getPl().getpInfo().getRtping().remove(p); //No longer rtp'ing
|
||||
//Save respawn location if first join
|
||||
if (type == RTP_TYPE.JOIN) //RTP Type was Join
|
||||
if (BetterRTP.getInstance().getSettings().rtpOnFirstJoin_SetAsRespawn) //Save as respawn is enabled
|
||||
if (BetterRTP.getInstance().getSettings().isRtpOnFirstJoin_SetAsRespawn()) //Save as respawn is enabled
|
||||
p.setBedSpawnLocation(loc, true); //True means to force a respawn even without a valid bed
|
||||
}
|
||||
});
|
||||
@ -132,7 +132,7 @@ public class RTPTeleport {
|
||||
|
||||
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)));
|
||||
int range = Math.round(Math.max(0, Math.min(16, getPl().getSettings().getPreloadRadius())));
|
||||
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));
|
||||
@ -158,7 +158,7 @@ public class RTPTeleport {
|
||||
}
|
||||
|
||||
private boolean sendStatusMessage() {
|
||||
return getPl().getSettings().statusMessages;
|
||||
return getPl().getSettings().isStatusMessages();
|
||||
}
|
||||
|
||||
private BetterRTP getPl() {
|
||||
|
@ -35,7 +35,7 @@ public class HelperRTP {
|
||||
if (ignoreCooldown || isCoolingDown(sendi, player)) { //Is Cooling down
|
||||
boolean delay = false;
|
||||
if (!ignoreDelay && sendi == player) //Forced?
|
||||
if (getPl().getSettings().delayEnabled && getPl().getSettings().delayTime > 0) //Delay enabled?
|
||||
if (getPl().getSettings().isDelayEnabled() && getPl().getSettings().getDelayTime() > 0) //Delay enabled?
|
||||
if (!getPl().getPerms().getBypassDelay(player)) //Can bypass?
|
||||
delay = true;
|
||||
//player.sendMessage("Cooldown applies: " + cooldownApplies(sendi, player));
|
||||
@ -69,8 +69,8 @@ public class HelperRTP {
|
||||
return false;
|
||||
} else { //Normal cooldown
|
||||
long Left = cooldownHandler.timeLeft(cooldownData);
|
||||
if (getPl().getSettings().delayEnabled && !getPl().getPerms().getBypassDelay(sendi))
|
||||
Left = Left + getPl().getSettings().delayTime;
|
||||
if (getPl().getSettings().isDelayEnabled() && !getPl().getPerms().getBypassDelay(sendi))
|
||||
Left = Left + getPl().getSettings().getDelayTime();
|
||||
if (Left > 0) {
|
||||
//Still cooling down
|
||||
getPl().getText().getCooldown(sendi, String.valueOf(Left));
|
||||
|
@ -1,18 +1,19 @@
|
||||
package me.SuperRonanCraft.BetterRTP.references.settings;
|
||||
|
||||
import lombok.Getter;
|
||||
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
|
||||
public class Settings {
|
||||
|
||||
public boolean debug;
|
||||
public boolean delayEnabled;
|
||||
public int delayTime;
|
||||
public boolean rtpOnFirstJoin_Enabled;
|
||||
public String rtpOnFirstJoin_World;
|
||||
public boolean rtpOnFirstJoin_SetAsRespawn;
|
||||
public boolean statusMessages; //Send more information about rtp
|
||||
public int preloadRadius; //Amount of chunks to load around a safe rtp location (clamped (0 - 16))
|
||||
@Getter private boolean debug;
|
||||
@Getter private boolean delayEnabled;
|
||||
@Getter private int delayTime;
|
||||
@Getter private boolean rtpOnFirstJoin_Enabled;
|
||||
@Getter private String rtpOnFirstJoin_World;
|
||||
@Getter private boolean rtpOnFirstJoin_SetAsRespawn;
|
||||
@Getter private boolean statusMessages; //Send more information about rtp
|
||||
@Getter private int preloadRadius; //Amount of chunks to load around a safe rtp location (clamped (0 - 16))
|
||||
//Dependencies
|
||||
private final SoftDepends depends = new SoftDepends();
|
||||
public boolean protocolLibSounds;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package me.SuperRonanCraft.BetterRTP.references.settings;
|
||||
|
||||
import lombok.Getter;
|
||||
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -21,66 +22,18 @@ public class SoftDepends {
|
||||
private boolean respect_ultimateClaims = false;
|
||||
private boolean respect_pueblos = 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;
|
||||
private boolean kingdomsx = false;
|
||||
private boolean hClaims = false;
|
||||
private boolean griefDefender = false;
|
||||
private boolean ultimateClaims = false;
|
||||
private boolean pueblos = 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;
|
||||
}
|
||||
|
||||
public boolean isKingdomsX() {
|
||||
return kingdomsx;
|
||||
}
|
||||
|
||||
public boolean ishClaims() {
|
||||
return hClaims;
|
||||
}
|
||||
|
||||
public boolean isGriefDefender() {
|
||||
return griefDefender;
|
||||
}
|
||||
|
||||
public boolean isUltimateClaims() {
|
||||
return ultimateClaims;
|
||||
}
|
||||
|
||||
public boolean isPueblos() {
|
||||
return pueblos;
|
||||
}
|
||||
@Getter private boolean worldguard = false;
|
||||
@Getter private boolean griefprevention = false;
|
||||
@Getter private boolean towny = false;
|
||||
@Getter private boolean redProtect = false;
|
||||
@Getter private boolean factionsUUID = false;
|
||||
@Getter private boolean lands = false;
|
||||
@Getter private boolean residence = false;
|
||||
@Getter private boolean kingdomsx = false;
|
||||
@Getter private boolean hClaims = false;
|
||||
@Getter private boolean griefDefender = false;
|
||||
@Getter private boolean ultimateClaims = false;
|
||||
@Getter private boolean pueblos = false;
|
||||
|
||||
void load() {
|
||||
FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
|
||||
@ -184,7 +137,7 @@ public class SoftDepends {
|
||||
}
|
||||
|
||||
private void debug(String str) {
|
||||
if (BetterRTP.getInstance().getSettings().debug)
|
||||
if (BetterRTP.getInstance().getSettings().isDebug())
|
||||
BetterRTP.getInstance().getLogger().log(Level.INFO, str);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user