mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-13 10:34:09 +01:00
fixes
This commit is contained in:
parent
7f4037e1ed
commit
4c8adcda68
@ -65,6 +65,7 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.intellectualcrafters.plot.commands.Auto;
|
||||
import com.intellectualcrafters.plot.commands.Buy;
|
||||
import com.intellectualcrafters.plot.commands.MainCommand;
|
||||
import com.intellectualcrafters.plot.commands.WE_Anywhere;
|
||||
@ -519,6 +520,17 @@ public class PlotMain extends JavaPlugin implements Listener {
|
||||
}
|
||||
}
|
||||
plots.get(world).remove(id);
|
||||
|
||||
if (PlotHelper.lastPlot.containsKey(world)) {
|
||||
PlotId last = PlotHelper.lastPlot.get(world);
|
||||
int last_max = Math.max(last.x, last.y);
|
||||
int this_max = Math.max(id.x, id.y);
|
||||
|
||||
if (this_max < last_max) {
|
||||
PlotHelper.lastPlot.put(world, id);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,9 @@ public class Claim extends SubCommand {
|
||||
}
|
||||
|
||||
public static boolean claimPlot(final Player player, final Plot plot, final boolean teleport, final String schematic, final boolean auto) {
|
||||
if (plot.hasOwner() || plot.settings.isMerged()) {
|
||||
return false;
|
||||
}
|
||||
final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
|
@ -47,11 +47,10 @@ public class Inbox extends SubCommand {
|
||||
public boolean execute(final Player plr, final String... args) {
|
||||
boolean report = false;
|
||||
if (args.length == 1){
|
||||
if (args[1].equalsIgnoreCase("reports")) {
|
||||
if (args[0].equalsIgnoreCase("reports")) {
|
||||
report = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!PlayerFunctions.isInPlot(plr) && !report) {
|
||||
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
@ -126,8 +125,9 @@ public class Inbox extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.inbox.admin");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PlayerFunctions.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[]{"admin", "owner", "helper", "trusted", "everyone"}, tier, 4));
|
||||
PlayerFunctions.sendMessage(plr, C.INVALID_INBOX, Arrays.copyOfRange(new String[]{"admin", "owner", "helper", "trusted", "everyone"}, Math.max(0, tier), 4));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -45,9 +45,11 @@ import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.PlotHelper;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
|
||||
/**
|
||||
* @author Citymonstret
|
||||
@ -186,8 +188,7 @@ public class Set extends SubCommand {
|
||||
//set to current location
|
||||
World world = plr.getWorld();
|
||||
Location base = PlotHelper.getPlotBottomLoc(world, plot.id);
|
||||
int y = PlotHelper.getHeighestBlock(world, base.getBlockX(), base.getBlockZ());
|
||||
base.setY(y);
|
||||
base.setY(0);
|
||||
Location relative = plr.getLocation().subtract(base);
|
||||
BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
||||
plot.settings.setPosition(blockloc);
|
||||
@ -210,7 +211,7 @@ public class Set extends SubCommand {
|
||||
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||
return false;
|
||||
}
|
||||
if (Bukkit.getOfflinePlayer(alias).hasPlayedBefore()) {
|
||||
if (UUIDHandler.nameExists(new StringWrapper(alias))) {
|
||||
PlayerFunctions.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||
return false;
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class Settings {
|
||||
/**
|
||||
* Days until a plot gets cleared
|
||||
*/
|
||||
public static int AUTO_CLEAR_DAYS = -1;
|
||||
public static int AUTO_CLEAR_DAYS = 360;
|
||||
|
||||
public static int MIN_BLOCKS_CHANGED = -1;
|
||||
|
||||
|
@ -27,6 +27,7 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
@ -68,6 +69,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.world.ChunkLoadEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
|
||||
@ -100,6 +102,20 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
PlotMain.loadWorld(event.getWorld());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public static void onChunkLoad(final ChunkLoadEvent event) {
|
||||
String worldname = event.getWorld().getName();
|
||||
Chunk chunk = event.getChunk();
|
||||
if (PlotHelper.worldBorder.containsKey(worldname)) {
|
||||
int border = PlotHelper.getBorder(worldname);
|
||||
int x = Math.abs(chunk.getX() << 4);
|
||||
int z = Math.abs(chunk.getZ() << 4);
|
||||
if (x > border || z > border) {
|
||||
chunk.unload(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public static void onJoin(final PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
|
@ -192,7 +192,7 @@ public class WorldEditListener implements Listener {
|
||||
}
|
||||
final Location f = e.getFrom();
|
||||
final Player p = e.getPlayer();
|
||||
if (PlotMain.hasPermission(p, "plots.worldedit.bypass")) {
|
||||
if (PlotMain.hasPermission(p, "plots.worldedit.bypass") && !PWE.hasMask(p)) {
|
||||
return;
|
||||
}
|
||||
if ((f.getBlockX() != t.getBlockX()) || (f.getBlockZ() != t.getBlockZ())) {
|
||||
|
@ -98,7 +98,6 @@ public class ExpireManager {
|
||||
PlotMain.removePlot(world, plot.id, true);
|
||||
expiredPlots.get(world).remove(0);
|
||||
PlotMain.sendConsoleSenderMessage("&cDeleted expired plot: " + plot.id);
|
||||
String owner;
|
||||
PlotMain.sendConsoleSenderMessage("&3 - World: "+plot.world);
|
||||
if (plot.hasOwner()) {
|
||||
PlotMain.sendConsoleSenderMessage("&3 - Owner: "+UUIDHandler.getName(plot.owner));
|
||||
@ -147,8 +146,6 @@ public class ExpireManager {
|
||||
}
|
||||
OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid);
|
||||
if (op==null || !op.hasPlayedBefore()) {
|
||||
toRemove.add(plot);
|
||||
PlotMain.removePlot(plot.world, plot.id, true);
|
||||
continue;
|
||||
}
|
||||
long last = op.getLastPlayed();
|
||||
|
@ -946,16 +946,17 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
Plot plot = getPlot(w, plotid);
|
||||
BlockLoc home = plot.settings.getPosition();
|
||||
final Location bot = getPlotBottomLoc(w, plotid);
|
||||
PlotManager manager = PlotMain.getPlotManager(w);
|
||||
if (home == null || (home.x == 0 && home.z == 0)) {
|
||||
final Location top = getPlotTopLoc(w, plotid);
|
||||
final int x = top.getBlockX() - bot.getBlockX();
|
||||
final int z = top.getBlockZ() - bot.getBlockZ();
|
||||
final int y = getHeighestBlock(w, x, z);
|
||||
final int y = Math.max(getHeighestBlock(w, x, z), manager.getSignLoc(w, PlotMain.getWorldSettings(w), plot).getBlockY());
|
||||
return new Location(w, bot.getBlockX() + (x / 2), y, bot.getBlockZ() + (z / 2));
|
||||
}
|
||||
else {
|
||||
final int y = getHeighestBlock(w, home.x, home.z);
|
||||
return bot.add(home.x, home.y + y, home.z);
|
||||
final int y = Math.max(getHeighestBlock(w, home.x, home.z), home.y);
|
||||
return bot.add(home.x, y, home.z);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user