Fixed /f corner cannot claim spam, Fixed some issues with no blocks placeable near faction vault with certain circumstances, /f reload now reloads corners, Message for needing more power to claim missing space fixed.

This commit is contained in:
DroppingAnvil 2019-10-13 02:48:53 -05:00
parent c9eca60c18
commit b13afcb6a2
4 changed files with 25 additions and 12 deletions

View File

@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FactionsPlugin;
import com.massivecraft.factions.listeners.FactionsPlayerListener;
import com.massivecraft.factions.shop.ShopConfig;
import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.zcore.util.TL;
@ -30,6 +31,10 @@ public class CmdReload extends FCommand {
}
long timeReload = (System.currentTimeMillis() - timeInitStart);
if (!FactionsPlugin.getInstance().mc17) {
FactionsPlayerListener.loadCorners();
}
context.msg(TL.COMMAND_RELOAD_TIME, timeReload);
}

View File

@ -47,7 +47,7 @@ import java.util.logging.Level;
public class FactionsPlayerListener implements Listener {
HashMap<Player, Boolean> fallMap = new HashMap<>();
private Set<FLocation> corners;
public static Set<FLocation> corners;
// Holds the next time a player can have a map shown.
private HashMap<UUID, Long> showTimes = new HashMap<>();
// for handling people who repeatedly spam attempts to open a door (or similar) in another faction's territory
@ -58,16 +58,20 @@ public class FactionsPlayerListener implements Listener {
initPlayer(player);
}
if (!FactionsPlugin.getInstance().mc17) {
this.corners = new HashSet<>();
for (World world : FactionsPlugin.getInstance().getServer().getWorlds()) {
WorldBorder border = world.getWorldBorder();
if (border != null) {
int cornerCoord = (int) ((border.getSize() - 1.0) / 2.0);
this.corners.add(new FLocation(world.getName(), FLocation.blockToChunk(cornerCoord), FLocation.blockToChunk(cornerCoord)));
this.corners.add(new FLocation(world.getName(), FLocation.blockToChunk(cornerCoord), FLocation.blockToChunk(-cornerCoord)));
this.corners.add(new FLocation(world.getName(), FLocation.blockToChunk(-cornerCoord), FLocation.blockToChunk(cornerCoord)));
this.corners.add(new FLocation(world.getName(), FLocation.blockToChunk(-cornerCoord), FLocation.blockToChunk(-cornerCoord)));
}
loadCorners();
}
}
public static void loadCorners() {
FactionsPlayerListener.corners = new HashSet<>();
for (World world : FactionsPlugin.getInstance().getServer().getWorlds()) {
WorldBorder border = world.getWorldBorder();
if (border != null) {
int cornerCoord = (int) ((border.getSize() - 1.0) / 2.0);
FactionsPlayerListener.corners.add(new FLocation(world.getName(), FLocation.blockToChunk(cornerCoord), FLocation.blockToChunk(cornerCoord)));
FactionsPlayerListener.corners.add(new FLocation(world.getName(), FLocation.blockToChunk(cornerCoord), FLocation.blockToChunk(-cornerCoord)));
FactionsPlayerListener.corners.add(new FLocation(world.getName(), FLocation.blockToChunk(-cornerCoord), FLocation.blockToChunk(cornerCoord)));
FactionsPlayerListener.corners.add(new FLocation(world.getName(), FLocation.blockToChunk(-cornerCoord), FLocation.blockToChunk(-cornerCoord)));
}
}
}

View File

@ -28,6 +28,9 @@ public class CornerTask extends BukkitRunnable {
FLocation fLocation = surrounding.remove(0);
if (fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
++amount;
} else {
fPlayer.sendMessage(TL.COMMAND_CORNER_FAIL_WITH_FEEDBACK.toString().replace("&", "§") + amount);
cancel();
}
}
}

View File

@ -123,6 +123,7 @@ public enum TL {
COMMAND_CORNER_CANT_CLAIM("&c&l[!] &cYou may not claim this corner!"),
COMMAND_CORNER_CLAIMED("\n&2&l[!] &aYou have claimed the corner successfully, totalling in &b%1$d &achunks!\n"),
COMMAND_CORNER_ATTEMPTING_CLAIM("&c&l[!] &7Attempting to claim corner..."),
COMMAND_CORNER_FAIL_WITH_FEEDBACK("&c&l[!] &cOne or more claims in this corner could not be claimed! Total chunks claimed:&b "),
COMMAND_CORNER_NOT_CORNER("&c&l[!] &7You must be in a corner to use this command!"),
COMMAND_CORNER_DESCRIPTION("claim a corner at world border"),
COMMAND_CORNERLIST_DESCRIPTION("list of all corners"),
@ -967,7 +968,7 @@ public enum TL {
CLAIM_MEMBERS("Factions must have at least %s members to claim land."),
CLAIM_SAFEZONE("You can not claim a Safe Zone."),
CLAIM_WARZONE("You can not claim a War Zone."),
CLAIM_POWER("You can't claim more land!You need more power!"),
CLAIM_POWER("You can't claim more land! You need more power!"),
CLAIM_LIMIT("Limit reached. You can't claim more land!"),
CLAIM_ALLY("You can't claim the land of your allies."),
CLAIM_CONTIGIOUS("You can only claim additional land which is connected to your first claim or controlled by another faction!"),