Fix a gold setting issue, block certain versions, and implement a bunch more content!

This commit is contained in:
AlexTheCoder 2017-09-16 21:21:12 -04:00
parent badfa76166
commit e107c1e6cc
45 changed files with 1098 additions and 387 deletions

View File

@ -45,7 +45,8 @@ public class SkinData
public final static SkinData STEVE = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjY3MzgxOTAzNDYsInByb2ZpbGVJZCI6ImJiYjg3ZGJlNjkwZjQyMDViZGM1NzJmZmI4ZWJjMjlkIiwicHJvZmlsZU5hbWUiOiJkaXJld29sZjIwIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS82NmZlNTE3NjY1MTdmM2QwMWNmZGI3MjQyZWI1ZjM0YWVhOTYyOGExNjZlM2U0MGZhZjRjMTMyMTY5NiJ9fX0=", "xIDCRBS39ZhhROcYkYORDcWosWqR5xvrTTScNzpt8WtBq1cAoL1mXEi/PtBrEEvajcpR/nGhRlZV/IeavtmUx49ulY3bdX827Rex3504DnmolxVqnq8/p1W8ywxV9FBcMI4Cto3c5kmIXHTTAcLsUuCmsmprzuMS+/RvfJ//vjem+lUc+eQKBe3Hc3ocapfxf1dHqSrtzurW2fRTMZcJWEOr9eicRDzOOP2nbtfZGeCcwJPnYJMxJReBWLO/LiV6Bzm/8+ynRFzmJVw7zvXY9WCz/Yt95nK1lqpFZXR7djFYTsnLpLc71rUPhPwSZSVm0Ca+wZWI2RFnm3kbKRsIB89EqsVIxgw9SMKHJwGPc/GBMOZuO2J6HxGn5xXE5JnLTn8YzpBDft+3Hnb2EJTJ2OCPHaQtzMiYDG4+OkwP7ksxcwmMxRUWuE37dwXi/d4A94IKsLqrCxj+vGFPo13wc5L0DRRx7Plk2/nrC32UhKomkjGz2XbS1aJpKgLILbaM1nYnNGKx/VBLNNJdpwhwaoWgRPEB2MEFmxV+GQ/QgOJuaI7fj5KfLqC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FX/iwtHWzpBa9V6kUNNN+V7OGTgRr0H/yUxB+oq1F8UBqyqT4YpqxXCSD36derF/Xt5IdpTbEbGBpm0=");

View File

@ -1,13 +1,12 @@
package mineplex.core.common.util.particles;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import mineplex.core.common.util.UtilParticle;
public class ColoredParticle extends ParticleData
{
private ParticleColor _color;
public ColoredParticle(UtilParticle.ParticleType particleType, ParticleColor color, Location location)
@ -45,21 +44,8 @@ public class ColoredParticle extends ParticleData
}
}
@Override
public void display(UtilParticle.ViewDist viewDist)
{
display(viewDist, UtilServer.getPlayers());
}
@Override
public void display()
{
display(UtilParticle.ViewDist.NORMAL);
}
public void setColor(ParticleColor color)
{
_color = color;
}
}
}

View File

@ -7,7 +7,6 @@ import org.bukkit.entity.Player;
public class ParticleData
{
protected UtilParticle.ParticleType _particleType;
protected Location _location;
@ -18,8 +17,8 @@ public class ParticleData
}
/**
* Displays the particles for all the players with a different ammount
* @param count the ammount of particles
* Displays the particles for all the players with a different amount
* @param count the amount of particles
*/
public void display(int count)
{
@ -73,5 +72,4 @@ public class ParticleData
{
return _location;
}
}
}

View File

@ -72,7 +72,7 @@ public class DisguisePlayer extends DisguiseHuman
private DisguisePlayer(Entity entity)
{
super(EntityType.PLAYER, entity);
this._originalProfile = entity instanceof Player ? UtilGameProfile.getGameProfile((Player) entity) : null;
_originalProfile = entity instanceof Player ? UtilGameProfile.getGameProfile((Player) entity) : null;
}
/**
@ -82,7 +82,7 @@ public class DisguisePlayer extends DisguiseHuman
{
this(entity);
this._profile = UtilGameProfile.clone(gameProfile);
_profile = UtilGameProfile.clone(gameProfile);
}
/**
@ -101,16 +101,16 @@ public class DisguisePlayer extends DisguiseHuman
{
this(entity);
this._requestedUsername = username;
this._requestedSkin = skin;
_requestedUsername = username;
_requestedSkin = skin;
}
public DisguisePlayer(Entity entity, String username, SkinData skinData)
{
this(entity);
this._requestedUsername = username;
this._requestedSkinData = skinData;
_requestedUsername = username;
_requestedSkinData = skinData;
}
/**
@ -121,7 +121,7 @@ public class DisguisePlayer extends DisguiseHuman
*/
public Future<Object> initialize(Runnable onComplete)
{
if (this._profile != null && this._profile.isComplete())
if (_profile != null && _profile.isComplete())
{
onComplete.run();
return CompletableFuture.completedFuture(null);
@ -139,8 +139,8 @@ public class DisguisePlayer extends DisguiseHuman
_requestedSkinData = SkinData.constructFromGameProfile(profileOfSkin, true, true);
}
this._profile = new GameProfile(profileOfUsername.getId(), profileOfUsername.getName());
this._profile.getProperties().put("textures", _requestedSkinData.getProperty());
_profile = new GameProfile(profileOfUsername.getId(), profileOfUsername.getName());
_profile.getProperties().put("textures", _requestedSkinData.getProperty());
}
catch (Exception e)
{
@ -171,8 +171,8 @@ public class DisguisePlayer extends DisguiseHuman
public void showInTabList(boolean show, int delay)
{
this._showInTabList = show;
this._showInTabListDelay = delay;
_showInTabList = show;
_showInTabListDelay = delay;
}
public BlockFace getSleepingDirection()
@ -446,12 +446,12 @@ public class DisguisePlayer extends DisguiseHuman
public boolean showInTabList()
{
return this._showInTabList;
return _showInTabList;
}
public int getShowInTabListDelay()
{
return this._showInTabListDelay;
return _showInTabListDelay;
}
private WorldSettings.EnumGamemode getAppropriateGamemode()
@ -465,25 +465,25 @@ public class DisguisePlayer extends DisguiseHuman
private GameProfile getSelfProfile()
{
GameProfile selfProfile = new GameProfile(getOriginalUUID(), this._profile.getName());
selfProfile.getProperties().putAll(this._profile.getProperties());
GameProfile selfProfile = new GameProfile(getOriginalUUID(), _profile.getName());
selfProfile.getProperties().putAll(_profile.getProperties());
return selfProfile;
}
public boolean replaceOriginalName()
{
return this._replaceOriginalName;
return _replaceOriginalName;
}
public int replaceOriginalNameDelay()
{
return this._replaceOriginalNameDelay;
return _replaceOriginalNameDelay;
}
public void setReplaceOriginalName(boolean b, int delay)
{
this._replaceOriginalName = b;
this._replaceOriginalNameDelay = delay;
_replaceOriginalName = b;
_replaceOriginalNameDelay = delay;
}
public Hologram getHologram()
@ -504,16 +504,14 @@ public class DisguisePlayer extends DisguiseHuman
private UUID getOriginalUUID()
{
if (this._originalProfile.getProperties().containsKey(PlayerDisguiseManager.ORIGINAL_UUID_KEY))
if (_originalProfile.getProperties().containsKey(PlayerDisguiseManager.ORIGINAL_UUID_KEY))
{
try
{
return UUID.fromString(this._originalProfile.getProperties().get(PlayerDisguiseManager.ORIGINAL_UUID_KEY).iterator().next().getValue());
}
catch (IllegalArgumentException ignored)
{
return UUID.fromString(_originalProfile.getProperties().get(PlayerDisguiseManager.ORIGINAL_UUID_KEY).iterator().next().getValue());
}
catch (IllegalArgumentException ignored) {}
}
return this._originalProfile.getId();
return _originalProfile.getId();
}
}

View File

@ -15,8 +15,8 @@ public class GoldRepository
private static final int DUPLICATE_PRIMARY_KEY_ERROR_CODE = 1062;
private static final String CREATE_TABLE = "CREATE TABLE clansGold (serverId int(11) not null, accountId int(11) not null, gold int not null, primary key (serverId, accountId), index valueIndex (serverId, accountId, gold), index goldIndex (serverId, gold), foreign key (serverId) references clanServer(id), foreign key (accountId) references accounts(id))";
private static final String INSERT_ACCOUNT_GOLD = "INSERT INTO clansGold (serverId, accountId, gold) VALUES (?, ?, ?);";
private static final String UPDATE_ACCOUNT_GOLD = "UPDATE clansGold SET gold=? WHERE serverId=? AND accountId=? AND gold+? > 0;";
private static final String SET_ACCOUNT_GOLD = "INSERT INTO clansGold (serverId, accountId, gold) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE gold=?;";
private static final String UPDATE_ACCOUNT_GOLD = "UPDATE clansGold SET gold=gold+? WHERE serverId=? AND accountId=? AND (gold+? > 0 OR gold+? = 0);";
private static final String SET_ACCOUNT_GOLD = "INSERT INTO clansGold (serverId, accountId, gold) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE gold=VALUES(gold);";
public GoldRepository() {}
@ -49,6 +49,7 @@ public class GoldRepository
statement.setInt(2, serverId);
statement.setInt(3, accountId);
statement.setInt(4, gold);
statement.setInt(5, gold);
int updateCount = statement.executeUpdate();
final boolean success = updateCount > 0;
@ -96,7 +97,6 @@ public class GoldRepository
statement.setInt(1, serverId);
statement.setInt(2, accountId);
statement.setInt(3, gold);
statement.setInt(4, gold);
statement.executeUpdate();
if (callback != null)

View File

@ -60,11 +60,8 @@ public class ServerCommand extends CommandBase<Portal>
}
else if (servUp.startsWith("CLANS-"))
{
if (!_commandCenter.GetClientManager().Get(player).hasPermission(Portal.Perm.SERVER_COMMAND_CLANS))
{
UtilPlayer.message(player, F.main(Plugin.getName(), "Clans servers can only be joined via the Clans Hub!"));
return;
}
UtilPlayer.message(player, F.main(Plugin.getName(), "Clans servers can only be joined via the Clans Hub!"));
return;
}
if (deniedAccess)

