This commit is contained in:
boy0001 2015-07-25 17:09:47 +10:00
parent 6758628cba
commit 00ab472ba6
3 changed files with 148 additions and 48 deletions

View File

@ -50,19 +50,22 @@ public class MusicSubcommand extends SubCommand {
sendMessage(player, C.NO_PLOT_PERMS); sendMessage(player, C.NO_PLOT_PERMS);
return true; return true;
} }
PlotInventory inv = new PlotInventory(player, 2, "Plot Jukebox") { PlotInventory inv = new PlotInventory(player, 2, "Plot Jukebox") {
public boolean onClick(int index) { public boolean onClick(int index) {
PlotItemStack item = getItem(index); PlotItemStack item = getItem(index);
int id = item.id == 7 ? 0 : item.id; if (item == null) {
if (id == 0) { return true;
FlagManager.removePlotFlag(plot, "music"); }
} int id = item.id == 7 ? 0 : item.id;
else { if (id == 0) {
FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("music"), id)); FlagManager.removePlotFlag(plot, "music");
} }
return false; else {
} FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("music"), id));
}; }
return false;
}
};
int index = 0; int index = 0;
for (int i = 2256; i < 2268; i++) { for (int i = 2256; i < 2268; i++) {
String name = "&r&6" + BlockManager.manager.getClosestMatchingName(new PlotBlock((short) i, (byte) 0)); String name = "&r&6" + BlockManager.manager.getClosestMatchingName(new PlotBlock((short) i, (byte) 0));

View File

@ -1372,36 +1372,132 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (event.getTo() == null || event.getFrom() == null) { if (event.getTo() == null || event.getFrom() == null) {
return; return;
} }
final Location f = BukkitUtil.getLocation(event.getFrom()); final org.bukkit.Location from = event.getFrom();
final Location t = BukkitUtil.getLocation(event.getTo()); final org.bukkit.Location to = event.getTo();
final Location q = new Location(t.getWorld(), t.getX(), 64, t.getZ());
final Player player = event.getPlayer(); int x2;
if (PS.get().isPlotWorld(q.getWorld())) { if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
final Plot plot = MainUtil.getPlot(q); String worldname = to.getWorld().getName();
if (plot != null) { PlotWorld plotworld = PS.get().getPlotWorld(worldname);
final PlotPlayer pp = BukkitUtil.getPlayer(player); if (plotworld == null) {
if (plot.isDenied(pp.getUUID())) {
if (Permissions.hasPermission(pp, "plots.admin.enter.denied")) {
return;
}
MainUtil.sendMessage(pp, C.YOU_BE_DENIED);
event.setCancelled(true);
return;
} else {
if (MainUtil.enteredPlot(f, t)) {
plotEntry(pp, plot);
}
}
} else {
if (MainUtil.leftPlot(f, t)) {
final Plot plot2 = MainUtil.getPlot(f);
plotExit(BukkitUtil.getPlayer(player), plot2);
}
}
if ((q.getX() >= 29999999) || (q.getX() <= -29999999) || (q.getZ() >= 29999999) || (q.getZ() <= -29999999)) {
event.setCancelled(true);
return; return;
} }
PlotManager plotManager = PS.get().getPlotManager(worldname);
PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
Player player = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot lastPlot = (Plot) pp.getMeta("lastplot");
if (id == null) {
if (lastPlot == null) {
return;
}
if (!plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.exit.denied");
if (lastPlot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) {
player.teleport(from);
}
else {
player.teleport(player.getWorld().getSpawnLocation());
}
event.setCancelled(true);
return;
}
}
else if (lastPlot != null && id.equals(lastPlot.id)) {
return;
}
else {
Plot plot = MainUtil.getPlot(worldname, id);
if (!plotEntry(pp, plot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.entry.denied");
if (!plot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) {
player.teleport(from);
}
else {
player.teleport(player.getWorld().getSpawnLocation());
}
event.setCancelled(true);
return;
}
}
Integer border = MainUtil.worldBorder.get(worldname);
if (border != null) {
if (x2 > border) {
to.setX(border - 4);
player.teleport(event.getTo());
MainUtil.sendMessage(pp, C.BORDER);
return;
}
else if (x2 < -border) {
to.setX(-border + 4);
player.teleport(event.getTo());
MainUtil.sendMessage(pp, C.BORDER);
return;
}
}
return;
}
int z2;
if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
String worldname = to.getWorld().getName();
PlotWorld plotworld = PS.get().getPlotWorld(worldname);
if (plotworld == null) {
return;
}
PlotManager plotManager = PS.get().getPlotManager(worldname);
PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
Player player = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(player);
Plot lastPlot = (Plot) pp.getMeta("lastplot");
if (id == null) {
if (lastPlot == null) {
return;
}
if (!plotExit(pp, lastPlot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.exit.denied");
if (lastPlot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) {
player.teleport(from);
}
else {
player.teleport(player.getWorld().getSpawnLocation());
}
event.setCancelled(true);
return;
}
}
else if (lastPlot != null && id.equals(lastPlot.id)) {
return;
}
else {
Plot plot = MainUtil.getPlot(worldname, id);
if (!plotEntry(pp, plot)) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.entry.denied");
if (!plot.equals(MainUtil.getPlot(BukkitUtil.getLocation(from)))) {
player.teleport(from);
}
else {
player.teleport(player.getWorld().getSpawnLocation());
}
event.setCancelled(true);
return;
}
}
Integer border = MainUtil.worldBorder.get(worldname);
if (border != null) {
if (z2 > border) {
to.setZ(border - 4);
player.teleport(event.getTo());
MainUtil.sendMessage(pp, C.BORDER);
return;
}
else if (z2 < -border) {
to.setZ(-border + 4);
player.teleport(event.getTo());
MainUtil.sendMessage(pp, C.BORDER);
return;
}
}
return;
} }
} }
@ -1460,6 +1556,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
if (inv != null && event.getRawSlot() == event.getSlot()) { if (inv != null && event.getRawSlot() == event.getSlot()) {
if (!inv.onClick(event.getSlot())) { if (!inv.onClick(event.getSlot())) {
event.setCancelled(true); event.setCancelled(true);
inv.close();
} }
} }
} }

View File

@ -120,14 +120,14 @@ public class WEListener implements Listener {
} }
return true; return true;
} }
} if (!WEManager.regionContains(region, mask)) {
if (!WEManager.regionContains(region, mask)) { MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "pos1 + pos2");
MainUtil.sendMessage(pp, C.REQUIRE_SELECTION_IN_MASK, "pos1 + pos2"); e.setCancelled(true);
e.setCancelled(true); if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) {
if (Permissions.hasPermission(pp, "plots.worldedit.bypass")) { MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS);
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASS); }
return true;
} }
return true;
} }
long volume = Math.abs((pos1.getBlockX() - pos2.getBlockX()) * (pos1.getBlockY() - pos2.getBlockY()) * (pos1.getBlockZ() - pos2.getBlockZ())) * modifier; long volume = Math.abs((pos1.getBlockX() - pos2.getBlockX()) * (pos1.getBlockY() - pos2.getBlockY()) * (pos1.getBlockZ() - pos2.getBlockZ())) * modifier;
return checkVolume(pp, volume, max, e); return checkVolume(pp, volume, max, e);