Skip to content

Commit

Permalink
Lands integration, untested
Browse files Browse the repository at this point in the history
As with all the integrations for protection plugins I do not run, this hook is untested. Use at your own risk and try it before you push it live.
* Made language more consistent across PluginHook implementations
* Cleaned up ASkyBlockHook
  • Loading branch information
Jikoo committed Jul 4, 2018
1 parent f24dcd1 commit 42f1511
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 27 deletions.
10 changes: 9 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<groupId>com.github.jikoo</groupId>
<artifactId>regionerator</artifactId>
<name>Regionerator</name>
<version>1.5.2</version>
<version>1.5.3</version>

<dependencies>
<dependency>
Expand Down Expand Up @@ -53,6 +53,7 @@
<groupId>com.github.FabioZumbi12.RedProtect</groupId>
<artifactId>RedProtect-Spigot</artifactId>
<version>master-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.wasteofplastic</groupId>
Expand Down Expand Up @@ -111,6 +112,13 @@
<scope>system</scope>
<systemPath>${project.basedir}/premium/Residence.jar</systemPath>
</dependency>
<dependency>
<groupId>me.angeschossen</groupId>
<artifactId>Lands</artifactId>
<version>1.9.5</version>
<scope>system</scope>
<systemPath>${project.basedir}/premium/Lands.jar</systemPath>
</dependency>
</dependencies>

<repositories>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.bukkit.event.Listener;

