Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
v3 release: Towny support (UNTESTED)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahkok committed Dec 2, 2013
1 parent 86fe6f9 commit 06b4a5e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Sedimentology
main: org.foo_projects.sofar.Sedimentology.Sedimentology
version: 3
softdepend: [Factions]
softdepend: [Factions, Towny]
commands:
sedimentology:
aliases: sed
description: Display help for the sedimentology plugin
usage: /sedimentology ...
permission: sedimentology
permission-message: You do not have sufficient privileges to do that!
permission-message: You do not have sufficient privileges to do that!
22 changes: 21 additions & 1 deletion src/org/foo_projects/sofar/Sedimentology/Sedimentology.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.bukkit.event.Listener;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
Expand All @@ -31,6 +32,9 @@
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.mcore.ps.PS;

import com.palmergames.bukkit.towny.Towny;
import com.palmergames.bukkit.towny.object.TownyUniverse;

/*
* Sedimentology concepts
*
Expand Down Expand Up @@ -72,6 +76,9 @@ public final class Sedimentology extends JavaPlugin {
private int x, y, z;
private long conf_blocks = 10;
private boolean have_factions = false;
private boolean have_towny = false;

private Object towny_universe = null;

public static final List<String> defaultWorldList = Collections.unmodifiableList(Arrays.asList("world"));

Expand Down Expand Up @@ -150,6 +157,11 @@ private boolean isProtected(World world, int xx, int yy, int zz) {
if (!faction.isNone())
return true;
}
if (have_towny) {
if (((TownyUniverse)towny_universe).getTownBlock(new Location(world, xx, yy, zz)) != null)
return true;
}

return false;
}

Expand Down Expand Up @@ -861,7 +873,15 @@ public void onEnable() {
if (org.bukkit.Bukkit.getPluginManager().isPluginEnabled("Factions"))
have_factions = true;
getLogger().info("Factions support is " + (have_factions ? "enabled" : "disabled"));

if (org.bukkit.Bukkit.getPluginManager().isPluginEnabled("Towny")) {
Plugin p = org.bukkit.Bukkit.getPluginManager().getPlugin("Towny");
if (p != null) {
towny_universe = ((Towny)(p)).getTownyUniverse();
have_towny = true;
}
}
getLogger().info("Towny support is " + (have_towny ? "enabled" : "disabled"));

/* even handler takes care of updating it from there */
getServer().getPluginManager().registerEvents(new SedimentologyListener(), this);

Expand Down

0 comments on commit 06b4a5e

Please sign in to comment.