View File

@ -26,7 +26,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.common.util.UtilWorld;
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
import mineplex.game.clans.clans.tntGenerator.TntGenerator;
import mineplex.game.clans.clans.tntgenerator.TntGenerator;
import mineplex.game.clans.core.ClaimLocation;
import mineplex.game.clans.core.repository.tokens.ClanAllianceToken;
import mineplex.game.clans.core.repository.tokens.ClanMemberToken;

View File

@ -22,7 +22,7 @@ import mineplex.game.clans.clans.event.ClanJoinEvent;
import mineplex.game.clans.clans.event.ClanLeaveEvent;
import mineplex.game.clans.clans.event.ClanSetHomeEvent;
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
import mineplex.game.clans.clans.tntGenerator.TntGenerator;
import mineplex.game.clans.clans.tntgenerator.TntGenerator;
import mineplex.game.clans.core.ClaimLocation;
import mineplex.game.clans.core.repository.ClanRepository;
import mineplex.game.clans.core.repository.ClanTerritory;
@ -507,13 +507,9 @@ public class ClansDataAccessLayer
_manager.getClaimMap().put(chunk, claim);
// Save
runAsync(new Runnable()
runAsync(() ->
{
@Override
public void run()
{
_repository.addTerritoryClaim(clan.getId(), chunk, safe);
}
_repository.addTerritoryClaim(clan.getId(), chunk, safe);
});
// Visual

View File

@ -99,6 +99,7 @@ import mineplex.game.clans.clans.ClansUtility.ClanRelation;
import mineplex.game.clans.clans.amplifiers.AmplifierManager;
import mineplex.game.clans.clans.banners.BannerManager;
import mineplex.game.clans.clans.boxes.BoxManager;
import mineplex.game.clans.clans.cash.CashShopManager;
import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
import mineplex.game.clans.clans.commands.ClansChatCommand;
import mineplex.game.clans.clans.commands.ClansCommand;
@ -122,8 +123,8 @@ import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
import mineplex.game.clans.clans.regions.ClansRegions;
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
import mineplex.game.clans.clans.siege.SiegeManager;
import mineplex.game.clans.clans.supplyDrop.SupplyDropManager;
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
import mineplex.game.clans.clans.supplydrop.SupplyDropManager;
import mineplex.game.clans.clans.tntgenerator.TntGeneratorManager;
import mineplex.game.clans.clans.war.WarManager;
import mineplex.game.clans.clans.warpoints.WarPointEvasion;
import mineplex.game.clans.clans.worldevent.WorldEventManager;
@ -385,7 +386,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
}
}
{
if (_worldEvent.isInEvent(location))
if (_worldEvent.isInEvent(location, true))
{
return false;
}
@ -518,6 +519,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
_restartManager = new RestartManager(plugin);
require(CashShopManager.class);
generatePermissions();
ServerOnlineMessage message = new ServerOnlineMessage();

View File

@ -37,7 +37,7 @@ public class AmplifierGUI implements Listener
{
_viewer = viewer;
_manager = manager;
_inventory = Bukkit.createInventory(viewer, 9, C.cClansNether + "Rune Amplifiers");
_inventory = Bukkit.createInventory(viewer, 27, C.cClansNether + "Rune Amplifiers");
Bukkit.getPluginManager().registerEvents(this, manager.getPlugin());
propagate();
@ -68,27 +68,38 @@ public class AmplifierGUI implements Listener
public void propagate()
{
getItems().clear();
Integer slot = 0;
_boundSlots.clear();
int[] slots = {12, 14};
int i = 0;
for (AmplifierType type : AmplifierType.values())
{
int owned = _manager.getAmountOwned(getViewer(), type);
owned = Math.max(owned, 0);
getItems().put(slot, new ItemBuilder(Material.NETHER_STAR).setAmount(Math.min(owned, 1)).setTitle(type.getDisplayName()).setLore(F.elem(owned) + " Owned").build());
int slot = slots[i++];
getItems().put(slot, new ItemBuilder(Material.NETHER_STAR)
.setTitle(type.getDisplayName())
.addLore(C.cYellow + "Summons a " + C.cClansNether + "Nether Portal" + C.cYellow + " in Shops")
.addLore(C.cYellow + "And doubles the chance of Rune drops.")
.addLore(C.cRed + " ")
.addLore(C.cGreen + ">Click to Activate<")
.addLore(C.cBlue + " ")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(owned)) + C.cDAqua + " " + type.getCleanDisplayName() + "s")
.build()
);
_boundSlots.put(slot, type);
slot++;
}
refresh();
}
/**
* Fils the confirmation menu with buttons
* Fills the confirmation menu with buttons
*/
public void propagateConfirmation()
{
getItems().clear();
_boundSlots.clear();
getItems().put(3, new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short) 5).setTitle(C.cGreen + "Confirm").build());
getItems().put(5, new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short) 14).setTitle(C.cRed + "Cancel").build());
getItems().put(12, new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short) 5).setTitle(C.cGreen + "Confirm").build());
getItems().put(14, new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short) 14).setTitle(C.cRed + "Cancel").build());
refresh();
}

View File

@ -135,7 +135,7 @@ public class AmplifierManager extends MiniPlugin
private AmplifierType(String extension, String displayName, long duration)
{
_extension = extension;
_display = C.cClansNether + displayName;
_display = displayName;
_duration = duration;
}
@ -153,6 +153,11 @@ public class AmplifierManager extends MiniPlugin
* @return The display name for this amplifier in this GUI
*/
public String getDisplayName()
{
return C.cClansNether + _display;
}
public String getCleanDisplayName()
{
return _display;
}

View File

@ -0,0 +1,113 @@
package mineplex.game.clans.clans.bosstoken;
import java.util.Arrays;
import java.util.List;
import java.util.function.BiFunction;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.worldevent.WorldEventManager;
import mineplex.game.clans.clans.worldevent.WorldEventType;
public class BossTokenPage extends ShopPageBase<WorldEventManager, BossTokenShop>
{
public BossTokenPage(WorldEventManager plugin, BossTokenShop shop, String name, Player player)
{
super(plugin, shop, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), name, player, 27);
buildPage();
}
@Override
protected void buildPage()
{
int[] slots = {12, 14};
int i = 0;
for (TokenType type : TokenType.values())
{
int owned = ClansManager.getInstance().getInventoryManager().Get(_player).getItemCount(type.getItemName());
int slot = slots[i++];
addButton(slot, type.getButton(C.cRed + type.getDisplay() + " Summon Token", Arrays.asList(
C.cYellow + "Summon the powerful " + type.getDisplay(),
C.cYellow + "In the " + C.cRed + "Borderlands",
C.cRed + " ",
C.cGreen + ">Click to Activate<",
C.cBlue + " ",
C.cDAqua + "You own " + F.greenElem(String.valueOf(Math.max(owned, 0))) + C.cDAqua + " " + type.getDisplay() + " Summon Tokens"
)
), (player, clickType) ->
{
if (!Recharge.Instance.use(player, "Clans Box Click", 1000, false, false))
{
return;
}
if (owned < 1)
{
playDenySound(player);
UtilPlayer.message(player, F.main(getPlugin().getName(), "You do not have enough of that token! Purchase some at http://www.mineplex.com/shop!"));
return;
}
if (!getPlugin().getEvents().isEmpty())
{
playDenySound(player);
UtilPlayer.message(player, F.main(getPlugin().getName(), "There is already an ongoing event! Try again later!"));
return;
}
WorldEventManager manager = getPlugin();
player.closeInventory();
manager.startEventFromType(type.getType());
ClansManager.getInstance().getInventoryManager().addItemToInventory(player, type.getItemName(), -1);
});
}
}
private enum TokenType
{
SKELETON("Skeleton", "Skeleton King", WorldEventType.SKELETON_KING, (name, lore) -> new ItemBuilder(Material.SKULL_ITEM).setData((short)1).setTitle(name).addLores(lore).build()),
WIZARD("Wizard", "Iron Wizard", WorldEventType.IRON_WIZARD, SkinData.IRON_GOLEM::getSkull)
;
private final String _itemEnding;
private final String _display;
private final WorldEventType _type;
private final BiFunction<String, List<String>, ItemStack> _buttonCreator;
private TokenType(String itemEnding, String display, WorldEventType type, BiFunction<String, List<String>, ItemStack> buttonCreator)
{
_itemEnding = itemEnding;
_display = display;
_type = type;
_buttonCreator = buttonCreator;
}
public String getItemName()
{
return "Clans Boss Token " + _itemEnding;
}
public String getDisplay()
{
return _display;
}
public WorldEventType getType()
{
return _type;
}
public ItemStack getButton(String itemName, List<String> lore)
{
return _buttonCreator.apply(itemName, lore);
}
}
}

View File

@ -0,0 +1,22 @@
package mineplex.game.clans.clans.bosstoken;
import org.bukkit.entity.Player;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.worldevent.WorldEventManager;
public class BossTokenShop extends ShopBase<WorldEventManager>
{
public BossTokenShop(WorldEventManager plugin)
{
super(plugin, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), "Boss Token");
}
@Override
protected ShopPageBase<WorldEventManager, ? extends ShopBase<WorldEventManager>> buildPagesFor(Player player)
{
return new BossTokenPage(getPlugin(), this, "Boss Tokens", player);
}
}

View File

