Removed Home Checking.

This commit is contained in:
Driftay 2019-04-07 11:01:12 -04:00
parent e77582de8d
commit dfa012b7f8
3 changed files with 1 additions and 122 deletions

View File

@ -64,7 +64,7 @@ public class SavageFactions extends MPlugin {
// Persistence related // Persistence related
public static ArrayList<FPlayer> playersFlying = new ArrayList(); public static ArrayList<FPlayer> playersFlying = new ArrayList();
public Essentials ess;
public boolean PlaceholderApi; public boolean PlaceholderApi;
// Commands // Commands
public FCmdRoot cmdBase; public FCmdRoot cmdBase;
@ -248,8 +248,6 @@ public class SavageFactions extends MPlugin {
getCommand(this.refCommand).setExecutor(this); getCommand(this.refCommand).setExecutor(this);
getCommand(this.refCommand).setTabCompleter(this); getCommand(this.refCommand).setTabCompleter(this);
setupEssentials();
if (getDescription().getFullName().contains("BETA")) { if (getDescription().getFullName().contains("BETA")) {
divider(); divider();
System.out.println("You are using a BETA version of the plugin!"); System.out.println("You are using a BETA version of the plugin!");
@ -519,10 +517,6 @@ public class SavageFactions extends MPlugin {
return econ; return econ;
} }
private boolean setupEssentials() {
SavageFactions.plugin.ess = (Essentials) this.getServer().getPluginManager().getPlugin("Essentials");
return SavageFactions.plugin.ess == null;
}
@Override @Override
public boolean logPlayerCommands() { public boolean logPlayerCommands() {

View File

@ -484,98 +484,6 @@ public class FactionsPlayerListener implements Listener {
} }
} }
//For Blocking Homes and Blocking Teleportation To Homes
@EventHandler
public void onPlayerHomeCheck(PlayerTeleportEvent event) throws Exception {
if (event.getPlayer().hasMetadata("NPC")) {
return;
}
if (event.getPlayer().hasPermission("factions.homes.bypass")) {
return;
}
if (Bukkit.getPluginManager().getPlugin("Essentials") == null) {
return;
}
boolean isHome = false;
for (String str : SavageFactions.plugin.ess.getUser(event.getPlayer()).getHomes()) {
Location home = SavageFactions.plugin.ess.getUser(event.getPlayer()).getHome(str);
if (home.getBlockX() == event.getTo().getBlockX() && home.getBlockZ() == event.getTo().getBlockZ()) {
isHome = true;
}
}
if (!isHome) {
return;
}
Location loc = event.getTo();
FLocation floc = new FLocation(event.getTo());
Faction fac = Board.getInstance().getFactionAt(floc);
Player player = event.getPlayer();
FPlayer fplayer = FPlayers.getInstance().getByPlayer(player);
User user = SavageFactions.plugin.ess.getUser(event.getPlayer());
List<String> homes = user.getHomes();
if (fac.isWilderness() || fplayer.getFactionId().equals(fac.getId())) {
return;
}
//Warzone and SafeZone Home Initializers
if (fac.isWarZone() || fac.isSafeZone() && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-system-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-system-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
if (fplayer.getFaction().getRelationTo(fac) == Relation.ENEMY && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-enemy-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-enemy-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
if (fplayer.getFaction().getRelationTo(fac) == Relation.NEUTRAL && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-neutral-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-neutral-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
if (fplayer.getFaction().getRelationTo(fac) == Relation.ALLY && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-ally-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-ally-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
if (fplayer.getFaction().getRelationTo(fac) == Relation.TRUCE && SavageFactions.plugin.getConfig().getBoolean("deny-homes-in-truce-factions")) {
event.setCancelled(true);
fplayer.msg(TL.COMMAND_HOME_BLOCKED, fac.getTag());
if (SavageFactions.plugin.getConfig().getBoolean("remove-homes-in-truce-factions"))
for (String s : homes) {
if (user.getHome(s).getBlock().getLocation().getChunk().equals(loc.getChunk())) {
user.delHome(s);
}
}
}
}
//Colors a String
public String color(String s) {
return ChatColor.translateAlternateColorCodes('&', s);
}
private String convertTime(int time) { private String convertTime(int time) {
String result = String.valueOf(Math.round((System.currentTimeMillis() / 1000L - time) / 36.0D) / 100.0D); String result = String.valueOf(Math.round((System.currentTimeMillis() / 1000L - time) / 36.0D) / 100.0D);

View File

@ -694,29 +694,6 @@ fwarp-gui:
- -
############################################################
# +------------------------------------------------------+ #
# | Faction Homes Essentials | #
# +------------------------------------------------------+ #
############################################################
# Warzone/SafeZone
deny-homes-in-system-factions: false
remove-homes-in-system-factions: false
deny-homes-in-enemy-factions: false
remove-homes-in-enemy-factions: false
deny-homes-in-neutral-factions: false
remove-homes-in-neutral-factions: false
deny-homes-in-ally-factions: false
remove-homes-in-ally-factions: false
deny-homes-in-truce-factions: false
remove-homes-in-truce-factions: false
############################################################ ############################################################
# +------------------------------------------------------+ # # +------------------------------------------------------+ #
# | Faction Creation/Disband Broadcast | # # | Faction Creation/Disband Broadcast | #