mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-10-25 21:40:05 +00:00
Remove use of private dependencies (use reflection instead), (#137)
Add comments for people that want to use the private repo locally
This commit is contained in:
1 parent
ea8f998c83
commit
b6cfe1e1c4
3 files changed
+23
-16
No files matched your search
@@ -90,11 +90,12 @@
|
|||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<!-- CAN BE UNCOMMENTED IF YOU HAVE ACCESS TO THE REPO -->
|
||||||
|
<!--<repository>
|
||||||
<id>ronanplugins-private</id>
|
<id>ronanplugins-private</id>
|
||||||
<name>RonanPlugins Repository</name>
|
<name>RonanPlugins Repository</name>
|
||||||
<url>https://repo.ronanplugins.com/private</url>
|
<url>https://repo.ronanplugins.com/private</url>
|
||||||
</repository>
|
</repository>-->
|
||||||
<!-- GitHub based Repos -->
|
<!-- GitHub based Repos -->
|
||||||
<repository>
|
<repository>
|
||||||
<id>jitpack.io</id>
|
<id>jitpack.io</id>
|
||||||
@@ -343,22 +344,26 @@
|
|||||||
<version>0.2.3-legacy-support</version>
|
<version>0.2.3-legacy-support</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- CAN BE UNCOMMENTED IF YOU HAVE ACCESS TO THE PLUGIN -->
|
||||||
<!-- Private Repoed -->
|
<!-- Private Repoed -->
|
||||||
<!-- This is uploaded to our private repo on https://repo.ronanplugins.com -->
|
<!-- This is uploaded to our private repo on https://repo.ronanplugins.com -->
|
||||||
<!-- hClaims (https://www.spigotmc.org/resources/90540/) -->
|
<!-- hClaims (https://www.spigotmc.org/resources/90540/) -->
|
||||||
<dependency>
|
<!--<dependency>
|
||||||
<groupId>com.ronanplugins</groupId>
|
<groupId>com.ronanplugins</groupId>
|
||||||
<artifactId>hClaims</artifactId>
|
<artifactId>hClaims</artifactId>
|
||||||
<version>2.5.3</version>
|
<version>2.5.3</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
<optional>true</optional>
|
||||||
|
</dependency>-->
|
||||||
|
<!-- CAN BE UNCOMMENTED IF YOU HAVE ACCESS TO THE PLUGIN -->
|
||||||
<!-- Private Repoed -->
|
<!-- Private Repoed -->
|
||||||
<!-- This is uploaded to our private repo on https://repo.ronanplugins.com -->
|
<!-- This is uploaded to our private repo on https://repo.ronanplugins.com -->
|
||||||
<dependency>
|
<!--<dependency>
|
||||||
<groupId>com.ronanplugins</groupId>
|
<groupId>com.ronanplugins</groupId>
|
||||||
<artifactId>Residence</artifactId>
|
<artifactId>Residence</artifactId>
|
||||||
<version>4.9.1.9</version>
|
<version>4.9.1.9</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
<optional>true</optional>
|
||||||
|
</dependency>-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
+7
-8
@@ -1,12 +1,5 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
import com.bekvon.bukkit.residence.Residence;
|
|
||||||
import com.griefdefender.api.GriefDefender;
|
|
||||||
import com.griefdefender.api.claim.Claim;
|
|
||||||
import com.songoda.ultimateclaims.UltimateClaims;
|
|
||||||
import me.RonanCraft.Pueblos.Pueblos;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.references.settings.SoftDepends;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
public class RTP_Residence implements RegionPluginCheck {
|
public class RTP_Residence implements RegionPluginCheck {
|
||||||
@@ -18,7 +11,13 @@ public class RTP_Residence implements RegionPluginCheck {
|
|||||||
boolean result = true;
|
boolean result = true;
|
||||||
if (REGIONPLUGINS.RESIDENCE.isEnabled())
|
if (REGIONPLUGINS.RESIDENCE.isEnabled())
|
||||||
try {
|
try {
|
||||||
result = Residence.getInstance().getResidenceManager().getByLoc(loc) == null;
|
// Using reflection
|
||||||
|
Class<?> residenceClass = Class.forName("com.bekvon.bukkit.residence.Residence");
|
||||||
|
Object residence = residenceClass.getMethod("getInstance").invoke(null);
|
||||||
|
Object residenceManager = residenceClass.getMethod("getResidenceManager").invoke(residence);
|
||||||
|
Class<?> residenceManagerClass = residenceManager.getClass();
|
||||||
|
Object claim = residenceManagerClass.getMethod("getByLoc", Location.class).invoke(residenceManager, loc);
|
||||||
|
result = claim == null;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-2
@@ -1,8 +1,9 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
package me.SuperRonanCraft.BetterRTP.references.depends.regionPlugins;
|
||||||
|
|
||||||
import com.hakan.claim.api.ClaimHandler;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class RTP_hClaims implements RegionPluginCheck {
|
public class RTP_hClaims implements RegionPluginCheck {
|
||||||
|
|
||||||
// NOT TESTED (3.1.0)
|
// NOT TESTED (3.1.0)
|
||||||
@@ -12,7 +13,9 @@ public class RTP_hClaims implements RegionPluginCheck {
|
|||||||
boolean result = true;
|
boolean result = true;
|
||||||
if (REGIONPLUGINS.HCLAIMS.isEnabled())
|
if (REGIONPLUGINS.HCLAIMS.isEnabled())
|
||||||
try {
|
try {
|
||||||
result = ClaimHandler.has(loc);
|
Class<?> claimHandlerClass = Class.forName("com.hakan.claim.api.ClaimHandler");
|
||||||
|
Method hasMethod = claimHandlerClass.getDeclaredMethod("has", Location.class);
|
||||||
|
result = (boolean) hasMethod.invoke(null, loc);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user