@ -23,7 +23,6 @@ import mineplex.core.command.CommandBase;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.game.clans.clans.boxes.extra.BuilderBoxInventory;
import mineplex.game.clans.clans.boxes.extra.DyeBoxSpinner;
public class BoxManager extends MiniPlugin
{
@ -32,13 +31,14 @@ public class BoxManager extends MiniPlugin
BOX_COMMAND,
}
private BuilderBoxInventory _builderBox;
private final BuilderBoxInventory _builderBox;
private final BoxShop _shop;
public BoxManager(JavaPlugin plugin)
{
super("Box Manager", plugin);
final BoxShop shop = new BoxShop(this);
_shop = new BoxShop(this);
_builderBox = new BuilderBoxInventory();
@ -47,7 +47,7 @@ public class BoxManager extends MiniPlugin
@Override
public void Execute(Player caller, String[] args)
{
shop.attemptShopOpen(caller);
_shop.attemptShopOpen(caller);
}
});
@ -59,6 +59,11 @@ public class BoxManager extends MiniPlugin
PermissionGroup.PLAYER.setPermission(Perm.BOX_COMMAND, true, true);
}
public void openDyePage(Player player)
{
_shop.openPageForPlayer(player, new DyeBoxPage(this, _shop, "Dye Boxes", player));
}
@EventHandler(priority=EventPriority.HIGHEST)
public void onCraftWithDye(PrepareItemCraftEvent event)
{
@ -184,7 +189,7 @@ public class BoxManager extends MiniPlugin
{
BUILDER_BOX("Clans Builder Box", C.cGold + "Builder's Box", Material.GLOWSTONE, Managers.get(BoxManager.class)._builderBox::open),
@SuppressWarnings("deprecation")
DYE_BOX("Clans Dye Box", C.cGreen + "Dye Box", Material.INK_SACK, DyeColor.RED.getDyeData(), DyeBoxSpinner::createSpinner),
DYE_BOX(null, C.cGreen + "Dye Box", Material.INK_SACK, DyeColor.RED.getDyeData(), Managers.get(BoxManager.class)::openDyePage),
;
private String _itemName, _displayName;
@ -220,6 +225,10 @@ public class BoxManager extends MiniPlugin
public ItemStack getDisplayItem(int owned)
{
ItemBuilder newBuilder = new ItemBuilder(_displayBuilder.build());
if (owned == -1)
{
return newBuilder.build();
}
if (owned > 0)
{
newBuilder.setGlow(true);

View File

@ -3,6 +3,8 @@ package mineplex.game.clans.clans.boxes;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ShopPageBase;
@ -13,7 +15,7 @@ public class BoxOverviewPage extends ShopPageBase<BoxManager, BoxShop>
{
public BoxOverviewPage(BoxManager plugin, BoxShop shop, String name, Player player)
{
super(plugin, shop, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), name, player, 9);
super(plugin, shop, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), name, player, 27);
buildPage();
}
@ -21,16 +23,17 @@ public class BoxOverviewPage extends ShopPageBase<BoxManager, BoxShop>
@Override
protected void buildPage()
{
int[] slots = {3, 5};
int[] slots = {12, 14};
for (int i = 0; i < BoxType.values().length && i < slots.length; i++)
{
BoxType type = BoxType.values()[i];
int slot = slots[i];
final int owns = ClansManager.getInstance().getInventoryManager().Get(getPlayer()).getItemCount(type.getItemName());
final int owns = type.getItemName() == null ? -1 : ClansManager.getInstance().getInventoryManager().Get(getPlayer()).getItemCount(type.getItemName());
IButton button = (player, clickType) ->
{
if (owns < 1)
if (owns != -1 && owns < 1)
{
UtilPlayer.message(player, F.main(getPlugin().getName(), "You do not have enough of that box! Purchase some at http://www.mineplex.com/shop!"));
playDenySound(player);
}
else

View File

@ -10,12 +10,12 @@ public class BoxShop extends ShopBase<BoxManager>
{
public BoxShop(BoxManager plugin)
{
super(plugin, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), "Your Boxes");
super(plugin, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), "Boxes");
}
@Override
protected ShopPageBase<BoxManager, ? extends ShopBase<BoxManager>> buildPagesFor(Player player)
{
return new BoxOverviewPage(getPlugin(), this, "Your Boxes", player);
return new BoxOverviewPage(getPlugin(), this, "Available Boxes", player);
}
}

View File

@ -0,0 +1,109 @@
package mineplex.game.clans.clans.boxes;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
public class DyeBoxPage extends ShopPageBase<BoxManager, BoxShop>
{
private static final List<DyeColor> COMMON_COLORS = Stream.of(DyeColor.values()).filter(c -> c != DyeColor.BLACK && c != DyeColor.WHITE).collect(Collectors.toList());
private static final List<DyeColor> RARE_COLORS = Arrays.asList(DyeColor.WHITE, DyeColor.BLACK);
public DyeBoxPage(BoxManager plugin, BoxShop shop, String name, Player player)
{
super(plugin, shop, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), name, player, 27);
buildPage();
}
@SuppressWarnings("deprecation")
@Override
protected void buildPage()
{
int[] slots = {12, 14};
int i = 0;
for (DyeType type : DyeType.values())
{
int owned = ClansManager.getInstance().getInventoryManager().Get(_player).getItemCount(type.getItemName());
int slot = slots[i++];
addButton(slot, new ItemBuilder(Material.SKULL_ITEM)
.setData((short)3)
.setTitle(C.cRed + (type.isGilded() ? "Gilded " : "") + "Dye Box")
.addLore(C.cYellow + "Open a box containing " + F.greenElem(String.valueOf(type.getDyeCount())) + C.cYellow + " random dyes!")
.addLore(C.cRed + " ")
.addLore(C.cGreen + ">Click to Activate<")
.addLore(C.cBlue + " ")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(Math.max(owned, 0))) + C.cDAqua + (type.isGilded() ? " Gilded" : "") + " Dye Boxes")
.build(),
(player, clickType) ->
{
if (!Recharge.Instance.use(player, "Clans Box Click", 1000, false, false))
{
return;
}
if (owned < 1)
{
playDenySound(player);
UtilPlayer.message(player, F.main(getPlugin().getName(), "You do not have enough of that box! Purchase some at http://www.mineplex.com/shop!"));
return;
}
player.closeInventory();
ClansManager.getInstance().getInventoryManager().addItemToInventory(player, type.getItemName(), -1);
for (int dye = 0; dye < type.getDyeCount(); dye++)
{
List<DyeColor> options = ThreadLocalRandom.current().nextDouble() <= 0.05 ? RARE_COLORS : COMMON_COLORS;
DyeColor color = UtilMath.randomElement(options);
player.getInventory().addItem(new ItemBuilder(Material.INK_SACK).setData(color.getDyeData()).setTitle(C.cGold + "Dye").build());
}
});
}
}
private enum DyeType
{
NORMAL("Clans Dye Box", false, 32),
GILDED("Clans Gilded Dye Box", true, 64)
;
private final String _itemName;
private final boolean _gilded;
private final int _dyeCount;
private DyeType(String itemName, boolean gilded, int dyeCount)
{
_itemName = itemName;
_gilded = gilded;
_dyeCount = dyeCount;
}
public String getItemName()
{
return _itemName;
}
public boolean isGilded()
{
return _gilded;
}
public int getDyeCount()
{
return _dyeCount;
}
}
}

View File

@ -1,172 +0,0 @@
package mineplex.game.clans.clans.boxes.extra;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.boxes.BoxManager.BoxType;
public class DyeBoxSpinner implements Listener
{
private Player _player;
private Inventory _inv;
private int _step;
private List<ItemStack> _items;
private boolean _givenRewards = false;
private DyeBoxSpinner(Player player)
{
_player = player;
_inv = Bukkit.createInventory(player, 27, "Dye Box");
_step = 0;
_items = new ArrayList<>();
buildGUI();
generateRewards();
player.openInventory(_inv);
Bukkit.getPluginManager().registerEvents(this, UtilServer.getPlugin());
}
/**
* Upper and lower bounds are inclusive
*/
private int getRandom(int max, int min)
{
return UtilMath.r(max - min + 1) + min;
}
@SuppressWarnings("deprecation")
private void buildGUI()
{
ItemStack border = new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short)DyeColor.GRAY.getWoolData()).setTitle(C.cRed + " ").build();
ItemStack fill = new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short)DyeColor.BLACK.getWoolData()).setTitle(C.cRed + " ").build();
for (int i = 0; i < 27; i++)
{
if (i < 9 || i > 17)
{
_inv.setItem(i, border);
}
else
{
_inv.setItem(i, fill);
}
}
}
@SuppressWarnings("deprecation")
private void generateRewards()
{
List<DyeColor> commonColors = Arrays.asList(DyeColor.values()).stream().filter(c -> c != DyeColor.BLACK && c != DyeColor.WHITE).collect(Collectors.toList());
List<DyeColor> rareColors = Arrays.asList(DyeColor.WHITE, DyeColor.BLACK);
for (int i = 1; i <= getRandom(9, 5); i++)
{
DyeColor color = null;
if (Math.random() <= 0.05)
{
color = UtilMath.randomElement(rareColors);
}
else
{
color = UtilMath.randomElement(commonColors);
}
_items.add(new ItemBuilder(Material.INK_SACK).setData(color.getDyeData()).setTitle(C.cGold + "Dye").build());
}
}
private void giveRewards()
{
if (_givenRewards)
{
return;
}
_givenRewards = true;
_player.closeInventory();
_items.forEach(_player.getInventory()::addItem);
UtilPlayer.message(_player, F.main("Dye Box", "You have redeemed your box contents!"));
}
@SuppressWarnings("deprecation")
private void progress()
{
if (_step == 0)
{
_step++;
return;
}
if (_step < 10)
{
int slot = 18 - _step;
if (Math.max(18, slot) - Math.min(18, slot) <= _items.size())
{
_inv.setItem(slot, new ItemBuilder(Material.STAINED_GLASS_PANE).setData((short)DyeColor.LIME.getWoolData()).setTitle(C.cRed + " ").build());
}
_step++;
return;
}
if (_step == 10)
{
int slot = 17;
for (int i = 0; i < _items.size(); i++)
{
_inv.setItem(slot, _items.get(i));
slot--;
}
_step++;
return;
}
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.FASTEST)
{
if (_player.getOpenInventory() == null || _player.getOpenInventory().getTopInventory() == null || !_player.getOpenInventory().getTopInventory().getName().equals("Dye Box"))
{
HandlerList.unregisterAll(this);
giveRewards();
}
}
if (event.getType() == UpdateType.SEC)
{
progress();
}
}
@EventHandler
public void onClick(InventoryClickEvent event)
{
if (event.getWhoClicked().getEntityId() == _player.getEntityId())
{
event.setCancelled(true);
}
}
public static void createSpinner(Player player)
{
ClansManager.getInstance().getInventoryManager().addItemToInventory(player, BoxType.DYE_BOX.getItemName(), -1);
new DyeBoxSpinner(player);
}
}

