mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
We should fix up the event system
Some of it is my fault. Half the events don't get called properly, or aren't cancellable when they say they are. Tell me your ideas for how we should sort out this mess.
This commit is contained in:
parent
560921ebc5
commit
aa81704f80
@ -2,6 +2,8 @@ package com.intellectualcrafters.plot;
|
||||
|
||||
import static com.intellectualcrafters.plot.ReflectionUtils.getRefClass;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.intellectualcrafters.plot.ReflectionUtils.RefClass;
|
||||
import com.intellectualcrafters.plot.ReflectionUtils.RefMethod;
|
||||
|
||||
@ -40,8 +42,9 @@ public class SetBlockFast {
|
||||
}
|
||||
|
||||
public static void update(org.bukkit.entity.Player player) {
|
||||
for (int cx = -8; cx < 8; cx++) {
|
||||
for (int cz = -8; cz < 8; cz++) {
|
||||
int distance = Bukkit.getViewDistance()+1;
|
||||
for (int cx = -distance; cx < distance; cx++) {
|
||||
for (int cz = -distance; cz < distance; cz++) {
|
||||
player.getWorld().refreshChunk(player.getLocation().getChunk().getX() + cx, player.getLocation().getChunk().getZ() + cz);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) IntellectualCrafters - 2014.
|
||||
* You are not allowed to distribute and/or monetize any of our intellectual property.
|
||||
* IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
||||
*
|
||||
* >> File = PlotClearEvent.java
|
||||
* >> Generated by: Citymonstret at 2014-08-09 15:21
|
||||
*/
|
||||
|
||||
package com.intellectualcrafters.plot.events;
|
||||
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotId;
|
||||
|
||||
/**
|
||||
* Called when a plot is cleared
|
||||
*/
|
||||
public class PlotClearEvent extends Event implements Cancellable {
|
||||
private static HandlerList handlers = new HandlerList();
|
||||
private boolean cancelled;
|
||||
|
||||
private PlotId id;
|
||||
private String world;
|
||||
/**
|
||||
* PlotDeleteEvent: Called when a plot is cleared
|
||||
* @param world
|
||||
* @param id
|
||||
*/
|
||||
public PlotClearEvent(String world, PlotId id) {
|
||||
this.id = id;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PlotId
|
||||
* @return PlotId
|
||||
*/
|
||||
public PlotId getPlotId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the world name
|
||||
* @return String
|
||||
*/
|
||||
public String getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean b) {
|
||||
this.cancelled = b;
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
* You are not allowed to distribute and/or monetize any of our intellectual property.
|
||||
* IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
||||
*
|
||||
* >> File = PlayerClaimPlotEvent.java
|
||||
* >> File = PlotDeleteEvent.java
|
||||
* >> Generated by: Citymonstret at 2014-08-09 15:21
|
||||
*/
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class WorldEditListener implements Listener {
|
||||
}
|
||||
Plot plot = PlotHelper.getCurrentPlot(b.getLocation());
|
||||
if (plot != null) {
|
||||
if ((plot != null) && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
||||
if ((plot != null) && plot.hasOwner() && plot.helpers!=null && (plot.helpers.contains(DBFunc.everyone) || plot.helpers.contains(p.getUniqueId()))) {
|
||||
PWE.setMask(p, l);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user