Cosmetic Update

New:
+ New GUI System
+ Candy Cane Particle
+ Candy Cane Double Jump
+ Candy Cane Death Effect
+ Candy Cane Arrow Trail
+ Snowman Morph
+ Baby Reindeer Mount
+ Pet Coal Apparition

Fixed/Updated:
* Added getTick to UpdateEvent and UtilTime
* Added more methods to UtilParticle
* Gadget manager isMoving now counts flying as moving
* Updated some cosmetics
This commit is contained in:
xGamingDudex 2015-12-07 02:53:14 +01:00
parent 49c735e43c
commit c36182b8d4
43 changed files with 1132 additions and 177 deletions

View File

@ -283,4 +283,17 @@ public class UtilParticle
UtilPlayer.sendPacket(player, packet); UtilPlayer.sendPacket(player, packet);
} }
} }
public static void PlayParticleToAll(String particle, Location location, Vector offset, float speed, int count, ViewDist dist)
{
PlayParticle(particle, location, (float) offset.getX(), (float) offset.getY(), (float) offset.getZ(), speed, count, dist, UtilServer.getPlayers());
}
public static void PlayParticleToAll(String particle, Location location, float offsetX, float offsetY, float offsetZ,
float speed, int count, ViewDist dist)
{
PlayParticle(particle, location, offsetX, offsetY, offsetZ, speed, count, dist, UtilServer.getPlayers());
}
} }

View File

