Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex

This commit is contained in:
libraryaddict 2015-02-12 04:06:19 +13:00
commit 1b11c5dbbf
11 changed files with 89 additions and 78 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="jooq" level="project" />
<orderEntry type="library" name="commons-dbcp2" level="project" /> <orderEntry type="library" name="commons-dbcp2" level="project" />
<orderEntry type="module" module-name="Classpath.Dummy" /> <orderEntry type="module" module-name="Classpath.Dummy" />
<orderEntry type="library" name="NoCheatPlus" level="project" />
</component> </component>
</module> </module>

View File

@ -4,9 +4,9 @@ public enum RewardType
{ {
//% Chances Mythic Legend Rare Uncommon //% Chances Mythic Legend Rare Uncommon
GameLoot( 0.000001, 0.00001, 0.0001, 3), GameLoot( 0.000001, 0.00001, 0.0001, 3),
OldChest( 0, 0.01, 0.04, 5), OldChest( 0, 0.05, 0.4, 5),
AncientChest( 0, 1, 4, 25), AncientChest( 0, 1, 4, 25),
MythicalChest( 0.5, 2.5, 10, 40); MythicalChest( 0.5, 3, 12, 75);
private double _mythicalChance; private double _mythicalChance;
private double _legendaryChance; private double _legendaryChance;

View File

@ -1,17 +1,16 @@
package mineplex.core.treasure; package mineplex.core.treasure;
import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.shop.item.SalesPackageBase; import mineplex.core.shop.item.SalesPackageBase;
public class OldChest extends SalesPackageBase public class ChestPackage extends SalesPackageBase
{ {
public OldChest() public ChestPackage(String name, Material mat, int cost)
{ {
super("Old Chest", Material.CHEST, (byte) 0, new String[] {}, 1000); super(name, mat, (byte) 0, new String[] {}, cost);
KnownPackage = false; KnownPackage = false;
OneTimePurchaseOnly = false; OneTimePurchaseOnly = false;

View File

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

View File

@ -169,7 +169,7 @@ public class TreasureLocation implements Listener
treasure.update(); treasure.update();
if (treasure.isFinished() && treasure.getFinishedTickCount() >= 80) if (!treasure.getPlayer().isOnline() || (treasure.isFinished() && treasure.getFinishedTickCount() >= 80))
{ {
treasure.cleanup(); 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) @EventHandler(priority = EventPriority.HIGH)
public void interact(PlayerInteractEvent event) public void interact(PlayerInteractEvent event)
{ {
@ -237,6 +219,10 @@ public class TreasureLocation implements Listener
@EventHandler @EventHandler
public void inventoryOpen(InventoryOpenEvent event) 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())) if (isTreasureInProgress() && event.getPlayer().equals(_currentTreasure.getPlayer()))
{ {
event.setCancelled(true); event.setCancelled(true);
@ -268,7 +254,7 @@ public class TreasureLocation implements Listener
Location centerLocation = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5); Location centerLocation = _currentTreasure.getCenterBlock().getLocation().add(0.5, 1.5, 0.5);
double toDistanceFromCenter = centerLocation.distanceSquared(toLocation); 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 // Only cancel movement if they are moving towards the center
double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation); double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation);
@ -276,7 +262,7 @@ public class TreasureLocation implements Listener
{ {
Location spawnLocation = new Location(player.getWorld(), 0, 64, 0); 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); 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 @EventHandler
public void quit(PlayerQuitEvent event) public void quit(PlayerQuitEvent event)
{ {

View File

@ -1,5 +1,6 @@
package mineplex.core.treasure.gui; package mineplex.core.treasure.gui;
import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
@ -9,24 +10,29 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.IButton; import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.treasure.OldChest; import mineplex.core.treasure.ChestPackage;
import mineplex.core.treasure.TreasureManager; import mineplex.core.treasure.TreasureManager;
public class BuyBasicChestButton implements IButton public class BuyChestButton implements IButton
{ {
private Player _player;
private InventoryManager _inventoryManager; private InventoryManager _inventoryManager;
private TreasurePage _page; private TreasurePage _page;
public BuyBasicChestButton(Player player, InventoryManager inventoryManager, TreasurePage page) private String _chestName;
{ private Material _chestMat;
_player = player; private int _chestCost;
public BuyChestButton(Player player, InventoryManager inventoryManager, TreasurePage page,
String chestName, Material chestMat, int chestCost)
{
_inventoryManager = inventoryManager; _inventoryManager = inventoryManager;
_page = page; _page = page;
_chestName = chestName;
_chestMat = chestMat;
_chestCost = chestCost;
} }
@Override @Override
@ -37,9 +43,9 @@ public class BuyBasicChestButton implements IButton
{ {
public void run() public void run()
{ {
_inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1); _inventoryManager.addItemToInventory(player, "Item", _chestName, 1);
_page.Refresh(); _page.Refresh();
} }
}, _page, new OldChest(), CurrencyType.Coins, player)); }, _page, new ChestPackage(_chestName, _chestMat, _chestCost), CurrencyType.Coins, player));
} }
} }

View File

@ -60,8 +60,9 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else else
{ {
basicLore.add(ChatColor.RESET + "Cost: " + C.cYellow + "1000 Coins"); basicLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "1000 Coins");
basicLore.add(ChatColor.RESET + "Click to Purchase!"); basicLore.add(" ");
basicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
List<String> heroicLore = new ArrayList<String>(); List<String> heroicLore = new ArrayList<String>();
@ -76,7 +77,9 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
heroicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); heroicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else else
{ {
heroicLore.add(ChatColor.RESET + "Purchase at: " + C.cYellow + "www.mineplex.com/shop"); heroicLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "5000 Coins");
heroicLore.add(" ");
heroicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
List<String> legendaryLore = new ArrayList<String>(); List<String> legendaryLore = new ArrayList<String>();
@ -94,18 +97,22 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!"); legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
else else
{ {
legendaryLore.add(ChatColor.RESET + "Purchase at: " + C.cYellow + "www.mineplex.com/shop"); legendaryLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "10000 Coins");
legendaryLore.add(" ");
legendaryLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
} }
ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false); ShopItem basic = new ShopItem(Material.CHEST, C.cGreen + C.Bold + "Old Chest", basicLore.toArray(new String[0]), 0, false, false);
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false); ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false); ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false);
if (basicCount > 0) if (basicCount > 0) AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD)); else AddButton(2, basic, new BuyChestButton(Player, _inventoryManager, this, "Old Chest", Material.CHEST, 1000));
else
AddButton(2, basic, new BuyBasicChestButton(Player, _inventoryManager, this)); if (heroicCount > 0) AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT)); else AddButton(4, heroic, new BuyChestButton(Player, _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000));
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
if (legendaryCount > 0) AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
else AddButton(6, legendary, new BuyChestButton(Player, _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000));
} }
} }

View File

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

View File

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

View File

@ -1303,29 +1303,4 @@ public class GameLobbyManager implements Listener, IPacketHandler
event.setCancelled(true); event.setCancelled(true);
} }
/**
* DEBUG
*/
@EventHandler
public void command(PlayerCommandPreprocessEvent event)
{
Player player = event.getPlayer();
if (event.getMessage().startsWith("/enable"))
{
player.setGameMode(GameMode.CREATIVE);
player.setFlying(true);
player.setFlySpeed(0.1f);
((CraftPlayer) player).getHandle().spectating = true;
((CraftPlayer) player).getHandle().k = false;
}
else if (event.getMessage().startsWith("/disable"))
{
player.setGameMode(GameMode.SURVIVAL);
player.setFlying(false);
player.setFlySpeed(0.1f);
((CraftPlayer) player).getHandle().spectating = false;
((CraftPlayer) player).getHandle().k = true;
}
}
} }