KingdomsX Support + Queue System start

This commit is contained in:
SuperRonanCraft 2020-11-23 11:31:18 -05:00
parent 3a357379bf
commit c03682b06d
7 changed files with 86 additions and 10 deletions

20
pom.xml
View File

@ -7,7 +7,7 @@
<groupId>me.SuperRonanCraft</groupId> <groupId>me.SuperRonanCraft</groupId>
<artifactId>BetterRTP</artifactId> <artifactId>BetterRTP</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>3.0.0</version> <version>3.0.1</version>
<properties> <properties>
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
@ -75,6 +75,12 @@
</build> </build>
<repositories> <repositories>
<!-- Github based Repos -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<!-- Spigot Repo -->
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@ -94,11 +100,6 @@
<id>sk89q-repo</id> <id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url> <url>https://maven.enginehub.org/repo/</url>
</repository> </repository>
<!-- Github based Repos -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<!-- ProjectRed Repo --> <!-- ProjectRed Repo -->
<repository> <repository>
<id>redprotect-repo</id> <id>redprotect-repo</id>
@ -217,5 +218,12 @@
<version>4.5.0</version> <version>4.5.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- KingdomsX v1.10.5.2 (https://www.spigotmc.org/resources/kingdomsx.77670/) -->
<dependency>
<groupId>com.github.cryptomorin</groupId>
<artifactId>kingdoms</artifactId>
<version>1.10.5.2</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -4,10 +4,12 @@ import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import me.SuperRonanCraft.BetterRTP.BetterRTP; import me.SuperRonanCraft.BetterRTP.BetterRTP;
import me.SuperRonanCraft.BetterRTP.references.worlds.*; import me.SuperRonanCraft.BetterRTP.references.worlds.*;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -186,4 +188,25 @@ public class RTP {
rtp.randomlyTeleport(sendi); rtp.randomlyTeleport(sendi);
} }
} }
private static class Queue {
private int queueAmount;
private final List<Location> locationList = new ArrayList<>();
Location getQueue() {
Location loc = null;
if (!locationList.isEmpty())
loc = locationList.get(0);
return loc;
}
void removeFromQueue(Location loc) {
locationList.remove(loc);
}
void startQueue() {
}
}
} }

View File