@ -3,6 +3,8 @@ package mineplex.core.common.util;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import net.minecraft.server.v1_8_R3.MinecraftServer;
public class UtilTime public class UtilTime
{ {
public static final String DATE_FORMAT_NOW = "MM-dd-yyyy HH:mm:ss"; public static final String DATE_FORMAT_NOW = "MM-dd-yyyy HH:mm:ss";
@ -41,6 +43,15 @@ public class UtilTime
default: return "th"; default: return "th";
} }
} }
/**
*
* @return Returns the current global server tick. Is reset on server restart. Starts out negative. Counts upwards.
*/
public static int getServerTick()
{
return MinecraftServer.currentTick;
}
public enum TimeUnit public enum TimeUnit
{ {

View File

@ -0,0 +1,23 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.ArrowTrailPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
public class OpenArrowTrails implements IButton
{
private Menu _page;
public OpenArrowTrails(Menu page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new ArrowTrailPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Arrow Trails", player));
}
}

View File

@ -0,0 +1,23 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.DeathEffectPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
public class OpenDeathAnimations implements IButton
{
private Menu _page;
public OpenDeathAnimations(Menu page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new DeathEffectPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Death Animations", player));
}
}

View File

@ -0,0 +1,23 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.DoubleJumpPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
public class OpenDoubleJump implements IButton
{
private Menu _page;
public OpenDoubleJump(Menu page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new DoubleJumpPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Double Jump Effects", player));
}
}

View File

@ -0,0 +1,23 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.HatPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
public class OpenHats implements IButton
{
private Menu _page;
public OpenHats(Menu page)
{
_page = page;
}
public void onClick(Player player, ClickType clickType)
{
_page.getShop().openPageForPlayer(player, new HatPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Hats", player));
}
}

View File

@ -0,0 +1,53 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class ArrowTrailPage extends GadgetPage
{
public ArrowTrailPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.ArrowTrail))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -0,0 +1,53 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class DeathEffectPage extends GadgetPage
{
public DeathEffectPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager,
String name, Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Death))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -0,0 +1,53 @@
package mineplex.core.cosmetic.ui.page;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class DoubleJumpPage extends GadgetPage
{
public DoubleJumpPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.DoubleJump))
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -0,0 +1,57 @@
package mineplex.core.cosmetic.ui.page;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class HatPage extends GadgetPage
{
public HatPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.Hat);
if(list != null)
for (Gadget gadget : list)
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -6,15 +6,19 @@ import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType; import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop; import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.OpenArrowTrails;
import mineplex.core.cosmetic.ui.button.OpenCostumes; import mineplex.core.cosmetic.ui.button.OpenCostumes;
import mineplex.core.cosmetic.ui.button.OpenDeathAnimations;
import mineplex.core.cosmetic.ui.button.OpenDoubleJump;
import mineplex.core.cosmetic.ui.button.OpenGadgets; import mineplex.core.cosmetic.ui.button.OpenGadgets;
import mineplex.core.cosmetic.ui.button.OpenHats;
import mineplex.core.cosmetic.ui.button.OpenMorphs; import mineplex.core.cosmetic.ui.button.OpenMorphs;
import mineplex.core.cosmetic.ui.button.OpenMounts; import mineplex.core.cosmetic.ui.button.OpenMounts;
import mineplex.core.cosmetic.ui.button.OpenMusic; import mineplex.core.cosmetic.ui.button.OpenMusic;
@ -66,67 +70,80 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
ChatColor.RESET + "Receives 30000 Coins per Month" ChatColor.RESET + "Receives 30000 Coins per Month"
}, 1, false)); }, 1, false));
// addItem(6, new ShopItem(Material.GOLD_INGOT, donor.getGold() + " Gold", new String[] { addButton(10, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
// " " addButton(12, new ShopItem(Material.ARROW, "Arrow Trails", 1, false), new OpenArrowTrails(this));
// }, 1, false)); addButton(14, new ShopItem(Material.GOLD_BOOTS, "Double Jump Effects", 1, false), new OpenDoubleJump(this));
addButton(16, new ShopItem(Material.SKULL_ITEM, "Death Animations", 1, false), new OpenDeathAnimations(this));
addButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
addButton(20, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
addButton(22, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
addButton(24, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
addButton(26, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this));
//
addButton(48, new ShopItem(Material.GOLD_CHESTPLATE, "Costumes", 1, false), new OpenCostumes(this));
addButton(50, new ShopItem(Material.GREEN_RECORD, "Music", 1, false), new OpenMusic(this));
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) != null)
{
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle);
addButton(18 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
playAcceptSound(player);
gadget.Disable(player);
refresh();
}
});
}
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Item) != null)
{
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Item);
addButton(20 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
playAcceptSound(player);
gadget.Disable(player);
refresh();
}
});
}
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) != null) addButton(28, new ShopItem(Material.MELON_BLOCK, "Gadgets", 1, false), new OpenGadgets(this));
addButton(30, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
addButton(32, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
addButton(34, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this));
addButton(46, new ShopItem(Material.GOLD_HELMET, "Hats", 1, false), new OpenHats(this));
addButton(48, new ShopItem(Material.DIAMOND_CHESTPLATE, "Costumes", 1, false), new OpenCostumes(this));
addButton(50, new ShopItem(Material.GREEN_RECORD, "Music", 1, false), new OpenMusic(this));
addButton(52, new ShopItem(Material.NAME_TAG, "Taunts", 1, false), new IButton()
{ {
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph); @Override
public void onClick(Player player, ClickType clickType)
addButton(22 + 9, {
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false), player.sendMessage(F.main("Shop", "Comming soon!"));
}
});
for(GadgetType type : GadgetType.values())
{
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), type);
if(gadget == null) continue;
int slot = 10;
switch (type)
{
case Particle:
slot = 10;
break;
case ArrowTrail:
slot = 12;
break;
case DoubleJump:
slot = 14;
break;
case Death:
slot = 16;
break;
case Item:
slot = 28;
break;
case Morph:
slot = 30;
break;
case Hat:
slot = 46;
break;
case Costume:
slot = 48;
break;
case MusicDisc:
slot = 50;
break;
case Taunt:
slot = 52;
break;
default:
slot = 10;
break;
}
slot += 9;
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), C.mItem + gadget.GetName(), new String[0], 1, false, false),
new IButton() new IButton()
{ {
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType) {
{
playAcceptSound(player); playAcceptSound(player);
gadget.Disable(player); gadget.Disable(player);
refresh(); refresh();
} };
}); });
} }
@ -134,8 +151,8 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
final Mount<?> mount = getPlugin().getMountManager().getActive(getPlayer()); final Mount<?> mount = getPlugin().getMountManager().getActive(getPlayer());
addButton(24 + 9, addButton(32 + 9,
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), ChatColor.RESET + C.mItem + mount.GetName(), new String[]{}, 1, false, false), new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), C.mItem + mount.GetName(), new String[0], 1, false, false),
new IButton() new IButton()
{ {
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)
@ -151,7 +168,7 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{ {
Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName()); Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName());
String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName(); String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName();
addButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + petName, new String[]{}, 1, false, false), addButton(34 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), C.mItem + petName, new String[0], 1, false, false),
new IButton() new IButton()
{ {
public void onClick(Player player, ClickType clickType) public void onClick(Player player, ClickType clickType)

View File

@ -37,6 +37,8 @@ public class MorphPage extends GadgetPage
if (slot == 26) if (slot == 26)
slot = 28; slot = 28;
if (slot == 35)
slot = 37;
} }
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton() addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()

View File

@ -0,0 +1,57 @@
package mineplex.core.cosmetic.ui.page;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
public class TauntPage extends GadgetPage
{
public TauntPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name,
Player player)
{
super(plugin, shop, clientManager, donationManager, name, player);
}
@Override
protected void buildPage()
{
int slot = 19;
List<Gadget> list = getPlugin().getGadgetManager().getGadgets(GadgetType.Taunt);
if(list != null)
for (Gadget gadget : list)
{
addGadget(gadget, slot);
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
addGlow(slot);
slot++;
if (slot == 26)
slot = 28;
}
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
}

View File

