*Fixed chat color for plot list, Fixes #420

This commit is contained in:
boy0001 2015-07-18 17:48:30 +10:00
parent f833370bd9
commit ec204bb4c4
2 changed files with 41 additions and 32 deletions

View File

@ -474,8 +474,8 @@ public class list extends SubCommand {
.then("->") .then("->")
.color(ChatColor.GOLD) .color(ChatColor.GOLD)
.command("/plot list " + args[0] + " " + (page + 2)) .command("/plot list " + args[0] + " " + (page + 2))
.color(ChatColor.GRAY)
.then(C.CLICKABLE.s()) .then(C.CLICKABLE.s())
.color(ChatColor.GRAY)
.send(((BukkitPlayer) player).player); .send(((BukkitPlayer) player).player);
return; return;
} }
@ -489,8 +489,8 @@ public class list extends SubCommand {
.then("->") .then("->")
.color(ChatColor.GOLD) .color(ChatColor.GOLD)
.command("/plot list " + args[0] + " " + (page + 2)) .command("/plot list " + args[0] + " " + (page + 2))
.color(ChatColor.GRAY)
.then(C.CLICKABLE.s()) .then(C.CLICKABLE.s())
.color(ChatColor.GRAY)
.send(((BukkitPlayer) player).player); .send(((BukkitPlayer) player).player);
return; return;
} }
@ -504,8 +504,8 @@ public class list extends SubCommand {
.color(ChatColor.DARK_GRAY) .color(ChatColor.DARK_GRAY)
.then("->") .then("->")
.color(ChatColor.DARK_GRAY) .color(ChatColor.DARK_GRAY)
.color(ChatColor.GRAY)
.then(C.CLICKABLE.s()) .then(C.CLICKABLE.s())
.color(ChatColor.GRAY)
.send(((BukkitPlayer) player).player); .send(((BukkitPlayer) player).player);
return; return;
} }

View File

