Merge branch 'master' of ssh://184.154.0.242:7999/min/mineplex
This commit is contained in:
commit
1b11c5dbbf
9
Plugins/.idea/libraries/NoCheatPlus.xml
Normal file
9
Plugins/.idea/libraries/NoCheatPlus.xml
Normal 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>
|
@ -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>
|
@ -4,9 +4,9 @@ public enum RewardType
|
||||
{
|
||||
//% Chances Mythic Legend Rare Uncommon
|
||||
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),
|
||||
MythicalChest( 0.5, 2.5, 10, 40);
|
||||
MythicalChest( 0.5, 3, 12, 75);
|
||||
|
||||
private double _mythicalChance;
|
||||
private double _legendaryChance;
|
||||
|
@ -1,17 +1,16 @@
|
||||
package mineplex.core.treasure;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
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;
|
||||
OneTimePurchaseOnly = false;
|
@ -277,6 +277,8 @@ public class Treasure
|
||||
_rewards[_currentReward].giveReward("Treasure", _player);
|
||||
}
|
||||
|
||||
_currentReward = _rewards.length;
|
||||
|
||||
// Remove any extra blocks
|
||||
resetBlockInfo(_chestBlockInfo);
|
||||
resetBlockInfo(_openedChestBlockInfo);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.treasure.gui;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
@ -9,24 +10,29 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.core.shop.page.ConfirmationPage;
|
||||
import mineplex.core.treasure.OldChest;
|
||||
import mineplex.core.treasure.ChestPackage;
|
||||
import mineplex.core.treasure.TreasureManager;
|
||||
|
||||
public class BuyBasicChestButton implements IButton
|
||||
public class BuyChestButton implements IButton
|
||||
{
|
||||
private Player _player;
|
||||
|
||||
private InventoryManager _inventoryManager;
|
||||
|
||||
private TreasurePage _page;
|
||||
|
||||
public BuyBasicChestButton(Player player, InventoryManager inventoryManager, TreasurePage page)
|
||||
{
|
||||
_player = player;
|
||||
private String _chestName;
|
||||
private Material _chestMat;
|
||||
private int _chestCost;
|
||||
|
||||
public BuyChestButton(Player player, InventoryManager inventoryManager, TreasurePage page,
|
||||
String chestName, Material chestMat, int chestCost)
|
||||
{
|
||||
_inventoryManager = inventoryManager;
|
||||
|
||||
_page = page;
|
||||
|
||||
_chestName = chestName;
|
||||
_chestMat = chestMat;
|
||||
_chestCost = chestCost;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,9 +43,9 @@ public class BuyBasicChestButton implements IButton
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_inventoryManager.addItemToInventory(player, "Item", "Old Chest", 1);
|
||||
_inventoryManager.addItemToInventory(player, "Item", _chestName, 1);
|
||||
_page.Refresh();
|
||||
}
|
||||
}, _page, new OldChest(), CurrencyType.Coins, player));
|
||||
}, _page, new ChestPackage(_chestName, _chestMat, _chestCost), CurrencyType.Coins, player));
|
||||
}
|
||||
}
|
@ -60,8 +60,9 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
|
||||
basicLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
|
||||
else
|
||||
{
|
||||
basicLore.add(ChatColor.RESET + "Cost: " + C.cYellow + "1000 Coins");
|
||||
basicLore.add(ChatColor.RESET + "Click to Purchase!");
|
||||
basicLore.add(ChatColor.RESET + "Click to Purchase for " + C.cYellow + "1000 Coins");
|
||||
basicLore.add(" ");
|
||||
basicLore.add(ChatColor.RESET + "or Purchase at: " + C.cYellow + "www.mineplex.com/shop");
|
||||
}
|
||||
|
||||
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!");
|
||||
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>();
|
||||
@ -94,18 +97,22 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
|
||||
legendaryLore.add(ChatColor.RESET + C.cGreen + "Click to Open!");
|
||||
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 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);
|
||||
|
||||
if (basicCount > 0)
|
||||
AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
|
||||
else
|
||||
AddButton(2, basic, new BuyBasicChestButton(Player, _inventoryManager, this));
|
||||
AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
|
||||
AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
|
||||
if (basicCount > 0) AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
|
||||
else AddButton(2, basic, new BuyChestButton(Player, _inventoryManager, this, "Old Chest", Material.CHEST, 1000));
|
||||
|
||||
if (heroicCount > 0) AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
|
||||
else AddButton(4, heroic, new BuyChestButton(Player, _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000));
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
@ -77,6 +77,9 @@ public class Clans extends JavaPlugin
|
||||
|
||||
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);
|
||||
|
@ -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>
|
||||
|
||||
|
@ -1303,29 +1303,4 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user