Skip to content

Commit 1f2bf2e

Browse files
Add simple clan support
1 parent 6bf52b2 commit 1f2bf2e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/me/crafter/mc/lockettepro/Dependency.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
import com.wasteofplastic.askyblock.Island;
2828

2929
import net.milkbowl.vault.permission.Permission;
30+
import net.sacredlabyrinth.phaed.simpleclans.Clan;
31+
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
32+
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
33+
import net.sacredlabyrinth.phaed.simpleclans.managers.ClanManager;
3034

3135
public class Dependency {
3236

@@ -39,6 +43,8 @@ public class Dependency {
3943
protected static Plugin askyblock = null;
4044
protected static Plugin plotsquared = null;
4145
protected static PlotAPI plotapi;
46+
protected static Plugin simpleclans = null;
47+
protected static ClanManager clanmanager = null;
4248

4349
public Dependency(Plugin plugin){
4450
// WorldGuard
@@ -67,6 +73,9 @@ public Dependency(Plugin plugin){
6773
if (plotsquared != null){
6874
plotapi = new PlotAPI();
6975
}
76+
// SimpleClans
77+
simpleclans = plugin.getServer().getPluginManager().getPlugin("SimpleClans");
78+
clanmanager = ((SimpleClans)simpleclans).getClanManager();
7079
}
7180

7281
@SuppressWarnings("deprecation")
@@ -137,6 +146,9 @@ public static boolean isProtectedFrom(Block block, Player player){
137146
}
138147
} catch (Exception e){}
139148
}
149+
if (simpleclans != null){
150+
// TODO or not todo
151+
}
140152
return false;
141153
}
142154

@@ -184,5 +196,18 @@ public static boolean isScoreboardTeamOf(String line, Player player){
184196
}
185197
return false;
186198
}
199+
200+
public static boolean isSimpleClanOf(String line, Player player){
201+
try {
202+
ClanPlayer clanplayer = clanmanager.getClanPlayer(player);
203+
if (clanplayer != null){
204+
Clan clan = clanplayer.getClan();
205+
if (clan != null){
206+
if (line.equals("[" + clan.getName() + "]")) return true;
207+
}
208+
}
209+
} catch (Exception e){}
210+
return false;
211+
}
187212

188213
}

src/me/crafter/mc/lockettepro/LocketteProAPI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ public static boolean isUserOnSign(Block block, Player player){ // Requires (isL
398398
if (Dependency.isTownyTownOrNationOf(lines[i], player)) return true;
399399
if (Dependency.isPermissionGroupOf(lines[i], player)) return true;
400400
if (Dependency.isScoreboardTeamOf(lines[i], player)) return true;
401+
if (Dependency.isSimpleClanOf(lines[i], player)) return true;
401402
}
402403

403404
return false;

0 commit comments

Comments
 (0)