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>
<artifactId>BetterRTP</artifactId>
<packaging>jar</packaging>
<version>3.0.0</version>
<version>3.0.1</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
@ -75,6 +75,12 @@
</build>
<repositories>
<!-- Github based Repos -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<!-- Spigot Repo -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@ -94,11 +100,6 @@
<id>sk89q-repo</id>
<url>https://maven.enginehub.org/repo/</url>
</repository>
<!-- Github based Repos -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<!-- ProjectRed Repo -->
<repository>
<id>redprotect-repo</id>
@ -217,5 +218,12 @@
<version>4.5.0</version>
<scope>provided</scope>
</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>
</project>

View File

@ -4,10 +4,12 @@ import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
import me.SuperRonanCraft.BetterRTP.BetterRTP;
import me.SuperRonanCraft.BetterRTP.references.worlds.*;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
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.Map;
@ -186,4 +188,25 @@ public class RTP {
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.ryanhamshire.GriefPrevention.GriefPrevention;
import org.bukkit.Location;
import org.kingdoms.constants.land.Land;
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_lands = getLands(loc);
boolean plugin_residence = getResidence(loc);
boolean plugin_kingdomsx = getKingdomsx(loc);
return plugin_worldguard
&& plugin_griefPrevention
&& plugin_towny
&& plugin_redProtect
&& plugin_factionsUUID
&& plugin_lands
&& plugin_residence;
&& plugin_residence
&& plugin_kingdomsx;
}
// TESTED (v2.12.3)
@ -137,6 +140,21 @@ public class RTPPluginValidation { //Safe locations depending on enabled depende
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() {
return BetterRTP.getInstance();
}

View File

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

View File

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

View File

@ -1,8 +1,18 @@
main: me.SuperRonanCraft.BetterRTP.BetterRTP
version: '3.0.0'
version: '3.0.1'
name: BetterRTP
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'
commands:

View File

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