@ -350,19 +350,28 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
plotEntry(pp, plot); plotEntry(pp, plot);
} }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) /**
* Get the int location from double
* @param value
* @return
*/
public int getInt(double value) {
return (int) (value < 0 ? value - 1 : value);
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void PlayerMove(final PlayerMoveEvent event) { public void PlayerMove(final PlayerMoveEvent event) {
org.bukkit.Location from = event.getFrom(); org.bukkit.Location from = event.getFrom();
org.bukkit.Location to = event.getTo(); org.bukkit.Location to = event.getTo();
int x2; int x2;
if (from.getX() != (x2 = (int) to.getX()) ) { if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
String worldname = to.getWorld().getName(); String worldname = to.getWorld().getName();
PlotWorld plotworld = PS.get().getPlotWorld(worldname); PlotWorld plotworld = PS.get().getPlotWorld(worldname);
if (plotworld == null) { if (plotworld == null) {
return; return;
} }
PlotManager plotManager = PS.get().getPlotManager(worldname); PlotManager plotManager = PS.get().getPlotManager(worldname);
PlotId id = plotManager.getPlotId(plotworld, x2, 0, (int) to.getZ()); PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
Player player = event.getPlayer(); Player player = event.getPlayer();
PlotPlayer pp = BukkitUtil.getPlayer(player); PlotPlayer pp = BukkitUtil.getPlayer(player);
PlotId lastId = (PlotId) pp.getMeta("lastplotid"); PlotId lastId = (PlotId) pp.getMeta("lastplotid");
@ -418,7 +427,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return; return;
} }
int z2; int z2;
if ((int) from.getZ() != (z2 = (int) to.getZ()) ) { if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
String worldname = to.getWorld().getName(); String worldname = to.getWorld().getName();
PlotWorld plotworld = PS.get().getPlotWorld(worldname); PlotWorld plotworld = PS.get().getPlotWorld(worldname);
if (plotworld == null) { if (plotworld == null) {
@ -515,7 +524,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
event.setFormat(format); event.setFormat(format);
} }
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGHEST)
public void BlockDestroy(final BlockBreakEvent event) { public void BlockDestroy(final BlockBreakEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final String world = player.getWorld().getName(); final String world = player.getWorld().getName();
@ -598,7 +607,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onWorldChanged(final PlayerChangedWorldEvent event) { public void onWorldChanged(final PlayerChangedWorldEvent event) {
final PlotPlayer player = BukkitUtil.getPlayer(event.getPlayer()); final PlotPlayer player = BukkitUtil.getPlayer(event.getPlayer());
if (PS.get().worldEdit != null) { if (PS.get().worldEdit != null) {
@ -613,7 +622,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
((BukkitPlayer) player).noPerm = new HashSet<>(); ((BukkitPlayer) player).noPerm = new HashSet<>();
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPeskyMobsChangeTheWorldLikeWTFEvent(final EntityChangeBlockEvent event) { public void onPeskyMobsChangeTheWorldLikeWTFEvent(final EntityChangeBlockEvent event) {
final String world = event.getBlock().getWorld().getName(); final String world = event.getBlock().getWorld().getName();
if (!PS.get().isPlotWorld(world)) { if (!PS.get().isPlotWorld(world)) {
@ -663,7 +672,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityBlockForm(final EntityBlockFormEvent e) { public void onEntityBlockForm(final EntityBlockFormEvent e) {
final String world = e.getBlock().getWorld().getName(); final String world = e.getBlock().getWorld().getName();
if (!PS.get().isPlotWorld(world)) { if (!PS.get().isPlotWorld(world)) {
@ -676,7 +685,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBS(final BlockSpreadEvent e) { public void onBS(final BlockSpreadEvent e) {
final Block b = e.getBlock(); final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
@ -687,7 +696,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBF(final BlockFormEvent e) { public void onBF(final BlockFormEvent e) {
final Block b = e.getBlock(); final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
@ -698,7 +707,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBD(final BlockDamageEvent event) { public void onBD(final BlockDamageEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (player == null) { if (player == null) {
@ -756,7 +765,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFade(final BlockFadeEvent e) { public void onFade(final BlockFadeEvent e) {
final Block b = e.getBlock(); final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
@ -767,7 +776,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onChange(final BlockFromToEvent e) { public void onChange(final BlockFromToEvent e) {
final Block b = e.getToBlock(); final Block b = e.getToBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
@ -784,7 +793,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onGrow(final BlockGrowEvent e) { public void onGrow(final BlockGrowEvent e) {
final Block b = e.getBlock(); final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
@ -795,7 +804,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPistonExtend(final BlockPistonExtendEvent event) { public void onBlockPistonExtend(final BlockPistonExtendEvent event) {
final Block block = event.getBlock(); final Block block = event.getBlock();
Location loc = BukkitUtil.getLocation(block.getLocation()); Location loc = BukkitUtil.getLocation(block.getLocation());
@ -837,7 +846,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPistonRetract(final BlockPistonRetractEvent event) { public void onBlockPistonRetract(final BlockPistonRetractEvent event) {
final Block block = event.getBlock(); final Block block = event.getBlock();
Location loc = BukkitUtil.getLocation(block.getLocation()); Location loc = BukkitUtil.getLocation(block.getLocation());
@ -876,7 +885,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onStructureGrow(final StructureGrowEvent e) { public void onStructureGrow(final StructureGrowEvent e) {
if (!PS.get().isPlotWorld(e.getWorld().getName())) { if (!PS.get().isPlotWorld(e.getWorld().getName())) {
return; return;
@ -1183,7 +1192,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
return false; return false;
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockIgnite(final BlockIgniteEvent e) { public void onBlockIgnite(final BlockIgniteEvent e) {
final Player player = e.getPlayer(); final Player player = e.getPlayer();
final Block b = e.getBlock(); final Block b = e.getBlock();
@ -1298,7 +1307,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBucketEmpty(final PlayerBucketEmptyEvent e) { public void onBucketEmpty(final PlayerBucketEmptyEvent e) {
final BlockFace bf = e.getBlockFace(); final BlockFace bf = e.getBlockFace();
final Block b = e.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ()).getBlock(); final Block b = e.getBlockClicked().getLocation().add(bf.getModX(), bf.getModY(), bf.getModZ()).getBlock();
@ -1386,7 +1395,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
BukkitUtil.removePlayer(pp.getName()); BukkitUtil.removePlayer(pp.getName());
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBucketFill(final PlayerBucketFillEvent e) { public void onBucketFill(final PlayerBucketFillEvent e) {
final Block b = e.getBlockClicked(); final Block b = e.getBlockClicked();
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
@ -1430,7 +1439,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onVehicleCreate(final VehicleCreateEvent event) { public void onVehicleCreate(final VehicleCreateEvent event) {
Vehicle entity = event.getVehicle(); Vehicle entity = event.getVehicle();
Location loc = BukkitUtil.getLocation(entity); Location loc = BukkitUtil.getLocation(entity);
@ -1440,7 +1449,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onHangingPlace(final HangingPlaceEvent e) { public void onHangingPlace(final HangingPlaceEvent e) {
final Block b = e.getBlock(); final Block b = e.getBlock();
final Location loc = BukkitUtil.getLocation(b.getLocation()); final Location loc = BukkitUtil.getLocation(b.getLocation());
@ -1479,7 +1488,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onHangingBreakByEntity(final HangingBreakByEntityEvent e) { public void onHangingBreakByEntity(final HangingBreakByEntityEvent e) {
final Entity r = e.getRemover(); final Entity r = e.getRemover();
if (r instanceof Player) { if (r instanceof Player) {
@ -1545,7 +1554,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerInteractEntity(final PlayerInteractEntityEvent e) { public void onPlayerInteractEntity(final PlayerInteractEntityEvent e) {
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation()); final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
if (PS.get().isPlotWorld(l.getWorld())) { if (PS.get().isPlotWorld(l.getWorld())) {
@ -1594,7 +1603,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onVehicleDestroy(final VehicleDestroyEvent e) { public void onVehicleDestroy(final VehicleDestroyEvent e) {
final Location l = BukkitUtil.getLocation(e.getVehicle()); final Location l = BukkitUtil.getLocation(e.getVehicle());
if (PS.get().isPlotWorld(l.getWorld())) { if (PS.get().isPlotWorld(l.getWorld())) {
@ -1639,7 +1648,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityDamageByEntityEvent(final EntityDamageByEntityEvent e) { public void onEntityDamageByEntityEvent(final EntityDamageByEntityEvent e) {
final Location l = BukkitUtil.getLocation(e.getEntity()); final Location l = BukkitUtil.getLocation(e.getEntity());
if (!PS.get().isPlotWorld(l.getWorld())) { if (!PS.get().isPlotWorld(l.getWorld())) {
@ -1777,7 +1786,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerEggThrow(final PlayerEggThrowEvent e) { public void onPlayerEggThrow(final PlayerEggThrowEvent e) {
final Location l = BukkitUtil.getLocation(e.getEgg().getLocation()); final Location l = BukkitUtil.getLocation(e.getEgg().getLocation());
if (PS.get().isPlotWorld(l.getWorld())) { if (PS.get().isPlotWorld(l.getWorld())) {
@ -1813,7 +1822,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
} }
} }
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled=true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled=true)
public void BlockCreate(final BlockPlaceEvent event) { public void BlockCreate(final BlockPlaceEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
final String world = player.getWorld().getName(); final String world = player.getWorld().getName();