mirror of
https://github.com/TotalFreedomMC/TF-PlotSquared.git
synced 2024-12-23 00:15:06 +00:00
Minor changes, formatting, comments.
One notable thing added was the inclusion of more of the new mobs in one of the events.
This commit is contained in:
parent
75bcd1adec
commit
a529518b91
6 changed files with 179 additions and 147 deletions
|
@ -32,7 +32,8 @@ import java.util.HashSet;
|
|||
|
||||
import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
@SuppressWarnings("unused") public class ChunkListener implements Listener {
|
||||
@SuppressWarnings("unused")
|
||||
public class ChunkListener implements Listener {
|
||||
|
||||
private RefMethod methodGetHandleChunk;
|
||||
private RefField mustSave;
|
||||
|
@ -143,7 +144,8 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
|||
return plot != null && plot.hasOwner();
|
||||
}
|
||||
|
||||
@EventHandler public void onChunkUnload(ChunkUnloadEvent event) {
|
||||
@EventHandler
|
||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||
if (ignoreUnload) {
|
||||
return;
|
||||
}
|
||||
|
@ -161,11 +163,13 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onChunkLoad(ChunkLoadEvent event) {
|
||||
@EventHandler
|
||||
public void onChunkLoad(ChunkLoadEvent event) {
|
||||
processChunk(event.getChunk(), false);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST) public void onItemSpawn(ItemSpawnEvent event) {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onItemSpawn(ItemSpawnEvent event) {
|
||||
Item entity = event.getEntity();
|
||||
Chunk chunk = entity.getLocation().getChunk();
|
||||
if (chunk == this.lastChunk) {
|
||||
|
|
|
@ -58,7 +58,8 @@ import java.util.regex.Pattern;
|
|||
/**
|
||||
* Player Events involving plots.
|
||||
*/
|
||||
@SuppressWarnings("unused") public class PlayerEvents extends PlotListener implements Listener {
|
||||
@SuppressWarnings("unused")
|
||||
public class PlayerEvents extends PlotListener implements Listener {
|
||||
|
||||
private boolean pistonBlocks = true;
|
||||
private float lastRadius;
|
||||
|
@ -172,6 +173,13 @@ import java.util.regex.Pattern;
|
|||
case MULE:
|
||||
case ZOMBIE_HORSE:
|
||||
case SKELETON_HORSE:
|
||||
case PARROT:
|
||||
case TURTLE:
|
||||
case COD:
|
||||
case SALMON:
|
||||
case DOLPHIN:
|
||||
case PUFFERFISH:
|
||||
case TROPICAL_FISH:
|
||||
// animal
|
||||
return EntityUtil
|
||||
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP);
|
||||
|
@ -202,12 +210,14 @@ import java.util.regex.Pattern;
|
|||
case EVOKER:
|
||||
case VEX:
|
||||
case ZOMBIE_VILLAGER:
|
||||
case DROWNED:
|
||||
case ILLUSIONER:
|
||||
// monster
|
||||
return EntityUtil
|
||||
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.HOSTILE_CAP);
|
||||
default:
|
||||
if (entity instanceof LivingEntity) {
|
||||
if (entity instanceof Animals) {
|
||||
if (entity instanceof Animals || entity instanceof WaterMob) {
|
||||
return EntityUtil
|
||||
.checkEntity(plot, Flags.ENTITY_CAP, Flags.MOB_CAP, Flags.ANIMAL_CAP);
|
||||
} else if (entity instanceof Monster) {
|
||||
|
@ -227,7 +237,8 @@ import java.util.regex.Pattern;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onRedstoneEvent(BlockRedstoneEvent event) {
|
||||
@EventHandler
|
||||
public void onRedstoneEvent(BlockRedstoneEvent event) {
|
||||
Block block = event.getBlock();
|
||||
switch (block.getType()) {
|
||||
case OBSERVER:
|
||||
|
@ -405,7 +416,8 @@ import java.util.regex.Pattern;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
@EventHandler
|
||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||
Projectile entity = event.getEntity();
|
||||
if (!(entity instanceof ThrownPotion)) {
|
||||
return;
|
||||
|
@ -426,7 +438,8 @@ import java.util.regex.Pattern;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler public boolean onProjectileHit(ProjectileHitEvent event) {
|
||||
@EventHandler
|
||||
public boolean onProjectileHit(ProjectileHitEvent event) {
|
||||
Projectile entity = event.getEntity();
|
||||
Location loc = BukkitUtil.getLocation(entity);
|
||||
if (!PlotSquared.get().hasPlotArea(loc.getWorld())) {
|
||||
|
@ -835,7 +848,8 @@ import java.util.regex.Pattern;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW) public void onChat(AsyncPlayerChatEvent event) {
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void onChat(AsyncPlayerChatEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
|
@ -887,7 +901,8 @@ import java.util.regex.Pattern;
|
|||
PlotSquared.debug(full);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void blockDestroy(BlockBreakEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Location location = BukkitUtil.getLocation(event.getBlock().getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
|
@ -1972,10 +1987,13 @@ import java.util.regex.Pattern;
|
|||
return;
|
||||
}
|
||||
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
|
||||
//TODO needs an overhaul for the increased number of spawn reasons added to this event.
|
||||
//I can't believe they waited so damn long to expand this API set.
|
||||
switch (reason) {
|
||||
case SPAWNER_EGG:
|
||||
case DISPENSE_EGG:
|
||||
case OCELOT_BABY:
|
||||
case EGG:
|
||||
if (!area.SPAWN_EGGS) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
@ -2053,7 +2071,8 @@ import java.util.regex.Pattern;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onPrime(ExplosionPrimeEvent event) {
|
||||
@EventHandler
|
||||
public void onPrime(ExplosionPrimeEvent event) {
|
||||
this.lastRadius = event.getRadius() + 1;
|
||||
}
|
||||
|
||||
|
@ -2213,7 +2232,8 @@ import java.util.regex.Pattern;
|
|||
PlotInventory.removePlotInventoryOpen(BukkitUtil.getPlayer(player));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR) public void onLeave(PlayerQuitEvent event) {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onLeave(PlayerQuitEvent event) {
|
||||
TaskManager.TELEPORT_QUEUE.remove(event.getPlayer().getName());
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer());
|
||||
pp.unregister();
|
||||
|
@ -2501,7 +2521,8 @@ import java.util.regex.Pattern;
|
|||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.HIGHEST)
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onEntityCombustByEntity(EntityCombustByEntityEvent event) {
|
||||
EntityDamageByEntityEvent eventChange;
|
||||
eventChange = new EntityDamageByEntityEvent(event.getCombuster(), event.getEntity(),
|
||||
|
|
|
@ -30,7 +30,8 @@ import java.util.Iterator;
|
|||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
@SuppressWarnings("unused") public class PlotPlusListener extends PlotListener implements Listener {
|
||||
@SuppressWarnings("unused")
|
||||
public class PlotPlusListener extends PlotListener implements Listener {
|
||||
|
||||
private static final HashMap<UUID, Interval> feedRunnable = new HashMap<>();
|
||||
private static final HashMap<UUID, Interval> healRunnable = new HashMap<>();
|
||||
|
@ -80,7 +81,8 @@ import java.util.UUID;
|
|||
}, 0L, 20L);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH) public void onInteract(BlockDamageEvent event) {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onInteract(BlockDamageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (player.getGameMode() != GameMode.SURVIVAL) {
|
||||
return;
|
||||
|
@ -99,7 +101,8 @@ import java.util.UUID;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH) public void onDamage(EntityDamageEvent event) {
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onDamage(EntityDamageEvent event) {
|
||||
if (event.getEntityType() != EntityType.PLAYER) {
|
||||
return;
|
||||
}
|
||||
|
@ -113,7 +116,8 @@ import java.util.UUID;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onItemDrop(PlayerDropItemEvent event) {
|
||||
@EventHandler
|
||||
public void onItemDrop(PlayerDropItemEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
Plot plot = BukkitUtil.getLocation(player).getOwnedPlot();
|
||||
|
@ -128,7 +132,8 @@ import java.util.UUID;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onPlotEnter(PlayerEnterPlotEvent event) {
|
||||
@EventHandler
|
||||
public void onPlotEnter(PlayerEnterPlotEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
Plot plot = event.getPlot();
|
||||
Optional<Integer[]> feed = plot.getFlag(Flags.FEED);
|
||||
|
@ -143,13 +148,15 @@ import java.util.UUID;
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
@EventHandler
|
||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
feedRunnable.remove(player.getUniqueId());
|
||||
healRunnable.remove(player.getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler public void onPlotLeave(PlayerLeavePlotEvent event) {
|
||||
@EventHandler
|
||||
public void onPlotLeave(PlayerLeavePlotEvent event) {
|
||||
Player leaver = event.getPlayer();
|
||||
Plot plot = event.getPlot();
|
||||
if (!plot.hasOwner()) {
|
||||
|
@ -160,7 +167,8 @@ import java.util.UUID;
|
|||
healRunnable.remove(leaver.getUniqueId());
|
||||
}
|
||||
|
||||
@EventHandler public void onItemPickup(EntityPickupItemEvent event) {
|
||||
@EventHandler
|
||||
public void onItemPickup(EntityPickupItemEvent event) {
|
||||
LivingEntity ent = event.getEntity();
|
||||
if (ent instanceof Player) {
|
||||
Player player = (Player) ent;
|
||||
|
@ -181,7 +189,7 @@ import java.util.UUID;
|
|||
final int interval;
|
||||
final int amount;
|
||||
final int max;
|
||||
public int count = 0;
|
||||
int count = 0;
|
||||
|
||||
Interval(int interval, int amount, int max) {
|
||||
this.interval = interval;
|
||||
|
|
|
@ -1072,22 +1072,22 @@ public class BukkitChunkManager extends ChunkManager {
|
|||
}
|
||||
for (short y = 0; y <= maxY; y++) {
|
||||
Block block = world.getBlockAt(x, y, z);
|
||||
Material id = block.getType();
|
||||
Material blockType = block.getType();
|
||||
if (storeNormal) {
|
||||
if (id.name().contains("AIR")) {
|
||||
if (blockType.name().contains("AIR")) {
|
||||
ids[y] = StringPlotBlock.EVERYTHING;
|
||||
} else {
|
||||
ids[y] = PlotBlock.get(id.name());
|
||||
ids[y] = PlotBlock.get(blockType.name());
|
||||
}
|
||||
}
|
||||
if (!id.name().contains("AIR")) {
|
||||
if (!blockType.name().contains("AIR")) {
|
||||
try {
|
||||
BlockLoc bl = new BlockLoc(x + offsetX, y, z + offsetZ);
|
||||
if (block.getState() instanceof InventoryHolder) {
|
||||
InventoryHolder inventoryHolder = (InventoryHolder) block.getState();
|
||||
ItemStack[] inventory =
|
||||
inventoryHolder.getInventory().getContents().clone();
|
||||
switch (id) {
|
||||
switch (blockType) {
|
||||
case CHEST:
|
||||
this.chestContents.put(bl, inventory);
|
||||
break;
|
||||
|
|
|
@ -11,12 +11,10 @@ import com.github.intellectualsites.plotsquared.plot.util.WorldUtil;
|
|||
|
||||
public class SinglePlotArea extends GridPlotWorld {
|
||||
|
||||
private final SinglePlotArea instance;
|
||||
public boolean VOID = false;
|
||||
|
||||
public SinglePlotArea() {
|
||||
super("*", null, new SingleWorldGenerator(), null, null);
|
||||
instance = this;
|
||||
this.ALLOW_SIGNS = false;
|
||||
this.DEFAULT_HOME = new PlotLoc(Integer.MAX_VALUE, Integer.MAX_VALUE);
|
||||
}
|
||||
|
|
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,5 +1,6 @@
|
|||
#Fri Dec 21 16:11:33 EST 2018
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
|
||||
|
|
Loading…
Reference in a new issue