Finish patching issues surrounding supply drops

This commit is contained in:
AlexTheCoder 2017-10-01 21:00:18 -04:00 committed by cnr
parent be3e893b55
commit 285ca1e707
3 changed files with 23 additions and 5 deletions

View File

@ -1333,6 +1333,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
_restartManager.onDisable();
_observerManager.onDisable();
Managers.get(MountManager.class).onDisable();
Managers.get(SupplyDropManager.class).onDisable();
ServerOfflineMessage message = new ServerOfflineMessage();
message.ServerName = UtilServer.getServerName();
ClansQueueMessenger.getMessenger(UtilServer.getServerName()).transmitMessage(message, QueueConstant.SERVICE_MESSENGER_IDENTIFIER);

View File

@ -116,7 +116,6 @@ public class SupplyDrop
private void placeChest()
{
_block.setType(Material.CHEST);
ClansManager.getInstance().runSyncLater(() ->
{
Chest chest = (Chest) _block.getState();
@ -214,7 +213,7 @@ public class SupplyDrop
if (getTicks() >= REMOVE_TICKS)
{
finish();
finish(false);
}
}
@ -222,7 +221,7 @@ public class SupplyDrop
}
@SuppressWarnings("deprecation")
public void finish()
public void finish(boolean onDisable)
{
_ended = true;
_hologram.stop();
@ -230,6 +229,14 @@ public class SupplyDrop
{
_below[i].setTypeIdAndData(_oldBelow[i].getLeft().getId(), _oldBelow[i].getRight(), false);
}
_block.breakNaturally();
_block.removeMetadata(SUPPLY_DROP_FILLED_METADATA, UtilServer.getPlugin());
if (onDisable)
{
_block.setType(Material.AIR);
}
else
{
_block.breakNaturally();
}
}
}

View File

@ -60,6 +60,15 @@ public class SupplyDropManager extends MiniPlugin
_shop = new SupplyDropShop(this);
}
@Override
public void disable()
{
if (_active != null)
{
_active.finish(true);
}
}
public SupplyDropShop getShop()
{
return _shop;
@ -99,6 +108,7 @@ public class SupplyDropManager extends MiniPlugin
{
return;
}
if (new BlockPosition(event.getClickedBlock()).equals(_active.getPosition()))
{
event.setCancelled(true);
@ -114,7 +124,7 @@ public class SupplyDropManager extends MiniPlugin
{
return;
}
_active.finish();
_active.finish(false);
_active = null;
}
}