Treasure fixes

This commit is contained in:
Shaun Bennett 2015-02-10 21:15:44 -05:00
parent e21e27f07f
commit 58eaaaa2ee
6 changed files with 50 additions and 26 deletions

View File

@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="NoCheatPlus">
<CLASSES>
<root url="jar://$PROJECT_DIR$/Libraries/NoCheatPlus.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -19,5 +19,6 @@
<orderEntry type="library" name="jooq" level="project" />
<orderEntry type="library" name="commons-dbcp2" level="project" />
<orderEntry type="module" module-name="Classpath.Dummy" />
<orderEntry type="library" name="NoCheatPlus" level="project" />
</component>
</module>

View File

@ -277,6 +277,8 @@ public class Treasure
_rewards[_currentReward].giveReward("Treasure", _player);
}
_currentReward = _rewards.length;
// Remove any extra blocks
resetBlockInfo(_chestBlockInfo);
resetBlockInfo(_openedChestBlockInfo);

View File

@ -169,7 +169,7 @@ public class TreasureLocation implements Listener
treasure.update();
if (treasure.isFinished() && treasure.getFinishedTickCount() >= 80)
if (!treasure.getPlayer().isOnline() || (treasure.isFinished() && treasure.getFinishedTickCount() >= 80))
{
treasure.cleanup();
@ -191,24 +191,6 @@ public class TreasureLocation implements Listener
}
}
@EventHandler
public void preventGadgetBlockEvent(GadgetBlockEvent event)
{
if (isTreasureInProgress())
{
List<Block> blocks = event.getBlocks();
for (Block block : blocks)
{
if (_currentTreasure.containsBlock(block))
{
event.setCancelled(true);
return;
}
}
}
}
@EventHandler(priority = EventPriority.HIGH)
public void interact(PlayerInteractEvent event)
{
@ -237,6 +219,10 @@ public class TreasureLocation implements Listener
@EventHandler
public void inventoryOpen(InventoryOpenEvent event)
{
// Ignore punish gui
if (event.getInventory().getTitle() != null && event.getInventory().getTitle().contains("Punish"))
return;
if (isTreasureInProgress() && event.getPlayer().equals(_currentTreasure.getPlayer()))
{
event.setCancelled(true);
@ -268,7 +254,7 @@ public class TreasureLocation implements Listener
Location centerLocation = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5);
double toDistanceFromCenter = centerLocation.distanceSquared(toLocation);
if (toDistanceFromCenter <= 16 && player.getVelocity().lengthSquared() < 10)
if (toDistanceFromCenter <= 16)
{
// Only cancel movement if they are moving towards the center
double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation);
@ -276,7 +262,7 @@ public class TreasureLocation implements Listener
{
Location spawnLocation = new Location(player.getWorld(), 0, 64, 0);
UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
event.setTo(event.getFrom());
// event.setTo(event.getFrom());
}
}
}
@ -293,6 +279,29 @@ public class TreasureLocation implements Listener
}
}
@EventHandler
public void preventGadgetBlockEvent(GadgetBlockEvent event)
{
List<Block> blocks = event.getBlocks();
int x = _chestBlock.getX();
int y = _chestBlock.getY();
int z = _chestBlock.getZ();
for (Block block : blocks)
{
int dx = Math.abs(x - block.getX());
int dy = Math.abs(y - block.getY());
int dz = Math.abs(z - block.getZ());
if (dx <= 4 && dz <= 4 && dy <= 4)
{
event.setCancelled(true);
return;
}
}
}
@EventHandler
public void quit(PlayerQuitEvent event)
{

View File

@ -10,6 +10,7 @@ import mineplex.core.command.CommandCenter;
import mineplex.core.donation.DonationManager;
import mineplex.core.explosion.Explosion;
import mineplex.core.friend.FriendManager;
import mineplex.core.ignore.IgnoreManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.memory.MemoryFix;
@ -62,7 +63,6 @@ public class Clans extends JavaPlugin
new ServerConfiguration(this);
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
new MessageManager(this, _clientManager, preferenceManager);
ServerStatusManager serverStatusManager = new ServerStatusManager(this, _clientManager, new LagMeter(this, _clientManager));
new Spawn(this, serverStatusManager.getCurrentServerName());
@ -74,9 +74,12 @@ public class Clans extends JavaPlugin
Punish punish = new Punish(this, webServerAddress, _clientManager);
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
AntiHack.Instance.setKick(false);
BlockRestore blockRestore = new BlockRestore(this);
IgnoreManager ignoreManager = new IgnoreManager(this, _clientManager, preferenceManager, portal);
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish);
new MemoryFix(this);
new Explosion(this, blockRestore);
new FriendManager(this, _clientManager, preferenceManager, portal);

View File

@ -9,6 +9,6 @@
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="library" name="craftbukkit" level="project" />
<orderEntry type="library" name="NoCheatPlus" level="project" />
</component>
</module>
</module>