World Event bug fixes

This commit is contained in:
Sam 2017-04-09 16:01:44 +01:00
parent 5c00ca712f
commit 914de58dbc
4 changed files with 26 additions and 31 deletions

View File

@ -138,7 +138,7 @@ public class SafezoneModule extends MiniPlugin
Player player = (Player) event.getEntity();
if (isInSafeZone(player))
if (isInSafeZone(player) && _playerStatus.Get(player).getStatusType() != PlayerStatusType.COMBAT)
{
event.setCancelled(true);
}

View File

@ -14,16 +14,12 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.*;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.event.player.*;
import org.bukkit.event.weather.WeatherChangeEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
@ -216,6 +212,23 @@ public class WorldListeners implements Listener
event.setCancelled(true);
}
@EventHandler
public void fishingExpRemove(PlayerFishEvent event)
{
event.setExpToDrop(0);
}
@EventHandler
public void smelt(BlockExpEvent event)
{
Material material = event.getBlock().getType();
if (material == Material.FURNACE || material == Material.BURNING_FURNACE)
{
event.setExpToDrop(0);
}
}
public boolean shouldBlock(Player player)
{
return player.getGameMode() != GameMode.CREATIVE;

View File

@ -37,7 +37,6 @@ public class BlizzardWorldEvent extends WorldEvent
private static final double START_CHANCE = 0.01;
private static final long MAX_TIME = TimeUnit.MINUTES.toMillis(10);
private static final long GRACE_TIME = TimeUnit.SECONDS.toMillis(60);
private static final long WARM_TIME = TimeUnit.SECONDS.toMillis(5);
private static final int DAMAGE = 2;
private static final String TIP = "EQUIP LEATHER ARMOUR OR GET NEAR A FIRE";
@ -108,8 +107,13 @@ public class BlizzardWorldEvent extends WorldEvent
{
if (shouldDamage(player))
{
_playerStatus.setStatus(player, PlayerStatusType.COLD);
_damage.NewDamageEvent(player, null, null, DamageCause.CUSTOM, DAMAGE, false, true, true, "Hurricane", "Frostbite");
}
else
{
_playerStatus.setStatus(player, PlayerStatusType.WARM);
}
}
}
}
@ -141,30 +145,8 @@ public class BlizzardWorldEvent extends WorldEvent
}
}
_playerStatus.setStatus(player, PlayerStatusType.WARM, WARM_TIME);
return false;
}
@EventHandler
public void updatePlayerStatus(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW || !isLive())
{
return;
}
for (Player player : Bukkit.getOnlinePlayers())
{
PlayerStatus status = _playerStatus.Get(player);
if (status.getStatusType() == PlayerStatusType.COLD)
{
continue;
}
_playerStatus.setStatus(player, PlayerStatusType.COLD, true);
}
}
@Override
public void onStart()

View File

@ -73,7 +73,7 @@ public class GiantWorldEvent extends WorldEvent
public void onEnd()
{
ItemStack itemStack = SkinData.OMEGA_CHEST.getSkull(C.cAqua + "Omega Chest", new ArrayList<>());
LootChestReward reward = new LootChestReward(CASH_OUT_DELAY, SkinData.OMEGA_CHEST.getSkull(C.cAqua + "Omega Chest", null), "Omega", 1);
LootChestReward reward = new LootChestReward(CASH_OUT_DELAY, itemStack, "Omega", 1);
_worldData.World.dropItemNaturally(getEventLocations()[0], itemStack);