SO MANY!!!! bug fixes

This commit is contained in:
boy0001 2014-10-08 16:07:35 +11:00
parent 30f1f829cb
commit 2a35ec963c
12 changed files with 113 additions and 94 deletions

View File

@ -33,12 +33,9 @@ public class PWE {
Plot plot = PlotMain.getPlots(l.getWorld()).get(id);
if (plot != null) {
boolean r;
r = (plot.getOwner() != null) && plot.getOwner().equals(p.getUniqueId());
r = (plot.getOwner() != null) && plot.getOwner().equals(p.getUniqueId()) || plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId());
if (!r) {
if ((plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
r = true;
} else if (p.hasPermission("plots.worldedit.bypass")) {
if (p.hasPermission("plots.worldedit.bypass")) {
removeMask(p, s);
return;
}

View File

@ -729,7 +729,7 @@ public class PlotMain extends JavaPlugin {
}
UUIDHandler.startFetch(this);
// UUIDHandler.startFetch(this);
}
/**

View File

@ -18,6 +18,7 @@ import static com.intellectualcrafters.plot.PlotWorld.TOP_BLOCK_DEFAULT;
import static com.intellectualcrafters.plot.PlotWorld.WALL_BLOCK_DEFAULT;
import static com.intellectualcrafters.plot.PlotWorld.WALL_FILLING_DEFAULT;
import static com.intellectualcrafters.plot.PlotWorld.WALL_HEIGHT_DEFAULT;
import static com.intellectualcrafters.plot.PlotWorld.MOB_SPAWNING_DEFAULT;
import java.io.IOException;
import java.util.Arrays;
@ -94,7 +95,7 @@ public class PlotSquaredGen extends ChunkGenerator {
YamlConfiguration config = PlotMain.config;
this.plotworld = new PlotWorld();
Map<String, Object> options = new HashMap<String, Object>();
options.put("worlds." + world + ".natural_mob_spawning", MOB_SPAWNING_DEFAULT);
options.put("worlds." + world + ".plot.auto_merge", AUTO_MERGE_DEFAULT);
options.put("worlds." + world + ".plot.height", PLOT_HEIGHT_DEFAULT);
options.put("worlds." + world + ".plot.size", PLOT_WIDTH_DEFAULT);
@ -137,6 +138,7 @@ public class PlotSquaredGen extends ChunkGenerator {
} catch (IOException e) {
PlotMain.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save");
}
this.plotworld.MOB_SPAWNING = config.getBoolean("worlds." + world + ".natural_mob_spawning");
this.plotworld.AUTO_MERGE = config.getBoolean("worlds." + world + ".plot.auto_merge");
this.plotworld.PLOT_HEIGHT = config.getInt("worlds." + world + ".plot.height");
this.plotworld.PLOT_WIDTH = config.getInt("worlds." + world + ".plot.size");
@ -210,7 +212,13 @@ public class PlotSquaredGen extends ChunkGenerator {
@Override
public List<BlockPopulator> getDefaultPopulators(World world) {
if (!this.plotworld.MOB_SPAWNING) {
world.setSpawnFlags(false, false);
world.setAmbientSpawnLimit(0);
world.setAnimalSpawnLimit(0);
world.setMonsterSpawnLimit(0);
world.setWaterAnimalSpawnLimit(0);
}
return Arrays.asList((BlockPopulator) new XPopulator(PlotMain.getWorldSettings(world)));
}

View File

@ -35,6 +35,8 @@ public class PlotWorld {
public boolean AUTO_MERGE;
public static boolean AUTO_MERGE_DEFAULT = false;
public boolean MOB_SPAWNING;
public static boolean MOB_SPAWNING_DEFAULT = false;
/**
* Road Height
*/

View File

@ -86,6 +86,10 @@ public enum Command {
*
*/
SET("set", "s"),
/**
*
*/
SETUP("setup"),
/**
*
*/

View File

@ -32,9 +32,9 @@ public class Denied extends SubCommand {
}
private boolean hasBeenOnServer(String name) {
Player plr = Bukkit.getPlayerExact(name);
Player plr = Bukkit.getPlayer(name);
if (plr == null) {
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
OfflinePlayer oplr = Bukkit.getPlayer(name);
if (oplr == null) {
return false;
} else {
@ -77,8 +77,8 @@ public class Denied extends SubCommand {
return true;
}
UUID uuid = null;
if ((Bukkit.getPlayerExact(args[1]) != null)) {
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
if ((Bukkit.getPlayer(args[1]) != null)) {
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
} else {
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
}
@ -115,8 +115,8 @@ public class Denied extends SubCommand {
return true;
}
UUID uuid = null;
if (Bukkit.getPlayerExact(args[1])!=null) {
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
if (Bukkit.getPlayer(args[1])!=null) {
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
} else {
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
}

View File

@ -29,7 +29,7 @@ public class Helpers extends SubCommand {
}
private boolean hasBeenOnServer(String name) {
Player plr = Bukkit.getPlayerExact(name);
Player plr = Bukkit.getPlayer(name);
if (plr == null) {
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
if (oplr == null) {
@ -74,8 +74,8 @@ public class Helpers extends SubCommand {
return true;
}
UUID uuid = null;
if ((Bukkit.getPlayerExact(args[1]) != null)) {
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
if ((Bukkit.getPlayer(args[1]) != null)) {
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
} else {
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
}
@ -105,8 +105,8 @@ public class Helpers extends SubCommand {
return true;
}
UUID uuid = null;
if (Bukkit.getPlayerExact(args[1]) != null) {
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
if (Bukkit.getPlayer(args[1]) != null) {
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
} else {
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
}

View File

@ -83,7 +83,7 @@ public class Info extends SubCommand {
String info = C.PLOT_INFO.s();
info = info.replaceAll("%alias%", plot.settings.getAlias().length() > 0 ? plot.settings.getAlias() : "none");
info = info.replaceAll("%id%", plot.id.x + ";" + plot.id.y);
info = info.replaceAll("%id%", plot.id.toString());
info = info.replaceAll("%biome%", getBiomeAt(plot).toString());
info = info.replaceAll("%owner%", owner);
info = info.replaceAll("%time%", plot.settings.getChangeTime() ? plot.settings.getTime() + "" : "default");

View File

@ -29,7 +29,7 @@ public class Trusted extends SubCommand {
}
private boolean hasBeenOnServer(String name) {
Player plr = Bukkit.getPlayerExact(name);
Player plr = Bukkit.getPlayer(name);
if (plr == null) {
OfflinePlayer oplr = Bukkit.getOfflinePlayer(name);
if (oplr == null) {
@ -74,8 +74,8 @@ public class Trusted extends SubCommand {
return true;
}
UUID uuid = null;
if ((Bukkit.getPlayerExact(args[1]) != null)) {
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
if ((Bukkit.getPlayer(args[1]) != null)) {
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
} else {
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
}
@ -105,8 +105,8 @@ public class Trusted extends SubCommand {
return true;
}
UUID uuid = null;
if (Bukkit.getPlayerExact(args[1]) != null) {
uuid = Bukkit.getPlayerExact(args[1]).getUniqueId();
if (Bukkit.getPlayer(args[1]) != null) {
uuid = Bukkit.getPlayer(args[1]).getUniqueId();
} else {
uuid = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
}

View File

@ -12,6 +12,7 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.World;
import com.google.common.base.Charsets;
import com.intellectualcrafters.plot.PlotHomePosition;
import com.intellectualcrafters.plot.PlotId;
import com.intellectualcrafters.plot.PlotMain;
@ -40,31 +41,7 @@ public class PlotMeConverter {
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Conversion has started");
PlotMain.sendConsoleSenderMessage("&3PlotMe&8->&3PlotSquared&8: &7Caching playerdata...");
ArrayList<com.intellectualcrafters.plot.Plot> createdPlots = new ArrayList<com.intellectualcrafters.plot.Plot>();
Map<String, UUID> uuidMap = new HashMap<String, UUID>();
boolean online = Bukkit.getServer().getOnlineMode();
if (!online) {
File playersFolder = new File("world" + File.separator + "playerdata");
String[] dat = playersFolder.list(new FilenameFilter() {
@Override
public boolean accept(File f, String s) {
return s.endsWith(".dat");
}
});
for (String current : dat) {
UUID uuid = null;
try {
uuid = UUID.fromString(current.replaceAll(".dat$", ""));
} catch (Exception e) {
}
if (uuid != null) {
String name = Bukkit.getOfflinePlayer(uuid).getName();
if (name != null) {
uuidMap.put(name, uuid);
}
}
}
}
for (World world : Bukkit.getWorlds()) {
HashMap<String, Plot> plots = PlotManager.getPlots(world);
if (plots != null) {
@ -115,7 +92,10 @@ public class PlotMeConverter {
for (String user : plot.getAllowed().split(",")) {
if (user.equals("*")) {
psAdded.add(DBFunc.everyone);
} else if (uuidMap.containsKey(user)) {
} else {
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + user).getBytes(Charsets.UTF_8));
psAdded.add(uuidMap.get(user));
}
}
@ -123,7 +103,7 @@ public class PlotMeConverter {
for (String user : plot.getDenied().split(",")) {
if (user.equals("*")) {
psDenied.add(DBFunc.everyone);
} else if (uuidMap.containsKey(user)) {
} else {
psDenied.add(uuidMap.get(user));
}
}

View File

@ -166,18 +166,7 @@ public class PlayerEvents implements Listener {
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void PlayerMove(PlayerMoveEvent event) {
try {
Player player = event.getPlayer();
Location from = event.getFrom();
Location to = event.getTo();
if ((from.getBlockX() != to.getBlockX()) || (from.getBlockZ() != to.getBlockZ())) {
if (!isPlotWorld(player.getWorld())) {
return;
}
if (enteredPlot(from,to)) {
Plot plot = getCurrentPlot(event.getTo());
public void plotEntry(Player player, Plot plot) {
if (plot.hasOwner()) {
if (C.TITLE_ENTERED_PLOT.s().length() > 2) {
String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceFirst("%s", plot.getDisplayName());
@ -194,13 +183,7 @@ public class PlayerEvents implements Listener {
PlayerEnterPlotEvent callEvent = new PlayerEnterPlotEvent(player, plot);
Bukkit.getPluginManager().callEvent(callEvent);
}
boolean admin = player.hasPermission("plots.admin");
PlayerFunctions.sendMessage(player, plot.settings.getJoinMessage());
if (plot.deny_entry(player) && !admin) {
event.setCancelled(true);
return;
}
if (plot.settings.getRain()) {
PlayerFunctions.togglePlotWeather(player, plot);
}
@ -208,16 +191,39 @@ public class PlayerEvents implements Listener {
PlayerFunctions.togglePlotTime(player, plot);
}
}
} else if (leftPlot(event.getFrom(), event.getTo())) {
Plot plot = getCurrentPlot(event.getFrom());
}
public void plotExit(Player player, Plot plot) {
{
PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
Bukkit.getPluginManager().callEvent(callEvent);
}
event.getPlayer().resetPlayerTime();
event.getPlayer().resetPlayerWeather();
player.resetPlayerTime();
player.resetPlayerWeather();
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void PlayerMove(PlayerMoveEvent event) {
try {
Player player = event.getPlayer();
Location from = event.getFrom();
Location to = event.getTo();
if ((from.getBlockX() != to.getBlockX()) || (from.getBlockZ() != to.getBlockZ())) {
if (!isPlotWorld(player.getWorld())) {
return;
}
if (enteredPlot(from,to)) {
Plot plot = getCurrentPlot(event.getTo());
boolean admin = player.hasPermission("plots.admin");
if (plot.deny_entry(player) && !admin) {
event.setCancelled(true);
return;
}
plotEntry(player, plot);
} else if (leftPlot(event.getFrom(), event.getTo())) {
Plot plot = getCurrentPlot(event.getFrom());
plotExit(player, plot);
}
}
} catch (Exception e) {
// Gotta catch 'em all.
@ -518,6 +524,9 @@ public class PlayerEvents implements Listener {
if (!isPlotWorld(world)) {
return;
}
if (event.getEntity() instanceof Player) {
return;
}
if (!isInPlot(event.getLocation())) {
event.setCancelled(true);
}
@ -557,6 +566,10 @@ public class PlayerEvents implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onTeleport(PlayerTeleportEvent event) {
Location f = event.getFrom();
Location t = event.getTo();
if (isPlotWorld(event.getTo())) {
if (isInPlot(event.getTo())) {
Plot plot = getCurrentPlot(event.getTo());
@ -564,6 +577,17 @@ public class PlayerEvents implements Listener {
PlayerFunctions.sendMessage(event.getPlayer(), C.YOU_BE_DENIED);
event.setCancelled(true);
}
else {
if (enteredPlot(f, t)) {
plotEntry(event.getPlayer(), plot);
}
}
}
else {
if (leftPlot(f, t)) {
Plot plot = getCurrentPlot(event.getTo());
plotExit(event.getPlayer(), plot);
}
}
if ((event.getTo().getBlockX() >= 29999999) || (event.getTo().getBlockX() <= -29999999) || (event.getTo().getBlockZ() >= 29999999) || (event.getTo().getBlockZ() <= -29999999)) {
event.setCancelled(true);

View File

@ -127,14 +127,18 @@ public class WorldEditListener implements Listener {
Player p = e.getPlayer();
Location t = e.getTo();
Location f = e.getFrom();
if (!isPlotWorld(t)) {
if (isPlotWorld(f)) {
if (t==null) {
PWE.removeMask(p);
} else {
return;
}
}
if (isPlotWorld(t)) {
PWE.setMask(p, t);
return;
}
if (f!=null && isPlotWorld(f)) {
PWE.removeMask(p);
return;
}
}
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)