@ -15,6 +15,7 @@ import me.SuperRonanCraft.BetterRTP.BetterRTP;
import me.angeschossen.lands.api.integration.LandsIntegration; import me.angeschossen.lands.api.integration.LandsIntegration;
import me.ryanhamshire.GriefPrevention.GriefPrevention; import me.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Location; import org.bukkit.Location;
import org.kingdoms.constants.land.Land;
public class RTPPluginValidation { //Safe locations depending on enabled dependencies public class RTPPluginValidation { //Safe locations depending on enabled dependencies
@ -26,13 +27,15 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
boolean plugin_factionsUUID = getFactionsUUID(loc); boolean plugin_factionsUUID = getFactionsUUID(loc);
boolean plugin_lands = getLands(loc); boolean plugin_lands = getLands(loc);
boolean plugin_residence = getResidence(loc); boolean plugin_residence = getResidence(loc);
boolean plugin_kingdomsx = getKingdomsx(loc);
return plugin_worldguard return plugin_worldguard
&& plugin_griefPrevention && plugin_griefPrevention
&& plugin_towny && plugin_towny
&& plugin_redProtect && plugin_redProtect
&& plugin_factionsUUID && plugin_factionsUUID
&& plugin_lands && plugin_lands
&& plugin_residence; && plugin_residence
&& plugin_kingdomsx;
} }
// TESTED (v2.12.3) // TESTED (v2.12.3)
@ -137,6 +140,21 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
return result; return result;
} }
// NOT TESTED (2.14.3)
// KingdomsX (v1.10.5.2)
// https://www.spigotmc.org/resources/kingdomsx.77670/
private boolean getKingdomsx(Location loc) {
boolean result = true;
if (getPl().getSettings().getsDepends().isKingdomsX())
try {
Land land = Land.getLand(loc);
result = land == null || !land.isClaimed();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
private BetterRTP getPl() { private BetterRTP getPl() {
return BetterRTP.getInstance(); return BetterRTP.getInstance();
} }

View File

@ -15,6 +15,7 @@ public class SoftDepends {
private boolean respect_factionsUUID = false; private boolean respect_factionsUUID = false;
private boolean respect_lands = false; private boolean respect_lands = false;
private boolean respect_residence = false; private boolean respect_residence = false;
private boolean respect_kingdomsx = false;
//RETURNABLES //RETURNABLES
private boolean worldguard = false; private boolean worldguard = false;
private boolean griefprevention = false; private boolean griefprevention = false;
@ -23,6 +24,7 @@ public class SoftDepends {
private boolean factionsUUID = false; private boolean factionsUUID = false;
private boolean lands = false; private boolean lands = false;
private boolean residence = false; private boolean residence = false;
private boolean kingdomsx = false;
public boolean isWorldguard() { public boolean isWorldguard() {
return worldguard; return worldguard;
@ -52,6 +54,10 @@ public class SoftDepends {
return residence; return residence;
} }
public boolean isKingdomsX() {
return kingdomsx;
}
void load() { void load() {
FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG); FileBasics.FILETYPE config = BetterRTP.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG);
String pre = "Settings.Respect."; String pre = "Settings.Respect.";
@ -62,6 +68,7 @@ public class SoftDepends {
respect_factionsUUID = config.getBoolean( pre + "FactionsUUID"); respect_factionsUUID = config.getBoolean( pre + "FactionsUUID");
respect_lands = config.getBoolean( pre + "Lands"); respect_lands = config.getBoolean( pre + "Lands");
respect_residence = config.getBoolean( pre + "Residence"); respect_residence = config.getBoolean( pre + "Residence");
respect_kingdomsx = config.getBoolean( pre + "KingdomsX");
registerWorldguard(); registerWorldguard();
registerGriefPrevention(); registerGriefPrevention();
registerTowny(); registerTowny();
@ -69,6 +76,7 @@ public class SoftDepends {
registerFactionsUUID(); registerFactionsUUID();
registerLands(); registerLands();
registerResidence(); registerResidence();
registerKingdomsX();
} }
public void registerWorldguard() { public void registerWorldguard() {
@ -113,6 +121,12 @@ public class SoftDepends {
debug("Respecting `Residence` was " + (residence ? "SUCCESSFULLY" : "NOT") + " registered"); debug("Respecting `Residence` was " + (residence ? "SUCCESSFULLY" : "NOT") + " registered");
} }
public void registerKingdomsX() {
kingdomsx = respect_kingdomsx && Bukkit.getPluginManager().isPluginEnabled("Kingdoms");
if (respect_kingdomsx)
debug("Respecting `KingdomsX` was " + (kingdomsx ? "SUCCESSFULLY" : "NOT") + " registered");
}
private void debug(String str) { private void debug(String str) {
if (BetterRTP.getInstance().getSettings().debug) if (BetterRTP.getInstance().getSettings().debug)
BetterRTP.getInstance().getLogger().log(Level.INFO, str); BetterRTP.getInstance().getLogger().log(Level.INFO, str);

View File

@ -19,6 +19,8 @@ Settings:
Lands: false Lands: false
## Respect Residence areas (https://www.spigotmc.org/resources/residence.11480/) ## Respect Residence areas (https://www.spigotmc.org/resources/residence.11480/)
Residence: false Residence: false
## Respect KingdomsX areas (https://www.spigotmc.org/resources/kingdomsx.77670/)
KingdomsX: false
## Output to console some debugging info ## Output to console some debugging info
Debugger: false Debugger: false
## Amount of chunks to preload around a safe location ## Amount of chunks to preload around a safe location

View File

@ -1,8 +1,18 @@
main: me.SuperRonanCraft.BetterRTP.BetterRTP main: me.SuperRonanCraft.BetterRTP.BetterRTP
version: '3.0.0' version: '3.0.1'
name: BetterRTP name: BetterRTP
author: SuperRonanCraft author: SuperRonanCraft
softdepend: [Vault, WorldGuard, GriefPrevention, Towny, Factions, RedProtect, Lands, Residence, ProtocolLib] softdepend:
- Vault
- WorldGuard
- GriefPrevention
- Towny
- Factions
- RedProtect
- Lands
- Residence
- ProtocolLib
- Kingdoms
api-version: '1.13' api-version: '1.13'
commands: commands:

View File

@ -5,7 +5,8 @@ To-Do list for BetterRTP
Worlds with spaces: Worlds with spaces:
- Support for worlds with spaces in their names - Support for worlds with spaces in their names
Add kingdoms support: -----DONE-----
Add KingdomsX support:
Wiki: https://github.com/CryptoMorin/KingdomsX/wiki/API Wiki: https://github.com/CryptoMorin/KingdomsX/wiki/API
Plugin: https://www.spigotmc.org/resources/kingdomsx.77670/ Plugin: https://www.spigotmc.org/resources/kingdomsx.77670/