/**
* PluginHook for the plugin <a href=https://www.spigotmc.org/resources/a-skyblock.1220/>ASkyBlock</a>.
* PluginHook for <a href=https://www.spigotmc.org/resources/a-skyblock.1220/>ASkyBlock</a>.
*
* @author Jikoo
*/
Expand All @@ -37,13 +37,16 @@ public boolean isReadyOnEnable() {
@Override
public void readyLater(Regionerator plugin) {

plugin.getServer().getPluginManager().registerEvents(new ASkyBlockReadyListener(plugin), plugin);
plugin.getServer().getPluginManager().registerEvents(new ASkyBlockReadyListener(plugin, this), plugin);
}

public class ASkyBlockReadyListener implements Listener {
private final Regionerator plugin;
private final ASkyBlockHook hook;

public ASkyBlockReadyListener(Regionerator plugin) {
ASkyBlockReadyListener(Regionerator plugin, ASkyBlockHook hook) {
this.plugin = plugin;
this.hook = hook;
}

@EventHandler
Expand All @@ -57,14 +60,12 @@ public void onASkyBlockReady(com.wasteofplastic.askyblock.events.ReadyEvent even
plugin.debug("ASkyBlock reports itself ready");
}

ASkyBlockHook pluginHook = new ASkyBlockHook();

if (!pluginHook.isHookUsable()) {
if (!hook.isHookUsable()) {
plugin.getLogger().severe("Hook for ASkyBlock failed usability check and could not be enabled!");
return;
}

plugin.addHook(pluginHook);
plugin.addHook(hook);

if (plugin.debug(DebugLevel.LOW)) {
plugin.debug("Enabled protection hook for ASkyBlock");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
import org.bukkit.World;

/**
* PluginHook for the plugins <a href=https://www.spigotmc.org/resources/factions.1900/>Factions</a> and
* PluginHook for <a href=https://www.spigotmc.org/resources/factions.1900/>Factions</a> and
* <a href=https://www.spigotmc.org/resources/factionsuuid.1035/>FactionsUUID</a>.
*
*
* @author Jikoo
*/
public class FactionsHook extends PluginHook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import us.forseth11.feudal.kingdoms.Land;

/**
* PluginHook for the plugin <a href=https://www.spigotmc.org/resources/feudal.22873/>Feudal</a>.
*
* PluginHook for <a href=https://www.spigotmc.org/resources/feudal.22873/>Feudal</a>.
*
* @author Jikoo
*/
public class FeudalHook extends PluginHook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import me.ryanhamshire.GriefPrevention.GriefPrevention;

/**
* PluginHook for the protection plugin <a href=http://dev.bukkit.org/bukkit-plugins/grief-prevention/>GriefPrevention</a>.
*
* PluginHook for <a href=http://dev.bukkit.org/bukkit-plugins/grief-prevention/>GriefPrevention</a>.
*
* @author Jikoo
*/
public class GriefPreventionHook extends PluginHook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.kingdoms.manager.game.GameManagement;

/**
* PluginHook for the plugin <a href=https://www.spigotmc.org/resources/kingdoms.11833/>Kingdoms</a>.
*
* PluginHook for <a href=https://www.spigotmc.org/resources/kingdoms.11833/>Kingdoms</a>.
*
* @author Jikoo
*/
public class KingdomsHook extends PluginHook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.bukkit.World;

/**
* PluginHook for the protection plugin <a href=http://dev.bukkit.org/bukkit-plugins/landlord/>Landlord</a>.
*
* PluginHook for <a href=http://dev.bukkit.org/bukkit-plugins/landlord/>Landlord</a>.
*
* @author Jikoo
*/
public class LandlordHook extends PluginHook {
Expand All @@ -19,7 +19,7 @@ public LandlordHook() {

@Override
public boolean isChunkProtected(World chunkWorld, int chunkX, int chunkZ) {
return OwnedLand.getLandFromDatabase(chunkX, chunkX, chunkWorld.getName()) != null;
return OwnedLand.getLandFromDatabase(chunkX, chunkZ, chunkWorld.getName()) != null;
}

}
23 changes: 23 additions & 0 deletions src/main/java/com/github/jikoo/regionerator/hooks/LandsHook.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.github.jikoo.regionerator.hooks;

import com.github.jikoo.regionerator.PluginHook;
import com.github.jikoo.regionerator.world.DummyChunk;
import me.angeschossen.lands.Lands;
import org.bukkit.World;

/**
* PluginHook for <a href=https://www.spigotmc.org/resources/lands.53313/>Lands</a>.
*
* @author Jikoo
*/
public class LandsHook extends PluginHook {

public LandsHook() {
super("Lands");
}

@Override
public boolean isChunkProtected(World chunkWorld, int chunkX, int chunkZ) {
return Lands.getLandsAPI().isLandChunk(new DummyChunk(chunkWorld, chunkX, chunkZ));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.bukkit.World;

/**
* PluginHook for the plugin <a href=https://github.com/marcelo-mason/PreciousStones/>PreciousStones</a>.
* PluginHook for <a href=https://github.com/marcelo-mason/PreciousStones/>PreciousStones</a>.
*
* @author Jikoo
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.bukkit.World;

/**
* PluginHook for the plugin <a href=https://www.spigotmc.org/resources/redprotect.15841/>RedProtect</a>.
* PluginHook for <a href=https://www.spigotmc.org/resources/redprotect.15841/>RedProtect</a>.
*
* @author Jikoo
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.bukkit.World;

/**
* PluginHook for the plugin <a href=https://www.spigotmc.org/resources/residence.11480/>Residence</a>.
*
* PluginHook for <a href=https://www.spigotmc.org/resources/residence.11480/>Residence</a>.
*
* @author Jikoo
*/
public class ResidenceHook extends PluginHook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.bukkit.World;

/**
* PluginHook for the protection plugin <a href=https://github.com/LlmDl/Towny>Towny</a>.
*
* PluginHook for <a href=https://github.com/LlmDl/Towny>Towny</a>.
*
* @author Jikoo
*/
public class TownyHook extends PluginHook {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.bukkit.World;

/**
* PluginHook for the protection plugin <a href=http://dev.bukkit.org/bukkit-plugins/worldguard/>WorldGuard</a>.
*
* PluginHook for <a href=http://dev.bukkit.org/bukkit-plugins/worldguard/>WorldGuard</a>.
*
* @author Jikoo
*/
public class WorldGuardHook extends PluginHook {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
# GriefPrevention: true
# Kingdoms: true
# Landlord: true
# Lands: true
# PreciousStones: true
# RedProtect: true
# Residence: true
Expand Down Expand Up @@ -112,6 +113,7 @@ hooks:
GriefPrevention: true
Kingdoms: true
Landlord: true
Lands: true
PreciousStones: true
RedProtect: true
Residence: true
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ softdepend:
- GriefPrevention
- Kingdoms
- Landlord
- Lands
- PreciousStones
- Multiverse-Core
- RedProtect
Expand Down

0 comments on commit 42f1511

Please sign in to comment.