@ -3,39 +3,6 @@ package mineplex.core.gadget;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.gadgets.arrowtrail.*;
import mineplex.core.gadget.gadgets.death.*;
import mineplex.core.gadget.gadgets.doublejump.*;
import mineplex.core.gadget.gadgets.item.*;
import mineplex.core.gadget.gadgets.morph.*;
import mineplex.core.gadget.gadgets.outfit.*;
import mineplex.core.gadget.gadgets.particle.*;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.gadget.types.MusicGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.MountManager;
import mineplex.core.pet.PetManager;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -49,6 +16,82 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.Rank;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord;
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan;
import mineplex.core.gadget.gadgets.death.DeathCandyCane;
import mineplex.core.gadget.gadgets.death.DeathFrostLord;
import mineplex.core.gadget.gadgets.death.DeathTitan;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpTitan;
import mineplex.core.gadget.gadgets.item.ItemBatGun;
import mineplex.core.gadget.gadgets.item.ItemCoinBomb;
import mineplex.core.gadget.gadgets.item.ItemDuelingSword;
import mineplex.core.gadget.gadgets.item.ItemEtherealPearl;
import mineplex.core.gadget.gadgets.item.ItemFirework;
import mineplex.core.gadget.gadgets.item.ItemFleshHook;
import mineplex.core.gadget.gadgets.item.ItemMelonLauncher;
import mineplex.core.gadget.gadgets.item.ItemPaintballGun;
import mineplex.core.gadget.gadgets.item.ItemPaintbrush;
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
import mineplex.core.gadget.gadgets.item.ItemTNT;
import mineplex.core.gadget.gadgets.morph.MorphBat;
import mineplex.core.gadget.gadgets.morph.MorphBlaze;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.gadgets.morph.MorphBunny;
import mineplex.core.gadget.gadgets.morph.MorphChicken;
import mineplex.core.gadget.gadgets.morph.MorphCow;
import mineplex.core.gadget.gadgets.morph.MorphCreeper;
import mineplex.core.gadget.gadgets.morph.MorphEnderman;
import mineplex.core.gadget.gadgets.morph.MorphPig;
import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing;
import mineplex.core.gadget.gadgets.morph.MorphSlime;
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
import mineplex.core.gadget.gadgets.morph.MorphTitan;
import mineplex.core.gadget.gadgets.morph.MorphVillager;
import mineplex.core.gadget.gadgets.morph.MorphWither;
import mineplex.core.gadget.gadgets.outfit.OutfitRaveSuit;
import mineplex.core.gadget.gadgets.outfit.OutfitSpaceSuit;
import mineplex.core.gadget.gadgets.outfit.OutfitTeam;
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
import mineplex.core.gadget.gadgets.particle.ParticleFoot;
import mineplex.core.gadget.gadgets.particle.ParticleFrostLord;
import mineplex.core.gadget.gadgets.particle.ParticleGreen;
import mineplex.core.gadget.gadgets.particle.ParticleHeart;
import mineplex.core.gadget.gadgets.particle.ParticleHelix;
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
import mineplex.core.gadget.gadgets.particle.ParticleRain;
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.MusicGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.mount.MountManager;
import mineplex.core.pet.PetManager;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
public class GadgetManager extends MiniPlugin public class GadgetManager extends MiniPlugin
{ {
private CoreClientManager _clientManager; private CoreClientManager _clientManager;
@ -103,6 +146,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new ItemCoinBomb(this)); addGadget(new ItemCoinBomb(this));
addGadget(new ItemPaintbrush(this)); addGadget(new ItemPaintbrush(this));
addGadget(new ItemDuelingSword(this)); addGadget(new ItemDuelingSword(this));
addGadget(new ItemPartyPopper(this));
// Costume // Costume
addGadget(new OutfitRaveSuit(this, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0)); addGadget(new OutfitRaveSuit(this, "Rave Hat", -2, ArmorSlot.Helmet, Material.LEATHER_HELMET, (byte)0));
@ -135,6 +179,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphBunny(this)); addGadget(new MorphBunny(this));
addGadget(new MorphSlime(this, _achievementManager)); addGadget(new MorphSlime(this, _achievementManager));
addGadget(new MorphTitan(this)); addGadget(new MorphTitan(this));
addGadget(new MorphSnowman(this));
// Particles // Particles
addGadget(new ParticleFoot(this)); addGadget(new ParticleFoot(this));
@ -148,18 +193,22 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleLegend(this)); addGadget(new ParticleLegend(this));
addGadget(new ParticleFrostLord(this)); addGadget(new ParticleFrostLord(this));
addGadget(new ParticleTitan(this)); addGadget(new ParticleTitan(this));
addGadget(new ParticleCandyCane(this));
// Arrow Trails // Arrow Trails
addGadget(new ArrowTrailFrostLord(this)); addGadget(new ArrowTrailFrostLord(this));
addGadget(new ArrowTrailTitan(this)); addGadget(new ArrowTrailTitan(this));
addGadget(new ArrowTrailCandyCane(this));
// Death Effect // Death Effect
addGadget(new DeathFrostLord(this)); addGadget(new DeathFrostLord(this));
addGadget(new DeathTitan(this)); addGadget(new DeathTitan(this));
addGadget(new DeathCandyCane(this));
// Double Jump // Double Jump
addGadget(new DoubleJumpFrostLord(this)); addGadget(new DoubleJumpFrostLord(this));
addGadget(new DoubleJumpTitan(this)); addGadget(new DoubleJumpTitan(this));
addGadget(new DoubleJumpCandyCane(this));
// Music // Music
@ -207,6 +256,7 @@ public class GadgetManager extends MiniPlugin
return _gadgets.get(gadgetType); return _gadgets.get(gadgetType);
} }
// Disallows two armor gadgets in same slot. // Disallows two armor gadgets in same slot.
public void RemoveOutfit(Player player, ArmorSlot slot) public void RemoveOutfit(Player player, ArmorSlot slot)
{ {
@ -227,6 +277,7 @@ public class GadgetManager extends MiniPlugin
} }
} }
/*
public void RemoveItem(Player player) public void RemoveItem(Player player)
{ {
for (GadgetType gadgetType : _gadgets.keySet()) for (GadgetType gadgetType : _gadgets.keySet())
@ -274,6 +325,17 @@ public class GadgetManager extends MiniPlugin
} }
} }
} }
*/
public void removeGadetType(Player player, GadgetType type)
{
List<Gadget> gadgets = _gadgets.get(type);
if(gadgets == null) return;
for(Gadget g : gadgets)
{
g.Disable(player);
}
}
public void DisableAll() public void DisableAll()
{ {
@ -367,7 +429,7 @@ public class GadgetManager extends MiniPlugin
@EventHandler @EventHandler
public void setMoving(PlayerMoveEvent event) public void setMoving(PlayerMoveEvent event)
{ {
if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0.1)
return; return;
_lastMove.put(event.getPlayer(), System.currentTimeMillis()); _lastMove.put(event.getPlayer(), System.currentTimeMillis());
@ -375,6 +437,8 @@ public class GadgetManager extends MiniPlugin
public boolean isMoving(Player player) public boolean isMoving(Player player)
{ {
if (!UtilEnt.isGrounded(player)) return true;
if (!_lastMove.containsKey(player)) if (!_lastMove.containsKey(player))
return false; return false;

View File

@ -0,0 +1,48 @@
package mineplex.core.gadget.gadgets.arrowtrail;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import mineplex.core.common.util.C;
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.UtilTime;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ArrowEffectGadget;
public class ArrowTrailCandyCane extends ArrowEffectGadget
{
public ArrowTrailCandyCane(GadgetManager manager)
{
super(manager, "Candy Cane Arrow Effect", new String[]
{
C.cWhite + "We whish you a marry " + C.Scramble + "christmas" + C.cWhite + ".",
},
1,
Material.SNOW_BALL, (byte)0);
}
@Override
public void doTrail(Arrow arrow)
{
int data = 15;
int tick = Math.abs(UtilTime.getServerTick()%3);
if(tick == 1) data = 1;
if(tick == 2) data = 2;
Location loc = arrow.getLocation();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, data), loc, 0, 0, 0, 0.0f, 1, ViewDist.NORMAL);
}
@Override
public void doHitEffect(Arrow arrow)
{
Location loc = arrow.getLocation();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.1f, 20, ViewDist.NORMAL);
}
}

View File

@ -15,15 +15,13 @@ public class ArrowTrailFrostLord extends ArrowEffectGadget
{ {
public ArrowTrailFrostLord(GadgetManager manager) public ArrowTrailFrostLord(GadgetManager manager)
{ {
super(manager, "Frost Lord", new String[] super(manager, "Frost Lord Arrow Trail", new String[]
{ {
C.cWhite + "You are a mighty frost lord.", C.cWhite + "You are a mighty frost lord.",
C.cWhite + "Your double jumps and arrows", C.cWhite + "Your double jumps and arrows",
C.cWhite + "are enchanted with snow powers.", C.cWhite + "are enchanted with snow powers.",
" ",
C.cPurple + "No longer available",
}, },
-1, 10,
Material.SNOW_BALL, (byte)0); Material.SNOW_BALL, (byte)0);
} }

View File

@ -0,0 +1,49 @@
package mineplex.core.gadget.gadgets.death;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import mineplex.core.blood.BloodEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.types.DeathEffectGadget;
import mineplex.core.gadget.GadgetManager;
public class DeathCandyCane extends DeathEffectGadget
{
public DeathCandyCane(GadgetManager manager)
{
super(manager, "Candy Cane Effect", new String[]
{
C.cWhite + "COLORS FTW!",
C.cWhite + "Take damage with SWAG B)",
},
10,
Material.SNOW_BALL, (byte)0);
}
@EventHandler
public void death(BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setCancelled(true);
event.setItem(Material.INK_SACK, (byte) 15);
Location loc = event.getLocation();
int a = event.getParticles();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.1f, a, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.1f, a, ViewDist.NORMAL);
}
}

View File

@ -12,15 +12,13 @@ public class DeathFrostLord extends DeathEffectGadget
{ {
public DeathFrostLord(GadgetManager manager) public DeathFrostLord(GadgetManager manager)
{ {
super(manager, "Frost Lord", new String[] super(manager, "Frost Lord Death Effect", new String[]
{ {
C.cWhite + "You are a mighty frost lord.", C.cWhite + "You are a mighty frost lord.",
C.cWhite + "Your double jumps and arrows", C.cWhite + "Your double jumps and arrows",
C.cWhite + "are enchanted with snow powers.", C.cWhite + "are enchanted with snow powers.",
" ",
C.cPurple + "No longer available",
}, },
-1, 10,
Material.SNOW_BALL, (byte)0); Material.SNOW_BALL, (byte)0);
} }

View File

@ -0,0 +1,36 @@
package mineplex.core.gadget.gadgets.doublejump;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
public class DoubleJumpCandyCane extends DoubleJumpEffectGadget
{
public DoubleJumpCandyCane(GadgetManager manager)
{
super(manager, "Candy Cane Jump Effect", new String[]
{
C.cWhite + "We whish you a marry " + C.Scramble + "christmas" + C.cWhite + ".",
},
1,
Material.SNOW_BALL, (byte)0);
}
@Override
public void doEffect(Player player)
{
Location loc = player.getLocation();
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, 0, 0, 0, 0.15f, 100, ViewDist.NORMAL);
}
}

View File

@ -17,15 +17,11 @@ public class DoubleJumpFrostLord extends DoubleJumpEffectGadget
{ {
public DoubleJumpFrostLord(GadgetManager manager) public DoubleJumpFrostLord(GadgetManager manager)
{ {
super(manager, "Frost Lord", new String[] super(manager, "Frost Lord Jump Effect", new String[]
{ {
C.cWhite + "You are a mighty frost lord.", C.cWhite + "More snow incomming.",
C.cWhite + "Your double jumps and arrows",
C.cWhite + "are enchanted with snow powers.",
" ",
C.cPurple + "No longer available",
}, },
-1, 1,
Material.SNOW_BALL, (byte)0); Material.SNOW_BALL, (byte)0);
} }

View File

@ -36,6 +36,7 @@ public class DoubleJumpTitan extends DoubleJumpEffectGadget
{ {
UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0f, 0f, 0f, 0.2f, 40, UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation(), 0f, 0f, 0f, 0.2f, 40,
ViewDist.NORMAL, UtilServer.getPlayers()); ViewDist.NORMAL, UtilServer.getPlayers());
UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation(), 0, 0, 0, 0.2f, 40, ViewDist.NORMAL);
} }
@EventHandler @EventHandler

View File

@ -8,6 +8,7 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
@ -27,7 +28,7 @@ public class ItemDuelingSword extends ItemGadget
@Override @Override
public void ApplyItem(Player player, boolean inform) public void ApplyItem(Player player, boolean inform)
{ {
Manager.RemoveItem(player); Manager.removeGadetType(player, GadgetType.Item);
_active.add(player); _active.add(player);

View File

@ -28,6 +28,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.Ammo; import mineplex.core.gadget.gadgets.Ammo;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget; import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -56,7 +57,7 @@ public class ItemPaintbrush extends ItemGadget
@Override @Override
public void ApplyItem(Player player, boolean inform) public void ApplyItem(Player player, boolean inform)
{ {
Manager.RemoveItem(player); Manager.removeGadetType(player, GadgetType.Item);
_active.add(player); _active.add(player);

View File

@ -0,0 +1,127 @@
package mineplex.core.gadget.gadgets.morph;
import java.util.WeakHashMap;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilMath;
import mineplex.core.disguise.disguises.DisguiseSnowman;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.recharge.Recharge;
import mineplex.core.recharge.RechargeData;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MorphSnowman extends MorphGadget
{
private WeakHashMap<Projectile, Player> _snowball = new WeakHashMap<Projectile, Player>();
public MorphSnowman(GadgetManager manager)
{
super(manager, "Snowman Morph",
new String[]{ C.cWhite + "Do you wanna build a snowman?", C.cWhite + "It doesn't have to be a snowman...",
C.cWhite + "Or... it kind of does...", " ", C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Snowball", },
6000, Material.SNOW_BALL, (byte) 0);
}
@Override
public void EnableCustom(Player player)
{
this.ApplyArmor(player);
DisguiseSnowman disguise = new DisguiseSnowman(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
disguise.setCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
}
@EventHandler
public void onInteract(PlayerInteractEvent event)
{
if(!IsActive(event.getPlayer())) return;
if(!UtilEvent.isAction(event, ActionType.L)) return;
if(event.getItem() != null && event.getItem().getType() != Material.AIR) return;
if(Recharge.Instance.use(event.getPlayer(), "Blizzard", 12000, true, true))
{
event.getPlayer().sendMessage(F.main("Recharge", "You used " + F.skill("Blizzard") + "."));
}
}
@EventHandler
public void Snow(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTEST)
return;
for (Player player : GetActive())
{
NautHashMap<String, RechargeData> map = Recharge.Instance.Get(player);
if(map == null) continue;
RechargeData data = map.get("Blizzard");
if(data == null) continue;
if(data.GetRemaining() < 10000) continue;
for (int i=0 ; i<4 ; i++)
{
Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class);
double x = 0.1 - (UtilMath.r(20)/100d);
double y = UtilMath.r(20)/100d;
double z = 0.1 - (UtilMath.r(20)/100d);
snow.setShooter(player);
snow.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
_snowball.put(snow, player);
}
//Effect
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.2f, 0.5f);
}
}
@EventHandler
public void Snowball(EntityDamageByEntityEvent event)
{
if (!(event.getDamager() instanceof Snowball))
return;
Snowball proj = (Snowball) event.getDamager();
if (!_snowball.containsKey(proj))
return;
GadgetCollideEntityEvent gevent = new GadgetCollideEntityEvent(this, event.getEntity());
if(gevent.isCancelled()) return;
UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
}
}

View File

@ -20,6 +20,7 @@ import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetActivateEvent; import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.OutfitGadget; import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot; import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
@ -55,7 +56,7 @@ public class OutfitTeam extends OutfitGadget
@Override @Override
public void ApplyArmor(Player player) public void ApplyArmor(Player player)
{ {
Manager.RemoveMorph(player); Manager.removeGadetType(player, GadgetType.Morph);
Manager.RemoveOutfit(player, _slot); Manager.RemoveOutfit(player, _slot);

View File

@ -0,0 +1,93 @@
package mineplex.core.gadget.gadgets.particle;
import java.util.HashMap;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class ParticleCandyCane extends ParticleGadget
{
private HashMap<UUID, Double> _map = new HashMap<UUID, Double>();
public ParticleCandyCane(GadgetManager manager)
{
super(manager, "Candy Cane Particle", new String[]{"Christmas. Nuf said."}, 10, Material.CHEST, (byte)0);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for(Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
boolean moving = Manager.isMoving(player);
Location loc = player.getLocation();
float y = moving? 0.2f : 0.15f;
double yadd = getY(player);
if(!moving && yadd < 2.1)
{
yadd += 0.05;
setY(player, yadd);
}
if(moving && yadd > 0.7)
{
yadd = 0.7;
setY(player, yadd);
}
loc.add(0, yadd, 0);
float w = 0.2f;
int a = moving? 2 : 6;
if(!moving)
{
double d = Math.PI*2 * (event.getTick()/50.0);
Vector v = new Vector(Math.sin(d), 0, Math.cos(d));
loc.add(v);
}
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 15), loc, w, y, w, 0, a, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 1), loc, w, y, w, 0, a, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.ICON_CRACK.getParticle(Material.INK_SACK, 2), loc, w, y, w, 0, a, ViewDist.NORMAL);
}
}
@EventHandler
public void onQuit(PlayerQuitEvent event)
{
_map.remove(event.getPlayer().getUniqueId());
}
private void setY(Player p, double y)
{
_map.put(p.getUniqueId(), y);
}
private double getY(Player p)
{
Double y = _map.get(p.getUniqueId());
if(y == null) return 3;
return y.doubleValue();
}
}

View File

@ -30,15 +30,13 @@ public class ParticleFrostLord extends ParticleGadget
public ParticleFrostLord(GadgetManager manager) public ParticleFrostLord(GadgetManager manager)
{ {
super(manager, "Frost Lord", new String[] super(manager, "Frost Lord Particle", new String[]
{ {
C.cWhite + "You are a mighty frost lord.", C.cWhite + "You are a mighty frost lord.",
C.cWhite + "Your double jumps and arrows", C.cWhite + "Your double jumps and arrows",
C.cWhite + "are enchanted with snow powers.", C.cWhite + "are enchanted with snow powers.",
" ",
C.cPurple + "No longer available",
}, },
-1, 10,
Material.SNOW_BALL, (byte)0); Material.SNOW_BALL, (byte)0);
} }

View File

@ -11,11 +11,7 @@ import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent; import org.bukkit.event.entity.ProjectileLaunchEvent;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.gadget.GadgetManager; import mineplex.core.gadget.GadgetManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
@ -32,7 +28,7 @@ public abstract class ArrowEffectGadget extends Gadget
@Override @Override
public void EnableCustom(Player player) public void EnableCustom(Player player)
{ {
Manager.RemoveParticle(player); Manager.removeGadetType(player, GadgetType.ArrowTrail);
_active.add(player); _active.add(player);

View File

@ -17,7 +17,7 @@ public abstract class DeathEffectGadget extends Gadget
@Override @Override
public void EnableCustom(Player player) public void EnableCustom(Player player)
{ {
Manager.RemoveParticle(player); Manager.removeGadetType(player, GadgetType.Death);
_active.add(player); _active.add(player);

View File

@ -23,7 +23,7 @@ public abstract class DoubleJumpEffectGadget extends Gadget
@Override @Override
public void EnableCustom(Player player) public void EnableCustom(Player player)
{ {
Manager.RemoveParticle(player); Manager.removeGadetType(player, GadgetType.DoubleJump);
_active.add(player); _active.add(player);

View File

@ -9,5 +9,7 @@ public enum GadgetType
Costume, Costume,
DoubleJump, DoubleJump,
ArrowTrail, ArrowTrail,
Death Death,
Hat,
Taunt
} }

View File

@ -64,7 +64,7 @@ public abstract class ItemGadget extends Gadget
public void ApplyItem(Player player, boolean inform) public void ApplyItem(Player player, boolean inform)
{ {
Manager.RemoveItem(player); Manager.removeGadetType(player, GadgetType.Item);
_active.add(player); _active.add(player);
@ -157,7 +157,7 @@ public abstract class ItemGadget extends Gadget
{ {
UtilInv.Update(player); UtilInv.Update(player);
return; return;
} }
Manager.getInventoryManager().addItemToInventory(player, GetName(), -1); Manager.getInventoryManager().addItemToInventory(player, GetName(), -1);

View File

@ -19,7 +19,7 @@ public abstract class MorphGadget extends Gadget
public void ApplyArmor(Player player) public void ApplyArmor(Player player)
{ {
Manager.RemoveMorph(player); Manager.removeGadetType(player, GadgetType.Morph);
_active.add(player); _active.add(player);

View File

@ -34,7 +34,7 @@ public abstract class OutfitGadget extends Gadget
public void ApplyArmor(Player player) public void ApplyArmor(Player player)
{ {
Manager.RemoveMorph(player); Manager.removeGadetType(player, GadgetType.Morph);
Manager.RemoveOutfit(player, _slot); Manager.RemoveOutfit(player, _slot);

View File

@ -1,6 +1,5 @@
package mineplex.core.gadget.types; package mineplex.core.gadget.types;
import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -18,7 +17,7 @@ public abstract class ParticleGadget extends Gadget
@Override @Override
public void EnableCustom(Player player) public void EnableCustom(Player player)
{ {
Manager.RemoveParticle(player); Manager.removeGadetType(player, GadgetType.Particle);
_active.add(player); _active.add(player);

View File

@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.mount.types.MountBabyReindeer;
import mineplex.core.mount.types.MountCart; import mineplex.core.mount.types.MountCart;
import mineplex.core.mount.types.MountDragon; import mineplex.core.mount.types.MountDragon;
import mineplex.core.mount.types.MountFrost; import mineplex.core.mount.types.MountFrost;
@ -68,6 +69,7 @@ public class MountManager extends MiniPlugin
_types.add(new MountSpider(this)); _types.add(new MountSpider(this));
_types.add(new MountZombie(this)); _types.add(new MountZombie(this));
_types.add(new MountTitan(this)); _types.add(new MountTitan(this));
_types.add(new MountBabyReindeer(this));
//_types.add(new MountSheep(this)); //_types.add(new MountSheep(this));
} }

View File

@ -0,0 +1,92 @@
package mineplex.core.mount.types;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.HorseJumpEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
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.mount.HorseMount;
import mineplex.core.mount.MountManager;
import mineplex.core.mount.SingleEntityMountData;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class MountBabyReindeer extends HorseMount
{
public MountBabyReindeer(MountManager manager)
{
super(manager, "Baby Rainder", new String[]
{
C.cWhite + "One of Santa's baby reindeers",
C.cWhite + "Still trying to learn how to fly"
}, Material.SNOW_BALL, (byte) 0, 10, Color.CREAMY, Style.WHITEFIELD, Variant.HORSE, 0, null);
}
@EventHandler
public void EnableCustom(Player player) {
super.EnableCustom(player);
Horse horse = GetActive().get(player).getEntity();
horse.setBaby();
horse.setMaxHealth(20);
}
@EventHandler
public void fly(UpdateEvent event)
{
if(event.getType() != UpdateType.TICK) return;
for(SingleEntityMountData<Horse> horse : GetActive().values())
{
if(horse.getEntity().getPassenger() != horse.getOwner()) continue;
if(Recharge.Instance.usable(horse.getOwner(), "Reindeer Fly")) continue;
horse.getEntity().setVelocity(horse.getOwner().getLocation().getDirection().normalize().add(new Vector(0,0.4,0)));
horse.getEntity().getWorld().playSound(horse.getEntity().getLocation(), Sound.HORSE_BREATHE, 0.3f, 0.5f);
UtilParticle.PlayParticleToAll(ParticleType.EXPLODE, horse.getEntity().getLocation(), 0.2f,0.0f,0.2f, 0.0f, 10, ViewDist.NORMAL);
}
}
@EventHandler
public void onClick(PlayerInteractEntityEvent event)
{
if(!IsActive(event.getPlayer())) return;
SingleEntityMountData<Horse>data = getMountData(event.getRightClicked());
if(data == null) return;
if(data.getOwner() != event.getPlayer()) return;
data.getEntity().setPassenger(data.getOwner());
}
@EventHandler
public void onJump(HorseJumpEvent event)
{
SingleEntityMountData<Horse> data = getMountData(event.getEntity());
if(data == null) return;
event.setCancelled(true);
if(UtilEnt.isGrounded(event.getEntity()))
{
if(Recharge.Instance.use(data.getOwner(), "Reindeer Fly", 1000, false, false))
{
event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.HORSE_ANGRY, 1f, 1f);
}
}
}
}

View File

@ -36,6 +36,12 @@ public class MountTitan extends Mount<MountTitanData>
@Override @Override
public void EnableCustom(Player player) public void EnableCustom(Player player)
{ {
if(GetActive().size() >= 3)
{
UtilPlayer.message(player, F.main("Mount", "The maximum amount of simultaneous " + F.elem(GetName()) + " in this lobby has been reached."));
return;
}
player.leaveVehicle(); player.leaveVehicle();
player.eject(); player.eject();

View File

@ -1,19 +1,16 @@
package mineplex.core.pet; package mineplex.core.pet;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.pet.repository.PetRepository;
import mineplex.core.pet.repository.token.PetExtraToken;
import mineplex.core.pet.repository.token.PetSalesToken;
import mineplex.core.pet.types.Elf;
import mineplex.core.pet.types.Pumpkin;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.pet.repository.PetRepository;
import mineplex.core.pet.types.Elf;
import mineplex.core.pet.types.PetCoalApparition;
import mineplex.core.pet.types.Pumpkin;
public class PetFactory public class PetFactory
{ {
private PetRepository _repository; private PetRepository _repository;
@ -33,6 +30,7 @@ public class PetFactory
private void CreatePets() private void CreatePets()
{ {
_pets.put(EntityType.ZOMBIE, new Pumpkin()); _pets.put(EntityType.ZOMBIE, new Pumpkin());
_pets.put(EntityType.PIG_ZOMBIE, new PetCoalApparition());
_pets.put(EntityType.VILLAGER, new Elf()); _pets.put(EntityType.VILLAGER, new Elf());
_pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 5000)); _pets.put(EntityType.PIG, new Pet("Pig", EntityType.PIG, 5000));
_pets.put(EntityType.SHEEP, new Pet("Sheep", EntityType.SHEEP, 3000)); _pets.put(EntityType.SHEEP, new Pet("Sheep", EntityType.SHEEP, 3000));

View File

@ -4,11 +4,38 @@ import java.util.Collection;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPigZombie;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.PigZombie;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.google.gson.Gson;
import mineplex.core.MiniClientPlugin; import mineplex.core.MiniClientPlugin;
import mineplex.core.pet.repository.PetRepository;
import mineplex.core.pet.repository.token.ClientPetTokenWrapper;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.account.event.ClientWebResponseEvent;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
@ -17,50 +44,22 @@ import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; 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.UtilServer;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.disguise.disguises.DisguiseGuardian; import mineplex.core.disguise.disguises.DisguiseGuardian;
import mineplex.core.disguise.disguises.DisguiseWither; import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.repository.PetRepository;
import mineplex.core.pet.repository.token.ClientPetTokenWrapper;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_8_R3.EntityCreature; import net.minecraft.server.v1_8_R3.EntityCreature;
import net.minecraft.server.v1_8_R3.EntityWither;
import net.minecraft.server.v1_8_R3.Navigation;
import net.minecraft.server.v1_8_R3.NavigationAbstract; import net.minecraft.server.v1_8_R3.NavigationAbstract;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import com.google.gson.Gson;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
import org.bukkit.entity.Ageable;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Guardian;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class PetManager extends MiniClientPlugin<PetClient> public class PetManager extends MiniClientPlugin<PetClient>
{ {
private static Object _petOwnerSynch = new Object(); private static Object _petOwnerSynch = new Object();
@ -228,6 +227,12 @@ public class PetManager extends MiniClientPlugin<PetClient>
pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0)); pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0));
UtilEnt.silence(pet, true); UtilEnt.silence(pet, true);
} }
if (pet instanceof PigZombie)
{
((PigZombie)pet).setBaby(true);
pet.getEquipment().setHelmet(new ItemStack(Material.SKULL_ITEM, 1, (short)0, (byte) 1));
pet.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 99999999, 0));
}
else if (pet instanceof Villager) else if (pet instanceof Villager)
{ {
((Villager) pet).setBaby(); ((Villager) pet).setBaby();
@ -342,6 +347,22 @@ public class PetManager extends MiniClientPlugin<PetClient>
@EventHandler @EventHandler
public void onUpdate(UpdateEvent event) public void onUpdate(UpdateEvent event)
{ {
if (event.getType() == UpdateType.TICK)
{
for(Creature pet : _activePetOwners.values())
{
if(pet instanceof PigZombie)
{
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, pet.getLocation(), 0.2f,0.0f,0.2f, 0.0f, 4, ViewDist.NORMAL);
if(event.getTick()%3 == 0) pet.getWorld().playSound(pet.getLocation(), Sound.BLAZE_BREATH, 0.1f, 0f);
if(!((CraftPigZombie)pet).getHandle().isSilent())
{
((CraftPigZombie)pet).getHandle().setSilent(true);
}
}
}
}
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;

View File

@ -0,0 +1,14 @@
package mineplex.core.pet.types;
import org.bukkit.entity.EntityType;
import mineplex.core.pet.Pet;
public class PetCoalApparition extends Pet
{
public PetCoalApparition()
{
super("Coal Apparition", EntityType.PIG_ZOMBIE, 10);
}
}

View File

@ -1,6 +1,7 @@
package mineplex.core.updater.event; package mineplex.core.updater.event;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import net.minecraft.server.v1_8_R3.MinecraftServer;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -19,6 +20,11 @@ public class UpdateEvent extends Event
{ {
return _type; return _type;
} }
public int getTick()
{
return MinecraftServer.currentTick;
}
public HandlerList getHandlers() public HandlerList getHandlers()
{ {

View File

@ -169,7 +169,7 @@ public class DisguiseCommand extends CommandBase<ArcadeManager> implements Liste
changeName(caller, args[0], true); changeName(caller, args[0], true);
Plugin.getCosmeticManager().getGadgetManager().RemoveItem(caller); Plugin.getCosmeticManager().getGadgetManager().removeGadetType(caller, GadgetType.Item);
Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller)); Bukkit.broadcastMessage(ChatColor.DARK_GRAY + "Quit> " + ChatColor.GRAY + _disguisedPlayersNames.get(caller));
UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]); UtilPlayer.message(caller, C.cGreen + C.Bold + "Disguise Active: " + ChatColor.RESET + args[0]);