View File

@ -0,0 +1,144 @@
package mineplex.game.clans.clans.cash;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import mineplex.core.Managers;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer;
import mineplex.core.inventory.ClientInventory;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.amplifiers.AmplifierGUI;
import mineplex.game.clans.clans.boxes.BoxManager;
import mineplex.game.clans.clans.boxes.BoxManager.BoxType;
import mineplex.game.clans.clans.supplydrop.SupplyDropManager;
public class CashOverviewPage extends ShopPageBase<CashShopManager, CashShop>
{
private static final int OVERVIEW_BUTTON_SLOT = 13;
private static final int RUNE_BUTTON_SLOT = 21;
private static final int BUILDERS_BUTTON_SLOT = 23;
private static final int SUPPLY_BUTTON_SLOT = 29;
private static final int DYE_BUTTON_SLOT = 31;
private static final int BOSS_BUTTON_SLOT = 33;
private static final int MOUNT_BUTTON_SLOT = 39;
private static final int BANNER_BUTTON_SLOT = 41;
public CashOverviewPage(CashShopManager plugin, CashShop shop, String name, Player player)
{
super(plugin, shop, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), name, player);
buildPage();
}
@Override
protected void buildPage()
{
ClientInventory inv = ClansManager.getInstance().getInventoryManager().Get(getPlayer());
int rune20 = inv.getItemCount("Rune Amplifier 20");
int rune60 = inv.getItemCount("Rune Amplifier 60");
int builders = inv.getItemCount(BoxType.BUILDER_BOX.getItemName());
int supply = inv.getItemCount("Clans Supply Drop");
int supplyGilded = inv.getItemCount("Clans Gilded Supply Drop");
int dye = inv.getItemCount("Clans Dye Box");
int dyeGilded = inv.getItemCount("Clans Gilded Dye Box");
int skeleton = inv.getItemCount("Clans Boss Token Skeleton");
int wizard = inv.getItemCount("Clans Boss Token Wizard");
addButtonNoAction(OVERVIEW_BUTTON_SLOT, new ItemBuilder(Material.SKULL_ITEM)
.setData((short)2)
.setTitle(C.cRed + C.Scramble + "1 " + C.cRed + "Mineplex Shop" + " " + C.Scramble + "1")
.addLore(C.cYellow + "Purchase powerful supply drops, boss summoning items,")
.addLore(C.cYellow + "and exclusive cosmetic items in our online store!")
.addLore(C.cRed + " ")
.addLore(C.cGreen + "http://www.mineplex.com/shop")
.build()
);
addButton(RUNE_BUTTON_SLOT, new ItemBuilder(Material.NETHER_STAR)
.setTitle(C.cRed + "Rune Amplifier")
.addLore(C.cYellow + "Open a portal to the Nether in Shops")
.addLore(C.cYellow + "And double the chances for Rune drops!")
.addLore(C.cRed + " ")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(rune20)) + C.cDAqua + " Twenty Minute Amplifiers")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(rune60)) + C.cDAqua + " One Hour Amplifiers")
.build(),
(player, clickType) ->
{
player.closeInventory();
new AmplifierGUI(player, ClansManager.getInstance().getAmplifierManager());
});
addButton(BUILDERS_BUTTON_SLOT, new ItemBuilder(Material.SKULL_ITEM)
.setTitle(C.cRed + "Builder's Box")
.addLore(C.cYellow + "Transform normal blocks into alternate forms")
.addLore(C.cYellow + "Or otherwise unobtainable cosmetic blocks!")
.addLore(C.cRed + " ")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(builders)) + C.cDAqua + " Builder's Boxes")
.build(),
(player, clickType) ->
{
player.closeInventory();
BoxType.BUILDER_BOX.onUse(player);
});
addButton(SUPPLY_BUTTON_SLOT, new ItemBuilder(Material.ENDER_CHEST)
.setTitle(C.cRed + "Supply Drop")
.addLore(C.cYellow + "Call down Supply Drops to obtain")
.addLore(C.cYellow + "Rare and valuable resources!")
.addLore(C.cRed + " ")
.addLore(C.cYellow + "Use " + C.cGreen + "/inventory" + C.cYellow + " to access Supply Drops")
.addLore(C.cBlue + " ")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(supply)) + C.cDAqua + " Supply Drops")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(supplyGilded)) + C.cDAqua + " Gilded Supply Drops")
.build(),
(player, clickType) ->
{
player.closeInventory();
Managers.get(SupplyDropManager.class).getShop().attemptShopOpen(player);
});
addButton(DYE_BUTTON_SLOT, new ItemBuilder(Material.SKULL_ITEM)
.setData((short)4)
.setTitle(C.cRed + "Dye Box")
.addLore(C.cYellow + "Open a box containing a large amount")
.addLore(C.cYellow + "Of different dyes to use!")
.addLore(C.cRed + " ")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(dye)) + C.cDAqua + " Dye Boxes")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(dyeGilded)) + C.cDAqua + " Gilded Dye Boxes")
.build(),
(player, clickType) ->
{
player.closeInventory();
Managers.get(BoxManager.class).openDyePage(player);
});
addButton(BOSS_BUTTON_SLOT, new ItemBuilder(Material.GOLD_INGOT)
.setTitle(C.cRed + "Boss Summon Token")
.addLore(C.cYellow + "Summon powerful World Bosses to fight")
.addLore(C.cYellow + "Whenever you are most prepared!")
.addLore(C.cRed + " ")
.addLore(C.cYellow + "Use " + C.cGreen + "/inventory" + C.cYellow + " to access Boss Summon Tokens")
.addLore(C.cBlue + " ")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(skeleton)) + C.cDAqua + " Skeleton King Tokens")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(wizard)) + C.cDAqua + " Iron Wizard Tokens")
.build(),
(player, clickType) ->
{
player.closeInventory();
ClansManager.getInstance().getWorldEvent().getShop().attemptShopOpen(player);
});
addButtonNoAction(MOUNT_BUTTON_SLOT, new ItemBuilder(Material.DIAMOND_BARDING)
.setTitle(C.cRed + "Mount Skins")
.addLore(C.cYellow + "Stroll around the map in style!")
.build()
);
addButton(BANNER_BUTTON_SLOT, new ItemBuilder(Material.BANNER)
.setTitle(C.cRed + "Clan Banner")
.addLore(C.cYellow + "Show off your Clan Pride!")
.build(),
(player, clickType) ->
{
player.closeInventory();
UtilServer.CallEvent(new PlayerCommandPreprocessEvent(player, "/banner"));
});
}
}

View File

@ -0,0 +1,21 @@
package mineplex.game.clans.clans.cash;
import org.bukkit.entity.Player;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
public class CashShop extends ShopBase<CashShopManager>
{
public CashShop(CashShopManager manager)
{
super(manager, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), "Cash Shop");
}
@Override
protected ShopPageBase<CashShopManager, ? extends ShopBase<CashShopManager>> buildPagesFor(Player player)
{
return new CashOverviewPage(getPlugin(), this, "Cash Shop", player);
}
}

View File

@ -0,0 +1,42 @@
package mineplex.game.clans.clans.cash;
import org.bukkit.entity.Player;
import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.command.CommandBase;
@ReflectivelyCreateMiniPlugin
public class CashShopManager extends MiniPlugin
{
public enum Perm implements Permission
{
INVENTORY_COMMAND_PERMISSION,
}
private final CashShop _shop;
private CashShopManager()
{
super("Cash Shop");
_shop = new CashShop(this);
addCommand(new CommandBase<CashShopManager>(this, Perm.INVENTORY_COMMAND_PERMISSION, "inventory")
{
public void Execute(Player caller, String[] args)
{
_shop.attemptShopOpen(caller);
}
});
generatePermissions();
}
private void generatePermissions()
{
PermissionGroup.PLAYER.setPermission(Perm.INVENTORY_COMMAND_PERMISSION, true, true);
}
}

View File

@ -48,7 +48,7 @@ public class CustomItemLoot implements ILoot
@Override
public void dropLoot(Location location)
{
location.getWorld().dropItemNaturally(location, getItemStack());
location.getWorld().dropItemNaturally(location.clone().add(0, 3, 0), getItemStack());
}
@Override

View File

@ -23,7 +23,7 @@ public class GoldLoot implements ILoot
public void dropLoot(Location location)
{
int count = _min + UtilMath.r(_max - _min);
_goldManager.dropGold(location, count);
_goldManager.dropGold(location.clone().add(0, 3, 0), count);
}
@Override

View File

@ -36,7 +36,7 @@ public class ItemLoot implements ILoot
{
int count = UtilMath.rRange(_min, _max);
ItemStack item = new ItemStack(_material, count, (short) 0, _data);
location.getWorld().dropItemNaturally(location, item);
location.getWorld().dropItemNaturally(location.clone().add(0, 3, 0), item);
}
@Override

View File

