Radius Claiming & Alt Limit Fix
This commit is contained in:
parent
e0d2e6b4db
commit
499d41dea0
@ -103,6 +103,9 @@ public class Conf {
|
|||||||
public static boolean worldGuardChecking = false;
|
public static boolean worldGuardChecking = false;
|
||||||
public static boolean worldGuardBuildPriority = false;
|
public static boolean worldGuardBuildPriority = false;
|
||||||
|
|
||||||
|
//RADIUS CLAIMING
|
||||||
|
public static boolean useRadiusClaimSystem = true;
|
||||||
|
|
||||||
//FRIENDLY FIRE
|
//FRIENDLY FIRE
|
||||||
public static boolean friendlyFireFPlayersCommand = false;
|
public static boolean friendlyFireFPlayersCommand = false;
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// Our single plugin instance.
|
// Our single plugin instance.
|
||||||
// Single 4 life.
|
// Single 4 life.
|
||||||
public static FactionsPlugin instance;
|
public static FactionsPlugin instance;
|
||||||
|
public static boolean cachedRadiusClaim;
|
||||||
public static Permission perms = null;
|
public static Permission perms = null;
|
||||||
// This plugin sets the boolean true when fully enabled.
|
// This plugin sets the boolean true when fully enabled.
|
||||||
// Plugins can check this boolean while hooking in have
|
// Plugins can check this boolean while hooking in have
|
||||||
@ -248,6 +249,8 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
// start up task which runs the autoLeaveAfterDaysOfInactivity routine
|
// start up task which runs the autoLeaveAfterDaysOfInactivity routine
|
||||||
startAutoLeaveTask(false);
|
startAutoLeaveTask(false);
|
||||||
|
|
||||||
|
cachedRadiusClaim = Conf.useRadiusClaimSystem;
|
||||||
|
|
||||||
if (version > 8) {
|
if (version > 8) {
|
||||||
useNonPacketParticles = true;
|
useNonPacketParticles = true;
|
||||||
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
log("Minecraft Version 1.9 or higher found, using non packet based particle API");
|
||||||
@ -452,7 +455,7 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
// only save data if plugin actually completely loaded successfully
|
super.onDisable();
|
||||||
if (this.loadSuccessful) {
|
if (this.loadSuccessful) {
|
||||||
Conf.load();
|
Conf.load();
|
||||||
Conf.saveSync();
|
Conf.saveSync();
|
||||||
@ -476,7 +479,6 @@ public class FactionsPlugin extends MPlugin {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getServer().getScheduler().cancelTasks(this);
|
|
||||||
super.onDisable();
|
super.onDisable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class CmdJoin extends FCommand {
|
|||||||
|
|
||||||
int altLimit = Conf.factionAltMemberLimit;
|
int altLimit = Conf.factionAltMemberLimit;
|
||||||
|
|
||||||
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && !faction.altInvited(context.fPlayer)) {
|
if (altLimit > 0 && faction.getAltPlayers().size() >= altLimit && faction.altInvited(context.fPlayer)) {
|
||||||
context.msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(context.fPlayer), altLimit, fplayer.describeTo(context.fPlayer, false));
|
context.msg(TL.COMMAND_JOIN_ATLIMIT, faction.getTag(context.fPlayer), altLimit, fplayer.describeTo(context.fPlayer, false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd.claim;
|
package com.massivecraft.factions.cmd.claim;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.Board;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.Faction;
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
@ -62,10 +63,14 @@ public class CmdAutoClaim extends FCommand {
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||||
context.fPlayer.setAutoClaimFor(forFaction);
|
context.fPlayer.setAutoClaimFor(forFaction);
|
||||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", new FLocation(context.fPlayer.getPlayer().getLocation()).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", new FLocation(context.fPlayer.getPlayer().getLocation()).formatXAndZ(","));
|
||||||
context.msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(context.fPlayer));
|
context.msg(TL.COMMAND_AUTOCLAIM_ENABLED, forFaction.describeTo(context.fPlayer));
|
||||||
|
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), true)) {
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_CLAIMED, context.fPlayer.describeTo(f, true), context.fPlayer.getFaction().describeTo(f), at.describeTo(f)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
context.fPlayer.attemptClaim(forFaction, context.fPlayer.getPlayer().getLocation(), true);
|
context.fPlayer.attemptClaim(forFaction, context.fPlayer.getPlayer().getLocation(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd.claim;
|
package com.massivecraft.factions.cmd.claim;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import com.massivecraft.factions.cmd.Aliases;
|
import com.massivecraft.factions.cmd.Aliases;
|
||||||
import com.massivecraft.factions.cmd.CommandContext;
|
import com.massivecraft.factions.cmd.CommandContext;
|
||||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||||
@ -59,8 +56,14 @@ public class CmdClaim extends FCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||||
|
|
||||||
if (radius < 2) {
|
if (radius < 2) {
|
||||||
// single chunk
|
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), true)) {
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_CLAIMED, context.fPlayer.describeTo(f, true), context.fPlayer.getFaction().describeTo(f), at.describeTo(f)));
|
||||||
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||||
|
return;
|
||||||
|
}
|
||||||
context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), true);
|
context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), true);
|
||||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||||
} else {
|
} else {
|
||||||
@ -68,16 +71,17 @@ public class CmdClaim extends FCommand {
|
|||||||
if (!Permission.CLAIM_RADIUS.has(context.sender, true)) {
|
if (!Permission.CLAIM_RADIUS.has(context.sender, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new SpiralTask(new FLocation(context.player), radius) {
|
new SpiralTask(new FLocation(context.player), radius) {
|
||||||
private final int limit = Conf.radiusClaimFailureLimit - 1;
|
private final int limit = Conf.radiusClaimFailureLimit - 1;
|
||||||
private int failCount = 0;
|
private int failCount = 0;
|
||||||
|
private int successfulClaims = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean work() {
|
public boolean work() {
|
||||||
boolean success = context.fPlayer.attemptClaim(forFaction, this.currentLocation(), true);
|
boolean success = context.fPlayer.attemptClaim(forFaction, this.currentLocation(), true);
|
||||||
if (success) {
|
if (success) {
|
||||||
failCount = 0;
|
failCount = 0;
|
||||||
|
successfulClaims++;
|
||||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||||
} else if (failCount++ >= limit) {
|
} else if (failCount++ >= limit) {
|
||||||
this.stop();
|
this.stop();
|
||||||
@ -85,6 +89,15 @@ public class CmdClaim extends FCommand {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void finish() {
|
||||||
|
if (FactionsPlugin.cachedRadiusClaim) {
|
||||||
|
if (successfulClaims > 0) {
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_RADIUS_CLAIM, context.fPlayer.describeTo(f, true), String.valueOf(successfulClaims), context.fPlayer.getPlayer().getLocation().getChunk().getX(), context.fPlayer.getPlayer().getLocation().getChunk().getZ()));
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd.claim;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.Board;
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
|
import com.massivecraft.factions.Faction;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.cmd.Aliases;
|
import com.massivecraft.factions.cmd.Aliases;
|
||||||
import com.massivecraft.factions.cmd.CommandContext;
|
import com.massivecraft.factions.cmd.CommandContext;
|
||||||
@ -39,6 +40,15 @@ public class CmdClaimAt extends FCommand {
|
|||||||
int x = context.argAsInt(1);
|
int x = context.argAsInt(1);
|
||||||
int z = context.argAsInt(2);
|
int z = context.argAsInt(2);
|
||||||
FLocation location = new FLocation(context.argAsString(0), x, z);
|
FLocation location = new FLocation(context.argAsString(0), x, z);
|
||||||
|
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||||
|
|
||||||
|
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(context.fPlayer.getFaction(), context.player.getLocation(), true)) {
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_CLAIMED, context.fPlayer.describeTo(f, true), context.fPlayer.getFaction().describeTo(f), at.describeTo(f)));
|
||||||
|
FactionsPlugin.instance.logFactionEvent(context.fPlayer.getFaction(), FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (new FLocation(context.fPlayer.getPlayer().getLocation())).formatXAndZ(","));
|
||||||
|
showMap(context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
context.fPlayer.attemptClaim(context.faction, location, true);
|
context.fPlayer.attemptClaim(context.faction, location, true);
|
||||||
FactionsPlugin.instance.logFactionEvent(context.fPlayer.getFaction(), FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (location).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(context.fPlayer.getFaction(), FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", "1", (location).formatXAndZ(","));
|
||||||
showMap(context);
|
showMap(context);
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package com.massivecraft.factions.cmd.claim;
|
package com.massivecraft.factions.cmd.claim;
|
||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.FLocation;
|
|
||||||
import com.massivecraft.factions.Faction;
|
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
|
||||||
import com.massivecraft.factions.cmd.Aliases;
|
import com.massivecraft.factions.cmd.Aliases;
|
||||||
import com.massivecraft.factions.cmd.CommandContext;
|
import com.massivecraft.factions.cmd.CommandContext;
|
||||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||||
@ -71,6 +68,7 @@ public class CmdClaimLine extends FCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Faction forFaction = context.argAsFaction(2, context.faction);
|
final Faction forFaction = context.argAsFaction(2, context.faction);
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(context.fPlayer.getPlayer().getLocation()));
|
||||||
|
|
||||||
if (forFaction != context.fPlayer.getFaction()) {
|
if (forFaction != context.fPlayer.getFaction()) {
|
||||||
if (!context.fPlayer.isAdminBypassing()) {
|
if (!context.fPlayer.isAdminBypassing()) {
|
||||||
@ -84,11 +82,18 @@ public class CmdClaimLine extends FCommand {
|
|||||||
Location location = context.player.getLocation();
|
Location location = context.player.getLocation();
|
||||||
|
|
||||||
// TODO: make this a task like claiming a radius?
|
// TODO: make this a task like claiming a radius?
|
||||||
|
int claims = 0;
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
context.fPlayer.attemptClaim(forFaction, location, true);
|
if (FactionsPlugin.cachedRadiusClaim && context.fPlayer.attemptClaim(forFaction, context.player.getLocation(), true)) {
|
||||||
|
claims++;
|
||||||
|
} else {
|
||||||
|
context.fPlayer.attemptClaim(forFaction, location, true);
|
||||||
|
}
|
||||||
location = location.add(blockFace.getModX() * 16, 0, blockFace.getModZ() * 16);
|
location = location.add(blockFace.getModX() * 16, 0, blockFace.getModZ() * 16);
|
||||||
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", String.valueOf(i), new FLocation(context.player.getLocation()).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(forFaction, FLogType.CHUNK_CLAIMS, context.fPlayer.getName(), CC.GreenB + "CLAIMED", String.valueOf(i), new FLocation(context.player.getLocation()).formatXAndZ(","));
|
||||||
}
|
}
|
||||||
|
int cachedClaims = claims;
|
||||||
|
context.fPlayer.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_RADIUS_CLAIM, context.fPlayer.describeTo(f, true), String.valueOf(cachedClaims), context.fPlayer.getPlayer().getLocation().getChunk().getX(), context.fPlayer.getPlayer().getLocation().getChunk().getZ()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -27,7 +27,6 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.block.*;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
||||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
@ -327,7 +327,6 @@ public class FactionsEntityListener implements Listener {
|
|||||||
|
|
||||||
public boolean isPlayerInSafeZone(Entity damagee) {
|
public boolean isPlayerInSafeZone(Entity damagee) {
|
||||||
if (!(damagee instanceof Player)) return false;
|
if (!(damagee instanceof Player)) return false;
|
||||||
|
|
||||||
return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone();
|
return Board.getInstance().getFactionAt(new FLocation(damagee.getLocation())).isSafeZone();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,12 +337,8 @@ public class FactionsEntityListener implements Listener {
|
|||||||
public boolean canDamagerHurtDamagee(EntityDamageByEntityEvent sub, boolean notify) {
|
public boolean canDamagerHurtDamagee(EntityDamageByEntityEvent sub, boolean notify) {
|
||||||
Entity damager = sub.getDamager();
|
Entity damager = sub.getDamager();
|
||||||
Entity damagee = sub.getEntity();
|
Entity damagee = sub.getEntity();
|
||||||
|
|
||||||
if (!(damagee instanceof Player)) return true;
|
if (!(damagee instanceof Player)) return true;
|
||||||
|
|
||||||
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
FPlayer defender = FPlayers.getInstance().getByPlayer((Player) damagee);
|
||||||
|
|
||||||
|
|
||||||
if (damager instanceof Player) {
|
if (damager instanceof Player) {
|
||||||
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
FPlayer attacker = FPlayers.getInstance().getByPlayer((Player) damager);
|
||||||
if (defender == null || defender.getPlayer() == null) return true;
|
if (defender == null || defender.getPlayer() == null) return true;
|
||||||
@ -358,12 +353,8 @@ public class FactionsEntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Location defenderLoc = defender.getPlayer().getLocation();
|
Location defenderLoc = defender.getPlayer().getLocation();
|
||||||
Faction defLocFaction = Board.getInstance().getFactionAt(new FLocation(defenderLoc));
|
Faction defLocFaction = Board.getInstance().getFactionAt(new FLocation(defenderLoc));
|
||||||
|
|
||||||
|
|
||||||
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
|
// for damage caused by projectiles, getDamager() returns the projectile... what we need to know is the source
|
||||||
if (damager instanceof Projectile) {
|
if (damager instanceof Projectile) {
|
||||||
Projectile projectile = (Projectile) damager;
|
Projectile projectile = (Projectile) damager;
|
||||||
|
@ -730,9 +730,13 @@ public class FactionsPlayerListener implements Listener {
|
|||||||
CmdFly.startParticles();
|
CmdFly.startParticles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Faction at = Board.getInstance().getFactionAt(new FLocation(me.getPlayer().getLocation()));
|
||||||
if (me.getAutoClaimFor() != null) {
|
if (me.getAutoClaimFor() != null) {
|
||||||
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
|
if (FactionsPlugin.cachedRadiusClaim && me.attemptClaim(me.getFaction(), me.getPlayer().getLocation(), true)) {
|
||||||
|
me.getFaction().getFPlayersWhereOnline(true).forEach(f -> f.msg(TL.CLAIM_CLAIMED, me.describeTo(f, true), me.getFaction().describeTo(f), at.describeTo(f)));
|
||||||
|
} else {
|
||||||
|
me.attemptClaim(me.getAutoClaimFor(), newLocation, true);
|
||||||
|
}
|
||||||
FactionsPlugin.instance.logFactionEvent(me.getAutoClaimFor(), FLogType.CHUNK_CLAIMS, me.getName(), CC.GreenB + "CLAIMED", String.valueOf(1), (new FLocation(player.getLocation())).formatXAndZ(","));
|
FactionsPlugin.instance.logFactionEvent(me.getAutoClaimFor(), FLogType.CHUNK_CLAIMS, me.getName(), CC.GreenB + "CLAIMED", String.valueOf(1), (new FLocation(player.getLocation())).formatXAndZ(","));
|
||||||
if (Conf.disableFlightOnFactionClaimChange) CmdFly.disableFlight(me);
|
if (Conf.disableFlightOnFactionClaimChange) CmdFly.disableFlight(me);
|
||||||
} else if (me.isAutoSafeClaimEnabled()) {
|
} else if (me.isAutoSafeClaimEnabled()) {
|
||||||
|
@ -2,6 +2,7 @@ package com.massivecraft.factions.util;
|
|||||||
|
|
||||||
import com.massivecraft.factions.FLocation;
|
import com.massivecraft.factions.FLocation;
|
||||||
import com.massivecraft.factions.FPlayer;
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@ -26,7 +27,9 @@ public class CornerTask extends BukkitRunnable {
|
|||||||
cancel();
|
cancel();
|
||||||
} else {
|
} else {
|
||||||
FLocation fLocation = surrounding.remove(0);
|
FLocation fLocation = surrounding.remove(0);
|
||||||
if (fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
if (FactionsPlugin.cachedRadiusClaim && fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
||||||
|
++amount;
|
||||||
|
} else if (fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
||||||
++amount;
|
++amount;
|
||||||
} else {
|
} else {
|
||||||
fPlayer.sendMessage(TL.COMMAND_CORNER_FAIL_WITH_FEEDBACK.toString().replace("&", "§") + amount);
|
fPlayer.sendMessage(TL.COMMAND_CORNER_FAIL_WITH_FEEDBACK.toString().replace("&", "§") + amount);
|
||||||
|
@ -3,10 +3,7 @@ package com.massivecraft.factions.zcore;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.massivecraft.factions.Board;
|
import com.massivecraft.factions.*;
|
||||||
import com.massivecraft.factions.Conf;
|
|
||||||
import com.massivecraft.factions.FPlayers;
|
|
||||||
import com.massivecraft.factions.Factions;
|
|
||||||
import com.massivecraft.factions.zcore.persist.SaveTask;
|
import com.massivecraft.factions.zcore.persist.SaveTask;
|
||||||
import com.massivecraft.factions.zcore.util.PermUtil;
|
import com.massivecraft.factions.zcore.util.PermUtil;
|
||||||
import com.massivecraft.factions.zcore.util.Persist;
|
import com.massivecraft.factions.zcore.util.Persist;
|
||||||
@ -15,7 +12,6 @@ import com.massivecraft.factions.zcore.util.TextUtil;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.plugin.IllegalPluginAccessException;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@ -100,9 +96,7 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
long saveTicks = (long) (20 * 60 * Conf.saveToFileEveryXMinutes); // Approximately every 30 min by default
|
long saveTicks = (long) (20 * 60 * Conf.saveToFileEveryXMinutes); // Approximately every 30 min by default
|
||||||
saveTask = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(this), saveTicks, saveTicks);
|
saveTask = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new SaveTask(this), saveTicks, saveTicks);
|
||||||
}
|
}
|
||||||
|
|
||||||
loadLang();
|
loadLang();
|
||||||
|
|
||||||
loadSuccessful = true;
|
loadSuccessful = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -178,17 +172,18 @@ public abstract class MPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
if (saveTask != null) {
|
getServer().getScheduler().cancelTasks(this);
|
||||||
this.getServer().getScheduler().cancelTask(saveTask);
|
if (saveTask != null) {
|
||||||
saveTask = null;
|
this.getServer().getScheduler().cancelTask(saveTask);
|
||||||
}
|
saveTask = null;
|
||||||
// only save data if plugin actually loaded successfully
|
}
|
||||||
if (loadSuccessful) {
|
// only save data if plugin actually loaded successfully
|
||||||
Factions.getInstance().forceSave();
|
if (loadSuccessful) {
|
||||||
FPlayers.getInstance().forceSave();
|
Factions.getInstance().forceSave();
|
||||||
Board.getInstance().forceSave();
|
FPlayers.getInstance().forceSave();
|
||||||
}
|
Board.getInstance().forceSave();
|
||||||
log("Disabled");
|
}
|
||||||
|
log("Disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -1288,11 +1288,13 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
|
|
||||||
|
|
||||||
// announce success
|
// announce success
|
||||||
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
if(!FactionsPlugin.cachedRadiusClaim) {
|
||||||
informTheseFPlayers.add(this);
|
Set<FPlayer> informTheseFPlayers = new HashSet<>();
|
||||||
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
informTheseFPlayers.add(this);
|
||||||
for (FPlayer fp : informTheseFPlayers) {
|
informTheseFPlayers.addAll(forFaction.getFPlayersWhereOnline(true));
|
||||||
fp.msg(TL.CLAIM_CLAIMED, this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
|
for (FPlayer fp : informTheseFPlayers) {
|
||||||
|
fp.msg(TL.CLAIM_CLAIMED, this.describeTo(fp, true), forFaction.describeTo(fp), currentFaction.describeTo(fp));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Board.getInstance().setFactionAt(forFaction, flocation);
|
Board.getInstance().setFactionAt(forFaction, flocation);
|
||||||
|
@ -1067,6 +1067,7 @@ public enum TL {
|
|||||||
CLAIM_FORCLAIM("for claiming this land"),
|
CLAIM_FORCLAIM("for claiming this land"),
|
||||||
CLAIM_TOOVERCLAIM("to overclaim this land"),
|
CLAIM_TOOVERCLAIM("to overclaim this land"),
|
||||||
CLAIM_FOROVERCLAIM("for over claiming this land"),
|
CLAIM_FOROVERCLAIM("for over claiming this land"),
|
||||||
|
CLAIM_RADIUS_CLAIM("%1$s &eclaimed %2$s chunks &astarting from &e(X: %3$s, Z: %4$s)"),
|
||||||
CLAIM_CLAIMED("%s claimed land for %s from %s."),
|
CLAIM_CLAIMED("%s claimed land for %s from %s."),
|
||||||
CLAIM_CLAIMEDLOG("%s claimed land at (%s) for the faction: %s"),
|
CLAIM_CLAIMEDLOG("%s claimed land at (%s) for the faction: %s"),
|
||||||
CLAIM_OVERCLAIM_DISABLED("Over claiming is disabled on this server."),
|
CLAIM_OVERCLAIM_DISABLED("Over claiming is disabled on this server."),
|
||||||
|
Loading…
Reference in New Issue
Block a user