Fix temp blocks in unloaded claims not restoring, fix ClassCombatCreatureSpawnEvent having a null world name, fix block toss fallingblocks solidifying in unloaded chunks, make safelog in clans disable when server shuts down, and make UtilBlock recognize 1.8 fence gates as usable blocks

This commit is contained in:
AlexTheCoder 2016-10-22 16:19:02 -04:00 committed by Shaun Bennett
parent 63ef68976c
commit 1535fcc38b
8 changed files with 62 additions and 14 deletions

View File

@ -304,11 +304,11 @@ public class UtilBlock
blockUseSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
blockUseSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId());
blockUseSet.add((byte) Material.ACACIA_FENCE_GATE.getId());
blockUseSet.add((byte) Material.SPRUCE_FENCE.getId());
blockUseSet.add((byte) Material.BIRCH_FENCE.getId());
blockUseSet.add((byte) Material.JUNGLE_FENCE.getId());
blockUseSet.add((byte) Material.DARK_OAK_FENCE.getId());
blockUseSet.add((byte) Material.ACACIA_FENCE.getId());
blockUseSet.add((byte) Material.SPRUCE_FENCE_GATE.getId());
blockUseSet.add((byte) Material.BIRCH_FENCE_GATE.getId());
blockUseSet.add((byte) Material.JUNGLE_FENCE_GATE.getId());
blockUseSet.add((byte) Material.DARK_OAK_FENCE_GATE.getId());
blockUseSet.add((byte) Material.ACACIA_FENCE_GATE.getId());
blockUseSet.add((byte) Material.SPRUCE_DOOR.getId());
blockUseSet.add((byte) Material.BIRCH_DOOR.getId());

View File

@ -5,12 +5,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import mineplex.core.MiniPlugin;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import java.util.Map.Entry;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -22,8 +17,15 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class BlockRestore extends MiniPlugin
{
private HashMap<Block, BlockRestoreData> _blocks = new HashMap<Block, BlockRestoreData>();
@ -98,6 +100,21 @@ public class BlockRestore extends MiniPlugin
for (Block cur : toRemove)
_blocks.remove(cur);
}
@EventHandler
public void expireUnload(ChunkUnloadEvent event)
{
Iterator<Entry<Block, BlockRestoreData>> iterator = _blocks.entrySet().iterator();
while (iterator.hasNext())
{
Entry<Block, BlockRestoreData> entry = iterator.next();
if (entry.getKey().getChunk().equals(event.getChunk()))
{
entry.getValue().restore();
iterator.remove();
}
}
}
public boolean restore(Block block)
{

View File

@ -495,7 +495,7 @@ public class ClansGame extends MiniPlugin
if (blockClan != null && blockClan.equals(mimicClan)) access = ClanRelation.SELF;
// Doors, chests, & furnaces
if (blockClan != null && (!blockClan.equals(clan) && !blockClan.equals(mimicClan)) && (event.getAction() == Action.RIGHT_CLICK_BLOCK && (loc.getBlock().getType().name().contains("DOOR") || UtilItem.doesHaveGUI(loc.getBlock().getType()))))
if (blockClan != null && (!blockClan.equals(clan) && !blockClan.equals(mimicClan)) && (event.getAction() == Action.RIGHT_CLICK_BLOCK && (loc.getBlock().getType().name().contains("DOOR") || loc.getBlock().getType().name().contains("GATE") || UtilItem.doesHaveGUI(loc.getBlock().getType()))))
{
UtilPlayer.message(player, F.main("Clans", "You are not allowed to use that here."));
event.setCancelled(true);

View File

@ -201,6 +201,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
private BannerManager _bannerManager;
private AmplifierManager _amplifierManager;
private SafeLog _safeLog;
public ClassManager getClassManager()
{
return _classManager;
@ -317,7 +319,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
// Required managers to be initialized
new Spawn(plugin, this);
new NPCManager(this, _hologramManager);
new SafeLog(plugin, this);
_safeLog = new SafeLog(plugin, this);
_observerManager = new ObserverManager(plugin, _condition, this);
new ClanEnergyTracker(plugin, this);
@ -1208,6 +1210,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
_bannerManager.onDisable();
_amplifierManager.onDisable();
_netherManager.onDisable();
_safeLog.onDisable();
}
@EventHandler(priority = EventPriority.HIGHEST)

View File

@ -12,7 +12,7 @@ import mineplex.core.common.util.UtilPlayer;
public class CustomRecipes implements Listener
{
private static final Material[] DISABLED_RECIPES = { Material.EXPLOSIVE_MINECART, Material.JUKEBOX, Material.FISHING_ROD, Material.BED };
private static final Material[] DISABLED_RECIPES = { Material.EXPLOSIVE_MINECART, Material.JUKEBOX, Material.FISHING_ROD, Material.BED, Material.BOAT};
@EventHandler
public void onPlayerCraftItem(CraftItemEvent event)

View File

@ -41,6 +41,12 @@ public class SafeLog extends MiniPlugin
new File(clansManager.UserDataDir).mkdir();
}
@Override
public void disable()
{
NPCManager.getInstance().disable();
}
public void onPlayerQuit(Player player)
{
boolean isSafeLog = false;

View File

@ -3,6 +3,7 @@ package mineplex.minecraft.game.classcombat.Skill.Brute;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
@ -20,6 +21,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
@ -63,7 +65,9 @@ public class BlockToss extends SkillCharge implements IThrown
Material.BURNING_FURNACE,
Material.WORKBENCH,
Material.WATER,
Material.STATIONARY_WATER,
Material.LAVA,
Material.STATIONARY_LAVA,
Material.STONE_PLATE,
Material.WOOD_PLATE,
Material.GOLD_PLATE,
@ -428,6 +432,23 @@ public class BlockToss extends SkillCharge implements IThrown
if (UtilMath.offset(event.getEntity().getLocation(), block.getLocation()) < 1)
event.setCancelled(true);
}
@EventHandler
public void expireUnload(ChunkUnloadEvent event)
{
Iterator<Entry<FallingBlock, Player>> iterator = _falling.entrySet().iterator();
while (iterator.hasNext())
{
Entry<FallingBlock, Player> entry = iterator.next();
FallingBlock key = entry.getKey();
if (key.getLocation().getChunk().equals(event.getChunk()))
{
key.remove();
iterator.remove();
}
}
}
@Override
public void Reset(Player player)

View File

@ -12,6 +12,7 @@ public class ClassCombatCreatureAllowSpawnEvent extends Event
public ClassCombatCreatureAllowSpawnEvent(String worldName, boolean allow)
{
_worldName = worldName;
_allow = allow;
}