@ -4,10 +4,13 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import mineplex.core.Managers;
import mineplex.core.common.weight.WeightSet;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.mounts.Mount.MountType;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.items.GearManager;
import mineplex.core.common.weight.WeightSet;
import mineplex.game.clans.items.runes.RuneManager;
public class LootManager
{
@ -19,6 +22,7 @@ public class LootManager
private WeightSet<ILoot> _bossSet;
private WeightSet<ILoot> _undeadCitySet;
private WeightSet<ILoot> _raidSet;
private WeightSet<ILoot> _capturePointSet;
public LootManager(GearManager gearManager, GoldManager goldManager)
{
@ -30,12 +34,14 @@ public class LootManager
_bossSet = new WeightSet<>();
_undeadCitySet = new WeightSet<>();
_raidSet = new WeightSet<>();
_capturePointSet = new WeightSet<>();
populateCommon();
populateRare();
populateBoss();
populateCity();
populateRaid();
populateCapturePoint();
}
private void populateCommon()
@ -169,6 +175,58 @@ public class LootManager
_raidSet.add(20, new MountLoot(2, 3, MountType.values()));
}
private void populateCapturePoint()
{
// Food
_capturePointSet.add(5, new ItemLoot(Material.CARROT, 1, 5));
_capturePointSet.add(5, new ItemLoot(Material.APPLE, 1, 3));
_capturePointSet.add(5, new ItemLoot(Material.COOKED_BEEF, 1, 3));
_capturePointSet.add(5, new ItemLoot(Material.RAW_BEEF, 1, 4));
_capturePointSet.add(5, new ItemLoot(Material.POTATO_ITEM, 1, 5));
// Armor
_capturePointSet.add(3, new ItemLoot(Material.IRON_HELMET, 1, 1));
_capturePointSet.add(3, new ItemLoot(Material.IRON_CHESTPLATE, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.IRON_LEGGINGS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.IRON_BOOTS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.GOLD_HELMET, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.GOLD_CHESTPLATE, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.GOLD_LEGGINGS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.GOLD_BOOTS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_HELMET, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_CHESTPLATE, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_LEGGINGS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.LEATHER_BOOTS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_HELMET, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_CHESTPLATE, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_LEGGINGS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.DIAMOND_BOOTS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_HELMET, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_CHESTPLATE, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_LEGGINGS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.CHAINMAIL_BOOTS, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.IRON_AXE, 1, 1));
_capturePointSet.add(4, new ItemLoot(Material.IRON_SWORD, 1, 1));
_capturePointSet.add(3, new ItemLoot(Material.EMERALD, 10, 15));
_capturePointSet.add(2, new CustomItemLoot(Material.GOLD_SWORD, 1, 1, "Booster Sword"));
_capturePointSet.add(2, new CustomItemLoot(Material.GOLD_AXE, 1, 1, "Booster Axe"));
_capturePointSet.add(2, new CustomItemLoot(Material.DIAMOND_SWORD, 1, 1, "Power Sword"));
_capturePointSet.add(2, new CustomItemLoot(Material.DIAMOND_AXE, 1, 1, "Power Axe"));
// Gold
_capturePointSet.add(1, new GoldTokenLoot(50000, 50000));
// Rune
_capturePointSet.add(1, new RuneLoot());
}
public void dropCommon(Location location)
{
_commonSet.generateRandom().dropLoot(location);
@ -194,6 +252,11 @@ public class LootManager
_raidSet.generateRandom().dropLoot(location);
}
public void dropCapturePoint(Location location)
{
_capturePointSet.generateRandom().dropLoot(location);
}
public ItemStack getRareItemStack()
{
return _rareSet.generateRandom().getItemStack();

View File

@ -0,0 +1,44 @@
package mineplex.game.clans.clans.loot;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.items.runes.RuneManager.RuneAttribute;
public class RuneLoot implements ILoot
{
private RuneAttribute[] _types;
public RuneLoot(RuneAttribute... types)
{
if (types.length == 0)
{
_types = RuneAttribute.values();
}
else
{
_types = types;
}
}
@Override
public void dropLoot(Location location)
{
RuneAttribute attribute = UtilMath.randomElement(_types);
ItemStack item = ClansManager.getInstance().getGearManager().getRuneManager().getRune(attribute);
UtilFirework.playFirework(location.clone().add(0, 3, 0), Type.BALL, Color.PURPLE, true, false);
location.getWorld().dropItemNaturally(location.clone().add(0, 3, 0), item);
}
@Override
public ItemStack getItemStack()
{
RuneAttribute attribute = UtilMath.randomElement(_types);
return ClansManager.getInstance().getGearManager().getRuneManager().getRune(attribute);
}
}

View File

@ -16,12 +16,16 @@ import org.bukkit.inventory.ItemStack;
import mineplex.core.common.TriConsumer;
import mineplex.core.common.util.C;
import mineplex.core.common.util.EnclosedObject;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.particles.ColoredParticle;
import mineplex.core.common.util.particles.DustSpellColor;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseCow;
import mineplex.core.disguise.disguises.DisguiseSheep;
import mineplex.core.itemstack.ItemBuilder;
@ -65,6 +69,31 @@ public class Mount
if (_skin != null)
{
_skin.onUpdate(_entity);
if (_skin.needsJumpAssist())
{
EntityPlayer rider = null;
if (_entity.getPassenger() != null && _entity.getPassenger() instanceof Player)
{
rider = ((CraftPlayer)_entity.getPassenger()).getHandle();
try
{
boolean jumping = MountManager.JumpBooleanField.getBoolean(rider);
if (jumping)
{
rider.i(false);
if (UtilEnt.isGrounded(_entity))
{
MountManager.JumpFloatField.setFloat(_entity.getHandle(), 1.0f);
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
}
if (UtilTime.elapsed(_lastHit, HIT_REGEN_COOLDOWN) && _hits > 0)
{
@ -100,53 +129,74 @@ public class Mount
public static enum SkinType
{
INFERNAL_HORROR(1, "Clans Infernal Horror Mount Skin", C.cRed + "Infernal Horror", Material.BONE, Color.BLACK, Variant.SKELETON_HORSE, Style.BLACK_DOTS, horse -> {}, horse ->
INFERNAL_HORROR(1, "Clans Infernal Horror Mount Skin", C.cRed + "Infernal Horror", Material.BONE, Color.BLACK, Variant.SKELETON_HORSE, Style.BLACK_DOTS, false, horse -> {}, horse ->
{
UtilParticle.PlayParticleToAll(ParticleType.FLAME, horse.getLocation().add(0, 1, 0),
0.25f, 0.25f, 0.25f, 0, 2,ViewDist.NORMAL);
}, MountType.HORSE),
GLACIAL_STEED(2, "Clans Glacial Steed Mount Skin", C.cGray + "Glacial Steed", Material.SNOW_BALL, Color.WHITE, Variant.HORSE, Style.WHITE, horse -> {}, horse ->
GLACIAL_STEED(2, "Clans Glacial Steed Mount Skin", C.cGray + "Glacial Steed", Material.SNOW_BALL, Color.WHITE, Variant.HORSE, Style.WHITE, false, horse -> {}, horse ->
{
UtilParticle.PlayParticleToAll(ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0),
0.25f, 0.25f, 0.25f, 0.1f, 4, ViewDist.NORMAL);
}, MountType.HORSE),
ZOMBIE_HORSE(3, "Clans Zombie Horse Mount Skin", C.cDGray + "Zombie Horse", Material.ROTTEN_FLESH, Color.BLACK, Variant.UNDEAD_HORSE, Style.BLACK_DOTS, horse -> {}, horse ->
ZOMBIE_HORSE(3, "Clans Zombie Horse Mount Skin", C.cDGray + "Zombie Horse", Material.ROTTEN_FLESH, Color.BLACK, Variant.UNDEAD_HORSE, Style.BLACK_DOTS, false, horse -> {}, horse ->
{
UtilParticle.PlayParticleToAll(ParticleType.FOOTSTEP, horse.getLocation(),
null, 0, 1, ViewDist.NORMAL);
}, MountType.HORSE),
@SuppressWarnings("deprecation")
RAINBOW_SHEEP(4, "Clans Rainbow Sheep Mount Skin", C.cGreen + "Rainbow " + C.cAqua + "Sheep", new ItemBuilder(Material.WOOL).setData(DyeColor.RED.getWoolData()).build(),Color.WHITE, Variant.HORSE, Style.NONE, horse ->
RAINBOW_SHEEP(4, "Clans Rainbow Sheep Mount Skin", C.cGreen + "Rainbow " + C.cAqua + "Sheep", new ItemBuilder(Material.WOOL).setData(DyeColor.RED.getWoolData()).build(),Color.WHITE, Variant.HORSE, Style.NONE, true, horse ->
{
DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.setName("jeb_");
disguise.setName(horse.getCustomName());
ClansManager.getInstance().getDisguiseManager().disguise(disguise);
UtilEnt.SetMetadata(horse, "RainbowSheep.ActiveTicks", new EnclosedObject<>(0));
UtilEnt.SetMetadata(horse, "RainbowSheep.DelayTicks", new EnclosedObject<>(0));
UtilEnt.SetMetadata(horse, "RainbowSheep.ParticleColor", new EnclosedObject<>(java.awt.Color.RED));
}, horse ->
{
EntityPlayer rider = null;
if (horse.getPassenger() != null && horse.getPassenger() instanceof Player)
EnclosedObject<Integer> activeTicks = null;
EnclosedObject<Integer> delayTicks = null;
EnclosedObject<java.awt.Color> color = UtilEnt.GetMetadata(horse, "RainbowSheep.ParticleColor");
if ((activeTicks = UtilEnt.GetMetadata(horse, "RainbowSheep.ActiveTicks")) != null && (delayTicks = UtilEnt.GetMetadata(horse, "RainbowSheep.DelayTicks")) != null)
{
rider = ((CraftPlayer)horse.getPassenger()).getHandle();
try
DisguiseBase base = ClansManager.getInstance().getDisguiseManager().getActiveDisguise(horse);
if (base instanceof DisguiseSheep && (delayTicks.Get() % 10) == 0)
{
boolean jumping = MountManager.JumpBooleanField.getBoolean(rider);
DisguiseSheep sheep = (DisguiseSheep) base;
int mod = activeTicks.Get() % 4;
activeTicks.Set(activeTicks.Get() + 1);
if (jumping)
if (mod == 0)
{
rider.i(false);
if (UtilEnt.isGrounded(horse))
{
MountManager.JumpFloatField.setFloat(horse.getHandle(), 1.0f);
}
sheep.setColor(DyeColor.RED);
color.Set(java.awt.Color.RED);
}
else if (mod == 1)
{
sheep.setColor(DyeColor.YELLOW);
color.Set(java.awt.Color.YELLOW);
}
else if (mod == 2)
{
sheep.setColor(DyeColor.GREEN);
color.Set(java.awt.Color.GREEN);
}
else if (mod == 3)
{
sheep.setColor(DyeColor.BLUE);
color.Set(java.awt.Color.BLUE);
}
ClansManager.getInstance().getDisguiseManager().updateDisguise(base);
}
catch (Exception ex)
{
ex.printStackTrace();
}
delayTicks.Set(delayTicks.Get() + 1);
}
ColoredParticle particle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST,
new DustSpellColor(color.Get()), horse.getLocation().add(0, 1, 0));
particle.display(3);
}, MountType.HORSE),
ROYAL_STEED(5, "Clans Royal Steed Mount Skin", C.cGold + "Royal Steed", Material.DIAMOND_BARDING, Color.WHITE, Variant.HORSE, Style.WHITE, horse ->
ROYAL_STEED(5, "Clans Royal Steed Mount Skin", C.cGold + "Royal Steed", Material.DIAMOND_BARDING, Color.WHITE, Variant.HORSE, Style.WHITE, false, horse ->
{
horse.getInventory().setArmor(new ItemBuilder(Material.DIAMOND_BARDING).setTitle(C.cGoldB + "Royal Armor").build());
}, horse ->
@ -154,7 +204,7 @@ public class Mount
UtilParticle.PlayParticleToAll(ParticleType.BLOCK_DUST.getParticle(Material.GOLD_BLOCK, 0), horse.getLocation().add(0, 1, 0),
0.25f, 0.25f, 0.25f, 0, 3, ViewDist.NORMAL);
}, MountType.HORSE),
ROYAL_GUARD_STEED(6, "Clans Royal Guard Steed Mount Skin", C.cGray + "Royal Guard's Steed", Material.GOLD_BARDING, Color.BLACK, Variant.HORSE, Style.NONE, horse ->
ROYAL_GUARD_STEED(6, "Clans Royal Guard Steed Mount Skin", C.cGray + "Royal Guard's Steed", Material.GOLD_BARDING, Color.BLACK, Variant.HORSE, Style.NONE, false, horse ->
{
horse.getInventory().setArmor(new ItemBuilder(Material.GOLD_BARDING).setTitle(C.cGoldB + "Guardian Armor").build());
}, horse ->
@ -162,7 +212,7 @@ public class Mount
UtilParticle.PlayParticleToAll(ParticleType.BLOCK_DUST.getParticle(Material.IRON_BLOCK, 0), horse.getLocation().add(0, 1, 0),
0.25f, 0.25f, 0.25f, 0, 3, ViewDist.NORMAL);
}, MountType.HORSE),
KNIGHT_STEED(7, "Clans Knight Steed Mount Skin", C.cDRed + "Knight's Steed", Material.IRON_BARDING, Color.GRAY, Variant.HORSE, Style.NONE, horse ->
KNIGHT_STEED(7, "Clans Knight Steed Mount Skin", C.cDRed + "Knight's Steed", Material.IRON_BARDING, Color.GRAY, Variant.HORSE, Style.NONE, false, horse ->
{
horse.getInventory().setArmor(new ItemBuilder(Material.IRON_BARDING).setTitle(C.cGoldB + "Knightly Armor").build());
}, horse ->
@ -170,67 +220,19 @@ public class Mount
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.APPLE, 0), horse.getLocation().add(0, 1, 0),
0.25f, 0.25f, 0.25f, 0, 3, ViewDist.NORMAL);
}, MountType.HORSE),
COW(8, "Clans Cow Mount Skin", C.cWhite + "Cow", Material.MILK_BUCKET, Color.WHITE, Variant.HORSE, Style.NONE, horse ->
COW(8, "Clans Cow Mount Skin", C.cWhite + "Cow", Material.MILK_BUCKET, Color.WHITE, Variant.HORSE, Style.NONE, true, horse ->
{
DisguiseCow disguise = new DisguiseCow(horse);
disguise.setName(horse.getCustomName());
ClansManager.getInstance().getDisguiseManager().disguise(disguise);
}, horse ->
{
EntityPlayer rider = null;
if (horse.getPassenger() != null && horse.getPassenger() instanceof Player)
{
rider = ((CraftPlayer)horse.getPassenger()).getHandle();
try
{
boolean jumping = MountManager.JumpBooleanField.getBoolean(rider);
if (jumping)
{
rider.i(false);
if (UtilEnt.isGrounded(horse))
{
MountManager.JumpFloatField.setFloat(horse.getHandle(), 1.0f);
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}, MountType.HORSE),
SHEEP(9, "Clans Sheep Mount Skin", C.cWhite + "Sheep", Material.WOOL, Color.WHITE, Variant.HORSE, Style.NONE, horse ->
}, horse -> {}, MountType.HORSE),
SHEEP(9, "Clans Sheep Mount Skin", C.cWhite + "Sheep", Material.WOOL, Color.WHITE, Variant.HORSE, Style.NONE, true, horse ->
{
DisguiseSheep disguise = new DisguiseSheep(horse);
disguise.setName(horse.getCustomName());
ClansManager.getInstance().getDisguiseManager().disguise(disguise);
}, horse ->
{
EntityPlayer rider = null;
if (horse.getPassenger() != null && horse.getPassenger() instanceof Player)
{
rider = ((CraftPlayer)horse.getPassenger()).getHandle();
try
{
boolean jumping = MountManager.JumpBooleanField.getBoolean(rider);
if (jumping)
{
rider.i(false);
if (UtilEnt.isGrounded(horse))
{
MountManager.JumpFloatField.setFloat(horse.getHandle(), 1.0f);
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}, MountType.HORSE),
TRUSTY_MULE(10, "Clans Trusty Mule Mount Skin", C.cBlue + "Trusty Mule", Material.APPLE, Color.BROWN, Variant.MULE, Style.NONE, horse -> {}, horse -> {}, MountType.DONKEY)
}, horse -> {}, MountType.HORSE),
TRUSTY_MULE(10, "Clans Trusty Mule Mount Skin", C.cBlue + "Trusty Mule", Material.APPLE, Color.BROWN, Variant.MULE, Style.NONE, false, horse -> {}, horse -> {}, MountType.DONKEY)
;
private final int _id;
@ -240,15 +242,16 @@ public class Mount
private final Color _color;
private final Variant _variant;
private final Style _style;
private final boolean _needsJumpAssist;
private final Consumer<CraftHorse> _onSpawn, _onUpdate;
private final MountType[] _possibleTypes;
private SkinType(int id, String packageName, String displayName, Material displayType, Color color, Variant variant, Style style, Consumer<CraftHorse> onSpawn, Consumer<CraftHorse> onUpdate, MountType... possibleTypes)
private SkinType(int id, String packageName, String displayName, Material displayType, Color color, Variant variant, Style style, boolean needsJumpAssist, Consumer<CraftHorse> onSpawn, Consumer<CraftHorse> onUpdate, MountType... possibleTypes)
{
this(id, packageName, displayName, new ItemStack(displayType), color, variant, style, onSpawn, onUpdate, possibleTypes);
this(id, packageName, displayName, new ItemStack(displayType), color, variant, style, needsJumpAssist, onSpawn, onUpdate, possibleTypes);
}
private SkinType(int id, String packageName, String displayName, ItemStack baseDisplayItem, Color color, Variant variant, Style style, Consumer<CraftHorse> onSpawn, Consumer<CraftHorse> onUpdate, MountType... possibleTypes)
private SkinType(int id, String packageName, String displayName, ItemStack baseDisplayItem, Color color, Variant variant, Style style, boolean needsJumpAssist, Consumer<CraftHorse> onSpawn, Consumer<CraftHorse> onUpdate, MountType... possibleTypes)
{
_id = id;
_packageName = packageName;
@ -257,6 +260,7 @@ public class Mount
_color = color;
_variant = variant;
_style = style;
_needsJumpAssist = needsJumpAssist;
_onSpawn = onSpawn;
_onUpdate = onUpdate;
_possibleTypes = possibleTypes;
@ -297,6 +301,11 @@ public class Mount
return _style;
}
public boolean needsJumpAssist()
{
return _needsJumpAssist;
}
public void onSpawn(CraftHorse horse)
{
_onSpawn.accept(horse);

View File

@ -1,4 +1,4 @@
package mineplex.game.clans.clans.supplyDrop;
package mineplex.game.clans.clans.supplydrop;
import java.lang.reflect.Field;
import java.util.concurrent.ThreadLocalRandom;
@ -11,6 +11,8 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.Chest;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@ -18,12 +20,13 @@ import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.HologramManager;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.supplyDrop.SupplyDropManager.SupplyDropType;
import mineplex.game.clans.clans.supplydrop.SupplyDropManager.SupplyDropType;
import net.minecraft.server.v1_8_R3.BlockPosition;
import net.minecraft.server.v1_8_R3.TileEntity;
import net.minecraft.server.v1_8_R3.TileEntityBeacon;
@ -48,12 +51,12 @@ public class SupplyDrop
}
}
private static final int DROP_TICKS = 20 * 10;
private static final int DROP_TICKS = 20 * 60 * 3; //3 Minutes
private static final int REMOVE_TICKS = DROP_TICKS + (20 * 120); // 2 Minutes
public static final Material SUPPLY_DROP_MATERIAL = Material.BEACON;
private final SupplyDropType _type;
private final mineplex.game.clans.clans.supplyDrop.SupplyDropManager.BlockPosition _position;
private final mineplex.game.clans.clans.supplydrop.SupplyDropManager.BlockPosition _position;
private final Block _block;
private final Block[] _below = new Block[9];
@SuppressWarnings("unchecked")
@ -66,11 +69,15 @@ public class SupplyDrop
protected SupplyDrop(SupplyDropType type, Block block, HologramManager hologramManager)
{
_type = type;
_position = new mineplex.game.clans.clans.supplyDrop.SupplyDropManager.BlockPosition(block);
_position = new mineplex.game.clans.clans.supplydrop.SupplyDropManager.BlockPosition(block);
_block = block;
_ticks = 0;
_ended = false;
_hologram = new Hologram(hologramManager, _block.getLocation().add(0.5, 1.5, 0.5));
_hologram.setInteraction((player, clickType) ->
{
UtilServer.CallEvent(new PlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, player.getItemInHand(), _block, _block.getFace(player.getLocation().getBlock())));
});
_hologram.start();
block.setType(SUPPLY_DROP_MATERIAL);
@ -139,7 +146,7 @@ public class SupplyDrop
return _block.getChunk();
}
public mineplex.game.clans.clans.supplyDrop.SupplyDropManager.BlockPosition getPosition()
public mineplex.game.clans.clans.supplydrop.SupplyDropManager.BlockPosition getPosition()
{
return _position;
}
@ -217,10 +224,10 @@ public class SupplyDrop
{
_ended = true;
_hologram.stop();
_block.breakNaturally(null);
for (int i = 0; i < 9; i++)
{
_below[i].setTypeIdAndData(_oldBelow[i].getLeft().getId(), _oldBelow[i].getRight(), false);
}
_block.breakNaturally();
}
}

View File

@ -1,4 +1,4 @@
package mineplex.game.clans.clans.supplyDrop;
package mineplex.game.clans.clans.supplydrop;
import java.util.Objects;
@ -26,11 +26,19 @@ import mineplex.game.clans.clans.ClansManager;
public class SupplyDropManager extends MiniPlugin
{
private SupplyDrop _active = null;
private final Block _dropBlock = Bukkit.getWorld("world").getBlockAt(0, 0, 0);
private final Block _dropBlock = Bukkit.getWorld("world").getBlockAt(-31, 55, -7);
private final SupplyDropShop _shop;
public SupplyDropManager(JavaPlugin plugin)
{
super("Supply Drop", plugin);
_shop = new SupplyDropShop(this);
}
public SupplyDropShop getShop()
{
return _shop;
}
@EventHandler
@ -55,10 +63,6 @@ public class SupplyDropManager extends MiniPlugin
@EventHandler
public void cancelInteract(PlayerInteractEvent event)
{
if (UtilPlayer.isSpectator(event.getPlayer()) || event.getPlayer().getGameMode() == GameMode.CREATIVE)
{
return;
}
if (!event.hasBlock())
{
return;
@ -78,6 +82,10 @@ public class SupplyDropManager extends MiniPlugin
if (new BlockPosition(event.getClickedBlock()).equals(_active.getPosition()))
{
event.setCancelled(true);
if (UtilPlayer.isSpectator(event.getPlayer()) || event.getPlayer().getGameMode() != GameMode.SURVIVAL)
{
return;
}
_active.finish();
_active = null;
}
@ -189,8 +197,8 @@ public class SupplyDropManager extends MiniPlugin
public static enum SupplyDropType
{
NORMAL("Clans Supply Drop", C.cGray + "Supply Drop", 5, 15),
GILDED("Clans Gilded Supply Drop", C.cGoldB + "Gilded Supply Drop", 20, 25);
NORMAL("Clans Supply Drop", "Supply Drop", 5, 15),
GILDED("Clans Gilded Supply Drop", "Gilded Supply Drop", 20, 25);
private final String _item, _display;
private final int _min, _max;

View File

@ -0,0 +1,68 @@
package mineplex.game.clans.clans.supplydrop;
import java.util.ArrayList;
import java.util.Arrays;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.supplydrop.SupplyDropManager.SupplyDropType;
public class SupplyDropPage extends ShopPageBase<SupplyDropManager, SupplyDropShop>
{
public SupplyDropPage(SupplyDropManager plugin, SupplyDropShop shop, String name, Player player)
{
super(plugin, shop, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), name, player, 27);
buildPage();
}
@Override
protected void buildPage()
{
int[] slots = {12, 14};
int i = 0;
for (SupplyDropType type : SupplyDropType.values())
{
int owned = getPlugin().getAmountOwned(getPlayer(), type);
int slot = slots[i++];
addButton(slot, new ItemBuilder(SupplyDrop.SUPPLY_DROP_MATERIAL)
.setTitle(C.cRed + type.getDisplayName())
.addLore(C.cYellow + "Open a Supply Drop containing powerful items!")
.addLore(C.cRed + " ")
.addLore(C.cGreen + ">Click to Activate<")
.addLore(C.cBlue + " ")
.addLore(C.cDAqua + "You own " + F.greenElem(String.valueOf(Math.max(owned, 0))) + C.cDAqua + " " + type.getDisplayName() + "s")
.addLores(type == SupplyDropType.GILDED ? Arrays.asList(C.cGreen + " ", C.cYellow + "Gilded Supply Drops contain better items!") : new ArrayList<>())
.build(),
(player, clickType) ->
{
if (!Recharge.Instance.use(player, "Clans Box Click", 1000, false, false))
{
return;
}
if (owned < 1)
{
playDenySound(player);
UtilPlayer.message(player, F.main(getPlugin().getName(), "You do not have enough of that Supply Drop! Purchase some at http://www.mineplex.com/shop!"));
return;
}
if (getPlugin().hasActiveSupplyDrop())
{
playDenySound(player);
UtilPlayer.message(player, F.main(getPlugin().getName(), "There is already a Supply Drop dropping! Try again later!"));
return;
}
SupplyDropManager manager = getPlugin();
player.closeInventory();
manager.useSupplyDrop(player, type);
});
}
}
}

View File

@ -0,0 +1,21 @@
package mineplex.game.clans.clans.supplydrop;
import org.bukkit.entity.Player;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
public class SupplyDropShop extends ShopBase<SupplyDropManager>
{
public SupplyDropShop(SupplyDropManager plugin)
{
super(plugin, ClansManager.getInstance().getClientManager(), ClansManager.getInstance().getDonationManager(), "Supply Drop");
}
@Override
protected ShopPageBase<SupplyDropManager, ? extends ShopBase<SupplyDropManager>> buildPagesFor(Player player)
{
return new SupplyDropPage(getPlugin(), this, "Supply Drops", player);
}
}

View File

@ -1,4 +1,4 @@
package mineplex.game.clans.clans.tntGenerator;
package mineplex.game.clans.clans.tntgenerator;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package mineplex.game.clans.clans.tntGenerator;
package mineplex.game.clans.clans.tntgenerator;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;

View File

@ -26,6 +26,7 @@ import mineplex.core.thereallyoldscoreboardapiweshouldremove.elements.Scoreboard
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.bosstoken.BossTokenShop;
import mineplex.game.clans.clans.loot.LootManager;
import mineplex.game.clans.clans.regions.ClansRegions;
import mineplex.game.clans.clans.worldevent.api.EventState;
@ -58,6 +59,8 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
private RaidManager _raidManager;
private BossTokenShop _shop;
public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager, LootManager lootManager, BlockRestore blockRestore, ClansRegions clansRegions)
{
super("World Event", plugin);
@ -71,6 +74,8 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
_blockRestore = blockRestore;
_runningEvents = new LinkedList<>();
_shop = new BossTokenShop(this);
new Blood(plugin);
_raidManager = new RaidManager(plugin);
@ -103,16 +108,27 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
_raidManager.onDisable();
}
public boolean isInEvent(Location location)
public boolean isInEvent(Location location, boolean icePrisonCheck)
{
for (WorldEvent event : _runningEvents)
{
event.isInBounds(location, true);
if (event.isInBounds(location, true))
{
if (!icePrisonCheck || !event.allowsIcePrison())
{
return true;
}
}
}
return false;
}
public BossTokenShop getShop()
{
return _shop;
}
@EventHandler
public void update(UpdateEvent event)
{

View File

@ -108,6 +108,11 @@ public abstract class WorldEvent implements Listener, ScoreboardElement
_difficulty = difficulty;
}
public boolean allowsIcePrison()
{
return false;
}
public Location getCenterLocation()
{
return _arena.getCenterLocation();

View File

@ -14,6 +14,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.recharge.Recharge;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.worldevent.WorldEventManager;
import mineplex.game.clans.clans.worldevent.api.EventState;
import mineplex.game.clans.clans.worldevent.api.WorldEvent;
@ -39,10 +40,10 @@ public class CapturePointEvent extends WorldEvent
Block set = getCenterLocation().getBlock().getRelative(BlockFace.DOWN);
_resetData = Pair.create(set.getType(), set.getData());
set.setType(Material.BEACON);
double minX = (getCenterLocation().getBlockX() + 0.5) - 2;
double maxX = (getCenterLocation().getBlockX() + 0.5) + 2;
double minZ = (getCenterLocation().getBlockZ() + 0.5) - 2;
double maxZ = (getCenterLocation().getBlockZ() + 0.5) + 2;
double minX = (getCenterLocation().getBlockX() + 0.5) - 4.5;
double maxX = (getCenterLocation().getBlockX() + 0.5) + 4.5;
double minZ = (getCenterLocation().getBlockZ() + 0.5) - 4.5;
double maxZ = (getCenterLocation().getBlockZ() + 0.5) + 4.5;
double minY = getCenterLocation().getBlockY() + 1;
double maxY = getCenterLocation().getBlockY() + 4;
_boundary = new PointBoundary(minX, maxX, minZ, maxZ, minY, maxY);
@ -104,6 +105,10 @@ public class CapturePointEvent extends WorldEvent
if (_winner != null)
{
announceMessage(F.name(_winner.getName()) + " has captured the point!");
for (int i = 0; i < 6; i++)
{
ClansManager.getInstance().getLootManager().dropCapturePoint(_winner.getLocation());
}
}
else
{

View File

@ -7,6 +7,11 @@ import org.bukkit.World;
public enum CapturePointLocation
{
ONE(1075, 67, -456),
TWO(636, 65, 1102),
THREE(-1140, 57, -163),
FOUR(-636, 66, -948),
FIVE(-75, 51, -1004),
;
private final double _x, _y, _z;

View File

@ -2,6 +2,7 @@ package mineplex.game.clans.clans.worldevent.undead;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@ -18,11 +19,12 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.worldevent.WorldEventManager;
import mineplex.game.clans.clans.worldevent.api.EventState;
import mineplex.game.clans.clans.worldevent.api.WorldEvent;
@ -39,18 +41,24 @@ public class UndeadCity extends WorldEvent
public UndeadCity(WorldEventManager manager)
{
super("Undead City", UndeadCityLocation.getRandomLocation().toLocation(UtilWorld.getWorld("world")), 20, true, manager.getDisguiseManager(), manager.getClans().getProjectile(), manager.getDamage(), manager.getBlockRestore(), manager.getClans().getCondition());
super("Undead City", UndeadCityLocation.getRandomLocation().toLocation(UtilWorld.getWorld("world")), 55, true, manager.getDisguiseManager(), manager.getClans().getProjectile(), manager.getDamage(), manager.getBlockRestore(), manager.getClans().getCondition());
_maxChests = UndeadCityLocation.getLastLocation().getMaxChests();
_maxMobs = UndeadCityLocation.getLastLocation().getMaxMobs();
}
@Override
public boolean allowsIcePrison()
{
return true;
}
@Override
protected void customStart()
{
int addedChests = 0;
int addedMobs = 0;
for (Block block : UtilBlock.getInRadius(getCenterLocation(), 20).keySet())
for (Block block : UtilBlock.getInRadius(getCenterLocation(), 55).keySet())
{
if (block.getType() == Material.ENDER_CHEST)
{
@ -58,20 +66,24 @@ public class UndeadCity extends WorldEvent
CityChest chest = new CityChest(block, addedChests++ < _maxChests);
_chests.put(position, chest);
}
if (block.getType() == Material.SOUL_SAND)
}
for (int i = 0; i < (_maxMobs + 10); i++)
{
Location loc = ClansManager.getInstance().getWorldEvent().getTerrainFinder().locateSpace(getCenterLocation(), 55, 0, 3, 0, false, true, new HashSet<>());
if (loc == null)
{
Location loc = block.getLocation().add(0.5, 1, 0.5);
_spawnSpots.add(loc);
if (addedMobs++ < _maxMobs)
continue;
}
_spawnSpots.add(loc);
if (addedMobs++ < _maxMobs)
{
if (ThreadLocalRandom.current().nextInt(2) == 0)
{
if (ThreadLocalRandom.current().nextInt(2) == 0)
{
registerCreature(new UndeadArcher(this, loc));
}
else
{
registerCreature(new UndeadWarrior(this, loc));
}
registerCreature(new UndeadArcher(this, loc));
}
else
{
registerCreature(new UndeadWarrior(this, loc));
}
}
}
@ -87,7 +99,7 @@ public class UndeadCity extends WorldEvent
return;
}
_chests.values().forEach(CityChest::update);
if (UtilTime.elapsed(_lastSpawn, 15000) && getCreatures().size() < _maxMobs)
if (UtilTime.elapsed(_lastSpawn, 15000) && getCreatures().size() < Math.min(_maxMobs, _spawnSpots.size()))
{
Location loc = UtilMath.randomElement(_spawnSpots);
if (ThreadLocalRandom.current().nextInt(2) == 0)

View File

@ -7,6 +7,7 @@ import org.bukkit.World;
public enum UndeadCityLocation
{
CITY(92, 68, 1181, 30, 45)
;
private static UndeadCityLocation _lastLocation;

View File

@ -65,7 +65,7 @@ public class GoldCommand extends CommandBase<GoldManager>
{
if (!success)
{
UtilPlayer.message(caller, F.main("Gold", "You cannot deduct that much " + F.elem("Gold") + "from " + F.name(targetName) + "."));
UtilPlayer.message(caller, F.main("Gold", "You cannot deduct that much " + F.elem("Gold") + " from " + F.name(targetName) + "."));
return;
}
UtilPlayer.message(caller, F.main("Gold", "You gave " + F.elem(gold + " Gold") + " to " + F.name(targetName) + "."));

View File

@ -268,7 +268,7 @@ public class Gameplay extends MiniPlugin
return;
}
if (_clansManager.getWorldEvent().isInEvent(event.getClickedBlock().getLocation()))
if (_clansManager.getWorldEvent().isInEvent(event.getClickedBlock().getLocation(), false))
{
return;
}
@ -310,7 +310,7 @@ public class Gameplay extends MiniPlugin
{
return;
}
if (_clansManager.getWorldEvent().isInEvent(event.getBlock().getLocation()))
if (_clansManager.getWorldEvent().isInEvent(event.getBlock().getLocation(), false))
{
return;
}

View File

@ -6,6 +6,7 @@ import java.util.LinkedList;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.server.ServerCommandEvent;
@ -196,6 +197,11 @@ public class RestartManager extends MiniPlugin
String command = event.getCommand().toLowerCase().trim();
if (command.equals("stop") || command.startsWith("stop "))
{
if (UtilServer.isTestServer() && command.endsWith(" -f"))
{
return;
}
event.setCancelled(true);
if (_restarting || _restartTime != -1)
@ -207,6 +213,44 @@ public class RestartManager extends MiniPlugin
}
}
@EventHandler
public void onShutdownCommand(PlayerCommandPreprocessEvent event)
{
String command = event.getMessage().toLowerCase().trim();
if (command.startsWith("/") && command.length() > 1)
{
command = command.substring(1);
}
else
{
return;
}
if (!command.equals("stop") && !command.startsWith("stop "))
{
return;
}
if (!event.getPlayer().isOp() && !event.getPlayer().hasPermission("bukkit.command.stop"))
{
return;
}
if (UtilServer.isTestServer() && command.endsWith(" -f"))
{
return;
}
event.setCancelled(true);
if (_restarting || _restartTime != -1)
{
return;
}
restart();
}
@EventHandler
public void checkRestart(UpdateEvent event)
{

View File

@ -7,8 +7,8 @@ import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.tntGenerator.TntGenerator;
import mineplex.game.clans.clans.tntGenerator.TntGeneratorManager;
import mineplex.game.clans.clans.tntgenerator.TntGenerator;
import mineplex.game.clans.clans.tntgenerator.TntGeneratorManager;
import mineplex.game.clans.economy.GoldManager;
import mineplex.game.clans.shop.ClansShopItem;
import org.bukkit.Material;

View File

@ -0,0 +1,70 @@
package mineplex.clanshub;
import org.bukkit.Bukkit;
import org.bukkit.entity.Entity;
import org.bukkit.event.EventHandler;
import mineplex.core.Managers;
import mineplex.core.MiniPlugin;
import mineplex.core.ReflectivelyCreateMiniPlugin;
import mineplex.core.common.skin.SkinData;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.npc.NpcManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ReflectivelyCreateMiniPlugin
public class ClansHubFunManager extends MiniPlugin
{
private Entity _melon;
private Entity _meep;
private final NpcManager _npc;
private final DisguiseManager _disguise;
private ClansHubFunManager()
{
super("Clans Hub Fun");
_npc = Managers.get(NpcManager.class);
_disguise = Managers.get(DisguiseManager.class);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.TWOSEC)
{
if (_melon == null || _melon.isDead() || !_melon.isValid())
{
_melon = _npc.getNpcByName("Melonboy").getEntity();
if (_melon != null && !_melon.isDead() && _melon.isValid())
{
DisguisePlayer disguise = new DisguisePlayer(_melon, "Melonboy", SkinData.MELON_PERSON);
_disguise.disguise(disguise);
}
}
if (_meep == null || _meep.isDead() || !_meep.isValid())
{
_meep = _npc.getNpcByName("Meepman").getEntity();
if (_meep != null && !_meep.isDead() && _meep.isValid())
{
DisguisePlayer disguise = new DisguisePlayer(_melon, "Meepman", SkinData.MELON_PERSON);
_disguise.disguise(disguise);
}
}
Bukkit.getOnlinePlayers().forEach(player ->
{
if (Recharge.Instance.use(player, "Clans Fun Notify", 15000, false, false))
{
UtilPlayer.message(player, C.cGold + "");
}
});
}
}
}

View File

@ -1,5 +1,6 @@
package mineplex.clanshub;
import java.lang.reflect.Field;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
@ -7,17 +8,23 @@ import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin;
import com.google.common.collect.Lists;
import com.mineplex.ProtocolVersion;
import mineplex.clanshub.queue.HubQueueManager;
import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.account.permissions.Permission;
import mineplex.core.account.permissions.PermissionGroup;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.donation.DonationManager;
import mineplex.core.npc.event.NpcDamageByEntityEvent;
@ -43,6 +50,24 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
STAFF_PAGE,
ALLOW_HARDCORE,
}
private static final int[] PERMITTED_VERSIONS = {ProtocolVersion.v1_8, ProtocolVersion.v1_12, ProtocolVersion.v1_12_1};
private static final Map<Integer, String> VERSION_NAMES = new HashMap<>();
static
{
for (Field field : ProtocolVersion.class.getFields())
{
try
{
int protocol = field.getInt(null);
String version = field.getName().replace("v", "").replace("_", ".");
VERSION_NAMES.put(protocol, version);
}
catch (ReflectiveOperationException ex) {}
}
}
private static final long SERVER_RELOAD_INTERVAL = 5000;
private PartyManager _party;
@ -73,6 +98,22 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
PermissionGroup.CONTENT.setPermission(Perm.ALLOW_HARDCORE, true, true);
}
private boolean checkCanJoinClans(Player player)
{
int protocol = ((CraftPlayer)player).getHandle().getProtocol();
if (ArrayUtils.contains(PERMITTED_VERSIONS, protocol))
{
return true;
}
UtilPlayer.message(player, F.main(getName(), "Minecraft Version " + VERSION_NAMES.get(protocol) + " is not supported on Mineplex Clans.\n"
+ C.cGray + "Please change your Minecraft version to 1.8.8 or 1.12+ and reconnect!\n"
+ C.cGray + "Don't know how to change your Minecraft version? Read Here:\n"
+ C.cGreen + "http://www.mineplex.com/JOSH_URL_HERE"));
return false;
}
/**
* Gets the stored party manager
* @return The stored party manager
@ -172,7 +213,10 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
{
if (event.getNpc().getName().contains("Clans"))
{
_serverShop.attemptShopOpen(event.getPlayer());
if (checkCanJoinClans(event.getPlayer()))
{
_serverShop.attemptShopOpen(event.getPlayer());
}
}
if (event.getNpc().getName().contains("Return"))
{
@ -191,7 +235,10 @@ public class ClansTransferManager extends MiniDbClientPlugin<SimpleClanToken>
if (event.getNpc().getName().contains("Clans") && Recharge.Instance.use(player, "Go to Clans", 1000, false, false))
{
_serverShop.attemptShopOpen(player);
if (checkCanJoinClans(player))
{
_serverShop.attemptShopOpen(player);
}
}
if (event.getNpc().getName().contains("Return") && Recharge.Instance.use(player, "Return to Mineplex", 1000, false, false))
{