So many improvements
This commit is contained in:
commit
40d6054275
@ -2,6 +2,7 @@ package com.massivecraft.factions.cmd;
|
|||||||
|
|
||||||
import com.massivecraft.factions.Conf;
|
import com.massivecraft.factions.Conf;
|
||||||
import com.massivecraft.factions.FactionsPlugin;
|
import com.massivecraft.factions.FactionsPlugin;
|
||||||
|
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
||||||
import com.massivecraft.factions.shop.ShopConfig;
|
import com.massivecraft.factions.shop.ShopConfig;
|
||||||
import com.massivecraft.factions.struct.Permission;
|
import com.massivecraft.factions.struct.Permission;
|
||||||
import com.massivecraft.factions.zcore.util.TL;
|
import com.massivecraft.factions.zcore.util.TL;
|
||||||
@ -28,6 +29,11 @@ public class CmdReload extends FCommand {
|
|||||||
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
if (FactionsPlugin.getInstance().getConfig().getBoolean("enable-faction-flight")) {
|
||||||
FactionsPlugin.getInstance().factionsFlight = true;
|
FactionsPlugin.getInstance().factionsFlight = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
|
FactionsPlayerListener.loadCorners();
|
||||||
|
}
|
||||||
|
|
||||||
long timeReload = (System.currentTimeMillis() - timeInitStart);
|
long timeReload = (System.currentTimeMillis() - timeInitStart);
|
||||||
|
|
||||||
context.msg(TL.COMMAND_RELOAD_TIME, timeReload);
|
context.msg(TL.COMMAND_RELOAD_TIME, timeReload);
|
||||||
|
@ -47,7 +47,7 @@ import java.util.logging.Level;
|
|||||||
public class FactionsPlayerListener implements Listener {
|
public class FactionsPlayerListener implements Listener {
|
||||||
|
|
||||||
HashMap<Player, Boolean> fallMap = new HashMap<>();
|
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.
|
// Holds the next time a player can have a map shown.
|
||||||
private HashMap<UUID, Long> showTimes = new HashMap<>();
|
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
|
// 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);
|
initPlayer(player);
|
||||||
}
|
}
|
||||||
if (!FactionsPlugin.getInstance().mc17) {
|
if (!FactionsPlugin.getInstance().mc17) {
|
||||||
this.corners = new HashSet<>();
|
loadCorners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void loadCorners() {
|
||||||
|
FactionsPlayerListener.corners = new HashSet<>();
|
||||||
for (World world : FactionsPlugin.getInstance().getServer().getWorlds()) {
|
for (World world : FactionsPlugin.getInstance().getServer().getWorlds()) {
|
||||||
WorldBorder border = world.getWorldBorder();
|
WorldBorder border = world.getWorldBorder();
|
||||||
if (border != null) {
|
if (border != null) {
|
||||||
int cornerCoord = (int) ((border.getSize() - 1.0) / 2.0);
|
int cornerCoord = (int) ((border.getSize() - 1.0) / 2.0);
|
||||||
this.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)));
|
||||||
this.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)));
|
||||||
this.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)));
|
||||||
this.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)));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,9 @@ public class CornerTask extends BukkitRunnable {
|
|||||||
FLocation fLocation = surrounding.remove(0);
|
FLocation fLocation = surrounding.remove(0);
|
||||||
if (fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
if (fPlayer.attemptClaim(fPlayer.getFaction(), fLocation, true)) {
|
||||||
++amount;
|
++amount;
|
||||||
|
} else {
|
||||||
|
fPlayer.sendMessage(TL.COMMAND_CORNER_FAIL_WITH_FEEDBACK.toString().replace("&", "§") + amount);
|
||||||
|
cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,7 @@ public enum TL {
|
|||||||
COMMAND_CORNER_CANT_CLAIM("&c&l[!] &cYou may not claim this corner!"),
|
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_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_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_NOT_CORNER("&c&l[!] &7You must be in a corner to use this command!"),
|
||||||
COMMAND_CORNER_DESCRIPTION("claim a corner at world border"),
|
COMMAND_CORNER_DESCRIPTION("claim a corner at world border"),
|
||||||
COMMAND_CORNERLIST_DESCRIPTION("list of all corners"),
|
COMMAND_CORNERLIST_DESCRIPTION("list of all corners"),
|
||||||
|
Loading…
Reference in New Issue
Block a user