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

This commit is contained in:
Jonathan Williams 2014-12-22 09:22:50 -05:00
commit 9b3350c8c7
133 changed files with 2612 additions and 628 deletions

View File

@ -7,14 +7,15 @@
<module fileurl="file://$PROJECT_DIR$/Mineplex.Core/Mineplex.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Core/Mineplex.Core.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Core.Common/Mineplex.Core.Common.iml" filepath="$PROJECT_DIR$/Mineplex.Core.Common/Mineplex.Core.Common.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Database/Mineplex.Database.iml" filepath="$PROJECT_DIR$/Mineplex.Database/Mineplex.Database.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" filepath="$PROJECT_DIR$/Mineplex.Game.Clans/Mineplex.Game.Clans.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" filepath="$PROJECT_DIR$/Mineplex.Hub/Mineplex.Hub.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" filepath="$PROJECT_DIR$/Mineplex.MapParser/Mineplex.MapParser.iml" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.BungeeSigns/Mineplex.Minecraft.BungeeSigns.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.BungeeSigns/Mineplex.Minecraft.BungeeSigns.iml" group="Bungee" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Arcade" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" group="Arcade" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.ClassCombat/Mineplex.Minecraft.Game.ClassCombat.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" filepath="$PROJECT_DIR$/Mineplex.Minecraft.Game.Core/Mineplex.Minecraft.Game.Core.iml" group="Game" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" filepath="$PROJECT_DIR$/Mineplex.ServerData/Mineplex.ServerData.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" filepath="$PROJECT_DIR$/Mineplex.ServerMonitor/Mineplex.ServerMonitor.iml" group="Core" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Arcade" />
<module fileurl="file://$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" filepath="$PROJECT_DIR$/Nautilus.Game.Arcade/Nautilus.Game.Arcade.iml" group="Game" />
</modules>
</component>
</project>

View File

@ -12,10 +12,14 @@ public enum Rank
DEVELOPER("Dev", ChatColor.RED),
ADMIN("Admin", ChatColor.RED),
SNR_MODERATOR("Sr.Mod", ChatColor.GOLD),
MODERATOR("Mod", ChatColor.DARK_GREEN),
HELPER("Helper", ChatColor.GREEN),
MODERATOR("Mod", ChatColor.GOLD),
HELPER("Helper", ChatColor.DARK_AQUA),
MAPDEV("Mapper", ChatColor.BLUE),
//Staff ^^
YOUTUBE("YouTube", ChatColor.RED),
LEGEND("Legend", ChatColor.GREEN),
HERO("Hero", ChatColor.LIGHT_PURPLE),
ULTRA("Ultra", ChatColor.AQUA),
ALL("", ChatColor.WHITE);

View File

@ -59,9 +59,14 @@ public class UtilFirework
firework.remove();
}
public static Firework launchFirework(Location loc, Type type, Color color, boolean flicker, boolean trail, Vector dir, int power)
{
return launchFirework(loc, FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build(), dir, power);
}
public static void playFirework(Location loc, Type type, Color color, boolean flicker, boolean trail)
{
playFirework(loc, FireworkEffect.builder().flicker(false).withColor(color).with(type).trail(false).build());
playFirework(loc, FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build());
}
}

View File

@ -446,10 +446,10 @@ public class CoreClientManager extends MiniPlugin
if (event.getType() != UpdateType.SLOWER)
return;
System.out.println("=====");
System.out.println("Connecting : " + _clientsConnecting.get());
System.out.println("Processing : " + _clientsProcessing.get());
System.out.println("=====");
// System.out.println("=====");
// System.out.println("Connecting : " + _clientsConnecting.get());
// System.out.println("Processing : " + _clientsProcessing.get());
// System.out.println("=====");
}
public void addStoredProcedureLoginProcessor(ILoginProcessor processor)

View File

@ -2,6 +2,7 @@ package mineplex.core.achievement.ui.button;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementCategory;
@ -9,13 +10,13 @@ import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.achievement.ui.page.ArcadeMainPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/22/2014.
*/
public class ArcadeButton extends SingleButton
public class ArcadeButton implements IButton
{
private AchievementShop _shop;
private AchievementManager _achievementManager;
@ -35,7 +36,7 @@ public class ArcadeButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new ArcadeMainPage(_achievementManager, _statsManager, _shop, _clientManager, _donationManager, "Arcade Games", player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);

View File

@ -2,6 +2,7 @@ package mineplex.core.achievement.ui.button;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementCategory;
@ -9,13 +10,13 @@ import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.achievement.ui.page.AchievementPage;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.core.stats.StatsManager;
/**
* Created by Shaun on 8/22/2014.
*/
public class CategoryButton extends SingleButton
public class CategoryButton implements IButton
{
private AchievementShop _shop;
private AchievementCategory _category;
@ -37,7 +38,7 @@ public class CategoryButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new AchievementPage(_achievementManager, _statsManager, _category, _shop, _clientManager, _donationManager, player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);

View File

@ -7,6 +7,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@ -18,8 +19,8 @@ import mineplex.core.achievement.AchievementManager;
import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.stats.PlayerStats;
import mineplex.core.stats.StatsManager;
@ -134,10 +135,9 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
private void addBackButton()
{
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
AchievementMainPage page;
if (_category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)

View File

@ -6,6 +6,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementCategory;
@ -14,8 +15,8 @@ import mineplex.core.achievement.ui.AchievementShop;
import mineplex.core.achievement.ui.button.CategoryButton;
import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.stats.StatsManager;
/**
@ -62,10 +63,9 @@ public class ArcadeMainPage extends AchievementMainPage
private void addBackButton()
{
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new AchievementMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, _target.getName() + "'s Stats", player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);

View File

@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
@ -13,7 +14,9 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
@ -32,32 +35,39 @@ public class Blood extends MiniPlugin
@EventHandler
public void Death(PlayerDeathEvent event)
{
Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT_FLESH, 1f, 1f, Material.INK_SACK, (byte)1, true);
Effects(event.getEntity(), event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT_FLESH, 1f, 1f, Material.INK_SACK, (byte)1, true);
}
public void Effects(Location loc, int particles, double velMult, Sound sound,
public void Effects(Player player, Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data, boolean bloodStep)
{
Effects(loc, particles, velMult, sound, soundVol, soundPitch, type, data, 10, bloodStep);
Effects(player, loc, particles, velMult, sound, soundVol, soundPitch, type, data, 10, bloodStep);
}
public void Effects(Location loc, int particles, double velMult, Sound sound,
public void Effects(Player player, Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data, int ticks, boolean bloodStep)
{
for (int i = 0 ; i < particles ; i++)
BloodEvent event = new BloodEvent(player, loc, particles, velMult, sound, soundVol, soundPitch, type, data, ticks, bloodStep);
UtilServer.getServer().getPluginManager().callEvent(event);
}
@EventHandler(priority = EventPriority.MONITOR)
public void display(BloodEvent event)
{
for (int i = 0 ; i < event.getParticles() ; i++)
{
Item item = loc.getWorld().dropItem(loc,
ItemStackFactory.Instance.CreateStack(type, data));
Item item = event.getLocation().getWorld().dropItem(event.getLocation(),
ItemStackFactory.Instance.CreateStack(event.getMaterial(), event.getMaterialData()));
item.setVelocity(new Vector((Math.random() - 0.5)*velMult,Math.random()*velMult,(Math.random() - 0.5)*velMult));
item.setVelocity(new Vector((Math.random() - 0.5)*event.getVelocityMult(),Math.random()*event.getVelocityMult(),(Math.random() - 0.5)*event.getVelocityMult()));
_blood.put(item, ticks);
_blood.put(item, event.getTicks());
}
if (bloodStep)
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 55);
if (event.getBloodStep())
event.getLocation().getWorld().playEffect(event.getLocation(), Effect.STEP_SOUND, 55);
loc.getWorld().playSound(loc, sound, soundVol, soundPitch);
event.getLocation().getWorld().playSound(event.getLocation(), event.getSound(), event.getSoundVolume(), event.getSoundPitch());
}
@EventHandler

View File

@ -0,0 +1,128 @@
package mineplex.core.blood;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class BloodEvent extends Event implements Cancellable
{
private static final HandlerList handlers = new HandlerList();
private boolean _cancelled = false;
private Player _player;
private Location _loc;
private int _particles;
private double _velMult;
private Sound _sound;
private float _soundVol;
private float _soundPitch;
private Material _type;
private byte _data;
private int _ticks;
private boolean _bloodStep;
public BloodEvent(Player player, Location loc, int particles, double velMult, Sound sound,
float soundVol, float soundPitch, Material type, byte data,
int ticks, boolean bloodStep)
{
_player = player;
_loc = loc;
_particles = particles;
_velMult = velMult;
_sound = sound;
_soundVol = soundVol;
_soundPitch = soundPitch;
_type = type;
_data = data;
_ticks = ticks;
_bloodStep = bloodStep;
}
@Override
public boolean isCancelled()
{
return _cancelled;
}
@Override
public void setCancelled(boolean var)
{
_cancelled = var;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public Player getPlayer()
{
return _player;
}
public Location getLocation()
{
return _loc;
}
public int getParticles()
{
return _particles;
}
public double getVelocityMult()
{
return _velMult;
}
public Sound getSound()
{
return _sound;
}
public float getSoundVolume()
{
return _soundVol;
}
public float getSoundPitch()
{
return _soundPitch;
}
public Material getMaterial()
{
return _type;
}
public byte getMaterialData()
{
return _data;
}
public int getTicks()
{
return _ticks;
}
public boolean getBloodStep()
{
return _bloodStep;
}
public void setItem(Material mat, byte data)
{
_type = mat;
_data = data;
}
}

View File

@ -7,7 +7,9 @@ import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Iterator;
import java.util.UUID;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
@ -17,6 +19,7 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import mineplex.core.MiniPlugin;
import mineplex.core.chat.command.ChatSlowCommand;
import mineplex.core.preferences.PreferencesManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
@ -57,9 +60,10 @@ public class Chat extends MiniPlugin
//private String _authName = "";
private String _serverName;
private int _chatSlow = 0;
private long _silenced = 0;
private NautHashMap<String, String> _playerLastMessage = new NautHashMap<String, String>();
private HashMap<UUID, MessageData> _playerLastMessage = new HashMap<UUID, MessageData>();
public Chat(JavaPlugin plugin, CoreClientManager clientManager, PreferencesManager preferences, String serverName)
{
@ -84,6 +88,23 @@ public class Chat extends MiniPlugin
{
addCommand(new SilenceCommand(this));
addCommand(new BroadcastCommand(this));
addCommand(new ChatSlowCommand(this));
}
public void setChatSlow(int seconds, boolean inform)
{
if (seconds < 0)
seconds = 0;
_chatSlow = seconds;
if (inform)
{
if (seconds == 0)
UtilServer.broadcast(F.main("Chat", "Chat Slow is now disabled"));
else
UtilServer.broadcast(F.main("Chat", "Chat slow is now enabled with a cooldown of " + F.time(seconds + " seconds")));
}
}
public void Silence(long duration, boolean inform)
@ -110,7 +131,7 @@ public class Chat extends MiniPlugin
@EventHandler
public void preventMe(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().toLowerCase().startsWith("/me")
if (event.getMessage().toLowerCase().startsWith("/me ")
|| event.getMessage().toLowerCase().startsWith("/bukkit"))
{
event.getPlayer().sendMessage(F.main(getName(), "No, you!"));
@ -290,17 +311,26 @@ public class Chat extends MiniPlugin
UtilPlayer.message(sender, F.main("Chat", "You are sending messages too fast."));
event.setCancelled(true);
}
else if (!_clientManager.Get(sender).GetRank().Has(Rank.MODERATOR) &&
_playerLastMessage.containsKey(sender.getName()) &&
_playerLastMessage.get(sender.getName()).equalsIgnoreCase(event.getMessage()))
else if (_playerLastMessage.containsKey(sender.getUniqueId()))
{
UtilPlayer.message(sender, F.main("Chat", "You can't repeat the same message."));
event.setCancelled(true);
}
else
{
_playerLastMessage.put(sender.getName(), event.getMessage());
MessageData lastMessage = _playerLastMessage.get(sender.getUniqueId());
long chatSlowTime = 1000L * _chatSlow;
long timeDiff = System.currentTimeMillis() - lastMessage.getTimeSent();
if (timeDiff < chatSlowTime && !_clientManager.Get(sender).GetRank().Has(Rank.HELPER))
{
UtilPlayer.message(sender, F.main("Chat", "Chat slow enabled. Please wait " + F.time(UtilTime.convertString(chatSlowTime - timeDiff, 1, UtilTime.TimeUnit.FIT))));
event.setCancelled(true);
}
else if (!_clientManager.Get(sender).GetRank().Has(Rank.MODERATOR) &&
lastMessage.getMessage().equalsIgnoreCase(event.getMessage()))
{
UtilPlayer.message(sender, F.main("Chat", "You can't repeat the same message."));
event.setCancelled(true);
}
}
if (!event.isCancelled())
_playerLastMessage.put(sender.getUniqueId(), new MessageData(event.getMessage()));
}
public String hasher(JSONArray hasharray, String message)
@ -530,6 +560,6 @@ public class Chat extends MiniPlugin
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
_playerLastMessage.remove(event.getPlayer().getName());
_playerLastMessage.remove(event.getPlayer().getUniqueId());
}
}

View File

@ -0,0 +1,28 @@
package mineplex.core.chat;
public class MessageData
{
private String _message;
private long _timeSent;
public MessageData(String message)
{
this(message, System.currentTimeMillis());
}
public MessageData(String message, long timeSent)
{
_message = message;
_timeSent = timeSent;
}
public String getMessage()
{
return _message;
}
public long getTimeSent()
{
return _timeSent;
}
}

View File

@ -0,0 +1,51 @@
package mineplex.core.chat.command;
import org.bukkit.entity.Player;
import mineplex.core.chat.Chat;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
public class ChatSlowCommand extends CommandBase<Chat>
{
public ChatSlowCommand(Chat plugin)
{
super(plugin, Rank.SNR_MODERATOR, "chatslow");
}
@Override
public void Execute(Player caller, String[] args)
{
if (args != null && args.length == 1)
{
try
{
int seconds = Integer.parseInt(args[0]);
if (seconds < 0)
{
UtilPlayer.message(caller, F.main("Chat", "Seconds must be a positive integer"));
return;
}
Plugin.setChatSlow(seconds, true);
UtilPlayer.message(caller, F.main("Chat", "Set chat slow to " + F.time(seconds + " seconds")));
}
catch (Exception e)
{
showUsage(caller);
}
}
else
{
showUsage(caller);
}
}
private void showUsage(Player caller)
{
UtilPlayer.message(caller, F.main("Chat", "Usage: /chatslow <seconds>"));
}
}

View File

@ -1,12 +1,13 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.ComplexButton;
import mineplex.core.shop.item.IButton;
public class ActivateGadgetButton extends ComplexButton
public class ActivateGadgetButton implements IButton
{
private Gadget _gadget;
private GadgetPage _page;
@ -18,26 +19,11 @@ public class ActivateGadgetButton extends ComplexButton
}
@Override
public void ClickedLeft(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.activateGadget(player, _gadget);
}
@Override
public void ClickedRight(Player player)
{
_page.handleRightClick(player, _gadget);
}
@Override
public void ClickedShiftLeft(Player player)
{
_page.activateGadget(player, _gadget);
}
@Override
public void ClickedShiftRight(Player player)
{
_page.handleRightClick(player, _gadget);
if (clickType.isLeftClick())
_page.activateGadget(player, _gadget);
else if (clickType.isRightClick())
_page.handleRightClick(player, _gadget);
}
}

View File

@ -1,13 +1,14 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class ActivateMountButton extends SingleButton
public class ActivateMountButton implements IButton
{
private Mount<?> _mount;
private MountPage _page;
@ -19,7 +20,7 @@ public class ActivateMountButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_mount.Enable(player);

View File

@ -1,13 +1,14 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.pet.Pet;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class ActivatePetButton extends SingleButton
public class ActivatePetButton implements IButton
{
private Pet _pet;
private PetPage _page;
@ -19,7 +20,7 @@ public class ActivatePetButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_page.getPlugin().getPetManager().AddPetOwner(player, _pet.GetPetType(), player.getLocation());

View File

@ -1,13 +1,13 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class CloseButton extends SingleButton
public class CloseButton implements IButton
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
player.closeInventory();
}

View File

@ -1,12 +1,13 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.ComplexButton;
import mineplex.core.shop.item.IButton;
public class DeactivateGadgetButton extends ComplexButton
public class DeactivateGadgetButton implements IButton
{
private Gadget _gadget;
private GadgetPage _page;
@ -17,27 +18,12 @@ public class DeactivateGadgetButton extends ComplexButton
_page = page;
}
@Override
public void ClickedLeft(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.deactivateGadget(player, _gadget);
}
@Override
public void ClickedRight(Player player)
{
_page.handleRightClick(player, _gadget);
}
if (clickType.isLeftClick())
_page.deactivateGadget(player, _gadget);
else if (clickType.isRightClick())
_page.handleRightClick(player, _gadget);
@Override
public void ClickedShiftLeft(Player player)
{
_page.deactivateGadget(player, _gadget);
}
@Override
public void ClickedShiftRight(Player player)
{
_page.handleRightClick(player, _gadget);
}
}

View File

@ -1,12 +1,13 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.mount.Mount;
public class DeactivateMountButton extends SingleButton
public class DeactivateMountButton implements IButton
{
private Mount<?> _mount;
private ShopPageBase<?,?> _page;
@ -17,8 +18,7 @@ public class DeactivateMountButton extends SingleButton
_page = page;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_mount.Disable(player);

View File

@ -1,12 +1,13 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.pet.PetManager;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ShopPageBase;
public class DeactivatePetButton extends SingleButton
public class DeactivatePetButton implements IButton
{
private ShopPageBase<?,?> _page;
private PetManager _petManager;
@ -17,8 +18,7 @@ public class DeactivatePetButton extends SingleButton
_petManager = petManager;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_petManager.RemovePet(player, true);

View File

@ -1,12 +1,13 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class GadgetButton extends SingleButton
public class GadgetButton implements IButton
{
private Gadget _gadget;
private GadgetPage _page;
@ -18,7 +19,7 @@ public class GadgetButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.purchaseGadget(player, _gadget);
}

View File

@ -1,8 +1,9 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.common.CurrencyType;
import mineplex.core.cosmetic.CosmeticManager;
@ -10,7 +11,7 @@ import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.mount.Mount;
public class MountButton extends SingleButton
public class MountButton implements IButton
{
private Mount<?> _mount;
private MountPage _page;
@ -22,7 +23,7 @@ public class MountButton extends SingleButton
}
@Override
public void Clicked(final Player player)
public void onClick(final Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
{

View File

@ -1,11 +1,12 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class OpenCostumes extends SingleButton
public class OpenCostumes implements IButton
{
private Menu _menu;
@ -15,7 +16,7 @@ public class OpenCostumes extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.openCostumes(player);
}

View File

@ -5,6 +5,7 @@ import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
public class OpenGadgets implements IButton
@ -17,8 +18,8 @@ public class OpenGadgets implements IButton
}
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer((Player)event.getWhoClicked(), new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", (Player)event.getWhoClicked()));
_page.getShop().OpenPageForPlayer(player, new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", player));
}
}

View File

@ -2,11 +2,12 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MorphPage;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class OpenMorphs extends SingleButton
public class OpenMorphs implements IButton
{
private Menu _page;
@ -15,8 +16,7 @@ public class OpenMorphs extends SingleButton
_page = page;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Morphs", player));
}

View File

@ -2,11 +2,12 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class OpenMounts extends SingleButton
public class OpenMounts implements IButton
{
private Menu _page;
@ -15,8 +16,7 @@ public class OpenMounts extends SingleButton
_page = page;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new MountPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player));
}

View File

@ -1,14 +1,15 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
/**
* Created by shaun on 14-09-15.
*/
public class OpenMusic extends SingleButton
public class OpenMusic implements IButton
{
private Menu _menu;
@ -17,8 +18,7 @@ public class OpenMusic extends SingleButton
_menu = menu;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.openMusic(player);
}

View File

@ -2,11 +2,12 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.ParticlePage;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class OpenParticles extends SingleButton
public class OpenParticles implements IButton
{
private Menu _page;
@ -15,8 +16,7 @@ public class OpenParticles extends SingleButton
_page = page;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new ParticlePage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player));
}

View File

@ -2,11 +2,12 @@ package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class OpenPets extends SingleButton
public class OpenPets implements IButton
{
private Menu _page;
@ -14,8 +15,9 @@ public class OpenPets extends SingleButton
{
_page = page;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new PetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player));
}

View File

@ -1,12 +1,13 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.pet.Pet;
import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class PetButton extends SingleButton
public class PetButton implements IButton
{
private Pet _pet;
private PetPage _page;
@ -17,8 +18,7 @@ public class PetButton extends SingleButton
_page = page;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.purchasePet(player, _pet);
}

View File

@ -2,12 +2,13 @@ package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.pet.Pet;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class RenamePetButton extends SingleButton
public class RenamePetButton implements IButton
{
private PetPage _page;
@ -17,7 +18,7 @@ public class RenamePetButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
Creature currentPet = _page.getPlugin().getPetManager().getActivePet(player.getName());

View File

@ -1,11 +1,12 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.PetTagPage;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class SelectTagButton extends SingleButton
public class SelectTagButton implements IButton
{
private PetTagPage _page;
@ -14,8 +15,7 @@ public class SelectTagButton extends SingleButton
_page = page;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.SelectTag();
}

View File

@ -1,11 +1,12 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.ComplexButton;
import mineplex.core.shop.item.IButton;
public class TreasureButton extends ComplexButton
public class TreasureButton implements IButton
{
private Menu _menu;
private boolean _hasEnoughChests;
@ -20,36 +21,24 @@ public class TreasureButton extends ComplexButton
_canPurchaseKey = canPurchaseKey;
}
@Override
public void ClickedLeft(Player player)
public void onClick(Player player, ClickType clickType)
{
if (_hasEnoughChests && _hasEnoughKeys)
if (clickType.isLeftClick())
{
_menu.openTreasure(player);
player.closeInventory();
if (_hasEnoughChests && _hasEnoughKeys)
{
_menu.openTreasure(player);
player.closeInventory();
}
else if (_hasEnoughChests && _canPurchaseKey)
{
_menu.attemptPurchaseKey(player);
}
}
else if (_hasEnoughChests && _canPurchaseKey)
else if (clickType.isRightClick())
{
_menu.attemptPurchaseKey(player);
if (_canPurchaseKey)
_menu.attemptPurchaseKey(player);
}
}
@Override
public void ClickedRight(Player player)
{
if (_canPurchaseKey)
_menu.attemptPurchaseKey(player);
}
@Override
public void ClickedShiftLeft(Player player)
{
ClickedLeft(player);
}
@Override
public void ClickedShiftRight(Player player)
{
ClickedRight(player);
}
}

View File

@ -6,6 +6,7 @@ import java.util.List;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C;
@ -16,8 +17,8 @@ import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
/**
* Created by shaun on 14-09-15.
@ -62,10 +63,9 @@ public class CostumePage extends GadgetPage
addGlow(slot);
}
AddButton(8, new ShopItem(Material.TNT, C.cRed + C.Bold + "Remove all Clothing", new String[] { }, 1, false), new SingleButton()
AddButton(8, new ShopItem(Material.TNT, C.cRed + C.Bold + "Remove all Clothing", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
boolean gadgetDisabled = false;
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.Costume))
@ -85,10 +85,9 @@ public class CostumePage extends GadgetPage
}
});
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}

View File

@ -6,6 +6,7 @@ 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.CurrencyType;
@ -20,8 +21,8 @@ import mineplex.core.gadget.gadgets.MorphNotch;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.ItemGadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
@ -51,10 +52,9 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
slot = 28;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
@ -25,8 +26,8 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureKey;
@ -120,10 +121,9 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
AddButton(18 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton()
new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
gadget.Disable(player);
@ -138,10 +138,9 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
AddButton(20 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton()
new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
gadget.Disable(player);
@ -156,10 +155,9 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
AddButton(22 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new SingleButton()
new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
gadget.Disable(player);
@ -174,10 +172,9 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
AddButton(24 + 9,
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), ChatColor.RESET + C.mItem + mount.GetName(), new String[] {}, 1, false, false),
new SingleButton()
new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
mount.Disable(player);
@ -189,10 +186,9 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
if (Plugin.getPetManager().hasActivePet(Player.getName()))
{
AddButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName(), new String[] {}, 1, false, false),
new SingleButton()
new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
Plugin.getPetManager().RemovePet(player, true);

View File

@ -2,6 +2,7 @@ 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;
@ -12,7 +13,7 @@ import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class MorphPage extends GadgetPage
{
@ -39,10 +40,9 @@ public class MorphPage extends GadgetPage
slot = 28;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}

View File

@ -6,6 +6,7 @@ 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.CurrencyType;
@ -18,9 +19,8 @@ import mineplex.core.cosmetic.ui.button.MountButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.mount.Mount;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
@ -77,10 +77,9 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
setItem(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}

View File

@ -2,6 +2,7 @@ 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;
@ -11,7 +12,7 @@ import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
/**
* Created by shaun on 14-09-15.
@ -37,10 +38,9 @@ public class MusicPage extends GadgetPage
slot = 28;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}

View File

@ -2,6 +2,7 @@ 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;
@ -13,7 +14,7 @@ import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class ParticlePage extends GadgetPage
{
@ -40,10 +41,9 @@ public class ParticlePage extends GadgetPage
slot = 28;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}

View File

@ -13,7 +13,9 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
@ -31,8 +33,8 @@ import mineplex.core.pet.Pet;
import mineplex.core.pet.PetExtra;
import mineplex.core.pet.types.Elf;
import mineplex.core.pet.types.Pumpkin;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.AnvilContainer;
import mineplex.core.shop.page.ShopPageBase;
@ -126,7 +128,7 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cWhite + "You must have an active pet to use this!");
getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle());
}
else
else if (Plugin.getPetManager().getActivePet(Player.getName()).getType() != EntityType.WITHER)
{
AddButton(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, "Rename " + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.Coins) + C.cGreen + " Coins", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this));
}
@ -134,10 +136,9 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
slot++;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}

View File

@ -10,23 +10,21 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.account.CoreClientManager;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ShopPageBase;
/**
* Created by Shaun on 8/22/2014.
*/
public class TreasurePage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
/**
* This is unfinished
* This is unfinished, and unused.
* TODO
*/
@ -115,10 +113,9 @@ public class TreasurePage extends ShopPageBase<CosmeticManager, CosmeticShop>
Player.playSound(Player.getEyeLocation(), Sound.NOTE_PLING, 4, 1);
final int slot = _chestSlots.poll();
AddButton(slot, new ShopItem(Material.CHEST, chestName, lore, 1, false), new SingleButton()
AddButton(slot, new ShopItem(Material.CHEST, chestName, lore, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
if (_canSelectChest)
{

View File

@ -118,6 +118,7 @@ public class GadgetManager extends MiniPlugin
addGadget(new MorphCreeper(this));
addGadget(new MorphBlaze(this));
//addGadget(new MorphGeno(this));
addGadget(new MorphWither(this));
// Particles
addGadget(new ParticleFoot(this));
@ -128,6 +129,8 @@ public class GadgetManager extends MiniPlugin
addGadget(new ParticleGreen(this));
addGadget(new ParticleHeart(this));
addGadget(new ParticleFairy(this));
addGadget(new ParticleLegend(this));
addGadget(new ParticleBlizzard(this));
// Music
addGadget(new MusicGadget(this, "13 Disc", new String[] {""}, -2, 2256, 178000));

View File

@ -0,0 +1,208 @@
package mineplex.core.gadget.gadgets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.entity.WitherSkull;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.disguises.DisguiseBase;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.types.MorphGadget;
public class MorphWither extends MorphGadget
{
private ArrayList<WitherSkull> _skulls = new ArrayList<WitherSkull>();
public MorphWither(GadgetManager manager)
{
super(manager, "Wither Morph", new String[]
{
C.cWhite + "Become a legendary Wither!",
" ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Wither Skull",
" ",
C.cPurple + "Unlocked with Legend Rank",
},
-1,
Material.SKULL_ITEM, (byte)1);
}
@Override
public void EnableCustom(final Player player)
{
this.ApplyArmor(player);
player.setMaxHealth(300);
player.setHealth(300);
DisguiseWither disguise = new DisguiseWither(player);
disguise.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
//disguise.setCustomNameVisible(true);
Manager.getDisguiseManager().disguise(disguise);
player.setMaxHealth(20);
player.setHealth(20);
}
@Override
public void DisableCustom(Player player)
{
this.RemoveArmor(player);
Manager.getDisguiseManager().undisguise(player);
player.setAllowFlight(false);
player.setFlying(false);
player.setMaxHealth(20);
player.setHealth(20);
}
@EventHandler
public void witherSkull(PlayerInteractEvent event)
{
Player player = event.getPlayer();
if (!IsActive(player))
return;
if (!UtilEvent.isAction(event, ActionType.L))
return;
if (!Recharge.Instance.use(player, GetName(), 1600, false, false))
return;
Vector offset = player.getLocation().getDirection();
if (offset.getY() < 0)
offset.setY(0);
_skulls.add(player.launchProjectile(WitherSkull.class));
//Effect
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SHOOT, 0.5f, 1f);
}
@EventHandler
public void explode(EntityExplodeEvent event)
{
if (!_skulls.contains(event.getEntity()))
return;
event.setCancelled(true);
WitherSkull skull = (WitherSkull)event.getEntity();
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, skull.getLocation(), 0, 0, 0, 0, 1);
skull.getWorld().playSound(skull.getLocation(), Sound.EXPLODE, 2f, 1f);
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 6);
for (Player player : players.keySet())
{
if (Manager.collideEvent(this, player))
continue;
double mult = players.get(player);
//Knockback
UtilAction.velocity(player, UtilAlg.getTrajectory(event.getLocation(), player.getLocation()), 2 * mult, false, 0, 0.6 + 0.4 * mult, 2, true);
}
}
@EventHandler
public void clean(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
Iterator<WitherSkull> skullIterator = _skulls.iterator();
while (skullIterator.hasNext())
{
WitherSkull skull = skullIterator.next();
if (!skull.isValid())
{
skullIterator.remove();
skull.remove();
continue;
}
}
}
@EventHandler
public void flight(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (player.getGameMode() == GameMode.CREATIVE)
continue;
player.setAllowFlight(true);
player.setFlying(true);
if (UtilEnt.isGrounded(player))
player.setVelocity(new Vector(0,1,0));
}
}
@EventHandler
public void legendOwner(PlayerJoinEvent event)
{
if (Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.LEGEND ||
Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.ADMIN ||
Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.DEVELOPER ||
Manager.getClientManager().Get(event.getPlayer()).GetRank() == Rank.OWNER)
{
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
}
}
public void setWitherData(String text, double healthPercent)
{
Iterator<Player> activeIterator = GetActive().iterator();
while (activeIterator.hasNext())
{
Player player = activeIterator.next();
DisguiseBase disguise = Manager.getDisguiseManager().getDisguise(player);
if (disguise == null || !(disguise instanceof DisguiseWither))
{
DisableCustom(player);
activeIterator.remove();
continue;
}
((DisguiseWither)disguise).setName(text);
((DisguiseWither)disguise).setHealth((float) (healthPercent * 300));
Manager.getDisguiseManager().updateDisguise(disguise);
}
}
}

View File

@ -0,0 +1,140 @@
package mineplex.core.gadget.gadgets;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
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.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleBlizzard extends ParticleGadget
{
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
public ParticleBlizzard(GadgetManager manager)
{
super(manager, "Frost Lord", new String[]
{
C.cWhite + "You are a mighty frost lord.",
C.cWhite + "Your double jumps and arrows",
C.cWhite + "are enchanted with snow powers.",
},
1,
Material.SNOW_BALL, (byte)0);
}
@EventHandler
public void playParticle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
if (Manager.isMoving(player))
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4);
}
else
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 5, 0), 1f, 0f, 1f, 0, 30);
}
}
}
@EventHandler
public void jump(PlayerToggleFlightEvent event)
{
if (!shouldDisplay(event.getPlayer()))
return;
if (!event.getPlayer().isFlying())
if (IsActive(event.getPlayer()))
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, event.getPlayer().getLocation(), 0f, 0f, 0f, 0.6f, 100);
}
@EventHandler
public void arrow(ProjectileLaunchEvent event)
{
if (Manager.hideParticles())
return;
if (event.getEntity() instanceof Arrow)
{
if (event.getEntity().getShooter() != null)
{
if (GetActive().contains(event.getEntity().getShooter()))
{
<<<<<<< HEAD
//UtilFirework.launchFirework(player.getEyeLocation(), Type.BALL, color(), true, true, new Vector(r(0.1),r(0.1),r(0.1)), 1);
=======
_arrows.add((Arrow)event.getEntity());
>>>>>>> chissbrokethis
}
}
}
}
@EventHandler
public void arrow(ProjectileHitEvent event)
{
if (!_arrows.remove(event.getEntity()))
return;
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, event.getEntity().getLocation(), 0f, 0f, 0f, 0.4f, 12);
}
@EventHandler
public void arrowClean(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Iterator<Arrow> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Arrow arrow = arrowIterator.next();
if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround())
{
arrowIterator.remove();
}
else
{
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, arrow.getLocation(), 0f, 0f, 0f, 0f, 1);
}
}
}
@EventHandler
public void death(BloodEvent event)
{
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setItem(Material.SNOW_BALL, (byte)0);
}
}

View File

@ -0,0 +1,43 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.gadget.GadgetManager;
public class ParticleLegend extends ParticleGadget
{
public ParticleLegend(GadgetManager manager)
{
super(manager, "Legendary Aura", new String[]
{
C.cWhite + "These mystic particle attach to",
C.cWhite + "only the most legendary of players!",
" ",
C.cPurple + "Unlocked with Legend Rank",
},
-2,
Material.ENDER_PORTAL, (byte)0);
}
@EventHandler
public void playParticle(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive())
{
if (!shouldDisplay(player))
continue;
player.getWorld().playEffect(player.getLocation().add(0, 1, 0), Effect.ENDER_SIGNAL, 0);
}
}
}

View File

@ -37,8 +37,6 @@ public abstract class ParticleGadget extends Gadget
if (player.getGameMode() != GameMode.SURVIVAL)
return false;
if (Manager.hideParticles())
return false;

View File

@ -12,6 +12,7 @@ import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
@ -25,6 +26,8 @@ public class LagMeter extends MiniPlugin
private double _ticksPerSecondAverage;
private long _lastAverage;
private long _lastTick = 0;
private HashSet<Player> _monitoring = new HashSet<Player>();
public LagMeter(JavaPlugin plugin, CoreClientManager clientManager)

View File

@ -41,7 +41,7 @@ public class PetFactory
_pets.put(EntityType.WOLF, new Pet("Dog", EntityType.WOLF, 8000));
_pets.put(EntityType.OCELOT, new Pet("Cat", EntityType.OCELOT, 6000));
_pets.put(EntityType.MUSHROOM_COW, new Pet("Mooshroom", EntityType.MUSHROOM_COW, 5000));
//_pets.put(EntityType.WITHER, new Pet("Widder", EntityType.SHEEP, 5));
_pets.put(EntityType.WITHER, new Pet("Widder", EntityType.WITHER, -1));
List<PetSalesToken> petTokens = new ArrayList<PetSalesToken>();

View File

@ -1,11 +1,13 @@
package mineplex.core.pet;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.MiniClientPlugin;
import mineplex.core.pet.repository.PetRepository;
import mineplex.core.pet.repository.token.ClientPetTokenWrapper;
import mineplex.core.pet.types.CustomWither;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.account.CoreClientManager;
@ -17,6 +19,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.EntityWither;
import net.minecraft.server.v1_7_R4.Navigation;
import org.bukkit.Bukkit;
@ -24,10 +27,13 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.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.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Villager;
import org.bukkit.entity.Zombie;
@ -35,6 +41,7 @@ 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.PlayerQuitEvent;
@ -140,7 +147,27 @@ public class PetManager extends MiniClientPlugin<PetClient>
return;
}
Creature pet = (Creature)_creatureModule.SpawnEntity(location, entityType);
Creature pet;
if (entityType == EntityType.WITHER)
{
_creatureModule.SetForce(true);
EntityWither wither = new CustomWither(((CraftWorld) location.getWorld()).getHandle());
wither.Silent = true;
wither.setLocation(location.getX(), location.getY(), location.getZ(), 0, 0);
((CraftWorld) location.getWorld()).getHandle().addEntity(wither, SpawnReason.CUSTOM);
pet = (Creature) wither.getBukkitEntity();
_creatureModule.SetForce(false);
Entity silverfish = _creatureModule.SpawnEntity(location, EntityType.SILVERFISH);
UtilEnt.Vegetate(silverfish, true);
((LivingEntity) silverfish).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
pet.setPassenger(silverfish);
}
else
{
pet = (Creature)_creatureModule.SpawnEntity(location, entityType);
}
//Named Pet
if (Get(player).GetPets().get(entityType) != null && Get(player).GetPets().get(entityType).length() > 0)
@ -367,4 +394,9 @@ public class PetManager extends MiniClientPlugin<PetClient>
for (Player player : UtilServer.getPlayers())
RemovePet(player, true);
}
public Collection<Creature> getPets()
{
return _activePetOwners.values();
}
}

View File

@ -0,0 +1,196 @@
package mineplex.core.pet.types;
import java.lang.reflect.Field;
import java.util.HashMap;
import org.bukkit.craftbukkit.v1_7_R4.SpigotTimings;
import org.bukkit.entity.EntityType;
import net.minecraft.server.v1_7_R4.EntityTypes;
import net.minecraft.server.v1_7_R4.EntityWither;
import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R4.World;
public class CustomWither extends EntityWither
{
static
{
try
{
Field f = EntityTypes.class.getDeclaredField("f");
f.setAccessible(true);
HashMap map = (HashMap) f.get(null);
map.put(CustomWither.class, (int) EntityType.WITHER.getTypeId());
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
private int bq;
public CustomWither(World world)
{
super(world);
s(530);
}
@Override
protected void bn()
{
this.aU += 1;
this.world.methodProfiler.a("checkDespawn");
w();
this.world.methodProfiler.b();
if (this.fromMobSpawner)
{
return;
}
this.world.methodProfiler.a("sensing");
this.getEntitySenses().a();
this.world.methodProfiler.b();
this.world.methodProfiler.a("targetSelector");
this.targetSelector.a();
this.world.methodProfiler.b();
this.world.methodProfiler.a("goalSelector");
this.goalSelector.a();
this.world.methodProfiler.b();
this.world.methodProfiler.a("navigation");
this.getNavigation().f();
this.world.methodProfiler.b();
this.world.methodProfiler.a("mob tick");
bp();
this.world.methodProfiler.b();
this.world.methodProfiler.a("controls");
this.world.methodProfiler.a("move");
this.getControllerMove().c();
this.world.methodProfiler.c("look");
this.getControllerLook().a();
this.world.methodProfiler.c("jump");
this.getControllerJump().b();
this.world.methodProfiler.b();
this.world.methodProfiler.b();
}
@Override
public void e()
{
if (this.bq > 0)
{
this.bq -= 1;
}
if (this.bg > 0)
{
double d0 = this.locX + (this.bh - this.locX) / this.bg;
double d1 = this.locY + (this.bi - this.locY) / this.bg;
double d2 = this.locZ + (this.bj - this.locZ) / this.bg;
double d3 = MathHelper.g(this.bk - this.yaw);
this.yaw = ((float) (this.yaw + d3 / this.bg));
this.pitch = ((float) (this.pitch + (this.bl - this.pitch) / this.bg));
this.bg -= 1;
if (!this.Vegetated)
{
setPosition(d0, d1, d2);
}
b(this.yaw, this.pitch);
}
else if (!br())
{
this.motX *= 0.98D;
this.motY *= 0.98D;
this.motZ *= 0.98D;
}
if (Math.abs(this.motX) < 0.005D)
{
this.motX = 0.0D;
}
if (Math.abs(this.motY) < 0.005D)
{
this.motY = 0.0D;
}
if (Math.abs(this.motZ) < 0.005D)
{
this.motZ = 0.0D;
}
this.world.methodProfiler.a("ai");
SpigotTimings.timerEntityAI.startTiming();
if (bh())
{
this.bc = false;
this.bd = 0.0F;
this.be = 0.0F;
this.bf = 0.0F;
}
else if (br())
{
if (bk())
{
this.world.methodProfiler.a("newAi");
bn();
this.world.methodProfiler.b();
}
else
{
this.world.methodProfiler.a("oldAi");
bq();
this.world.methodProfiler.b();
this.aO = this.yaw;
}
}
SpigotTimings.timerEntityAI.stopTiming();
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
if (this.bc)
{
if ((!M()) && (!P()))
{
if ((this.onGround) && (this.bq == 0))
{
bj();
this.bq = 10;
}
}
else
this.motY += 0.03999999910593033D;
}
else
{
this.bq = 0;
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("travel");
this.bd *= 0.98F;
this.be *= 0.98F;
this.bf *= 0.9F;
SpigotTimings.timerEntityAIMove.startTiming();
e(this.bd, this.be);
SpigotTimings.timerEntityAIMove.stopTiming();
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
if (!this.world.isStatic)
{
SpigotTimings.timerEntityAICollision.startTiming();
bo();
SpigotTimings.timerEntityAICollision.stopTiming();
}
this.world.methodProfiler.b();
}
@Override
protected float bf()
{
return 0.4F;
}
}

View File

@ -3,6 +3,7 @@ package mineplex.core.preferences.ui;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
import mineplex.core.account.CoreClientManager;
@ -51,90 +52,90 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
_toggleHubGames = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
toggleHubGames((Player)event.getWhoClicked());
toggleHubGames(player);
}
};
_toggleHubPlayers = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
toggleHubPlayers((Player)event.getWhoClicked());
toggleHubPlayers(player);
}
};
_toggleChat = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
toggleChat((Player)event.getWhoClicked());
toggleChat(player);
}
};
_togglePrivateChat = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
togglePrivateChat((Player)event.getWhoClicked());
togglePrivateChat(player);
}
};
_toggleHubPartyRequests = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
toggleHubPartyRequests((Player)event.getWhoClicked());
toggleHubPartyRequests(player);
}
};
_togglePendingFriendRequests = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
togglePendingFriendRequests((Player)event.getWhoClicked());
togglePendingFriendRequests(player);
}
};
_toggleHubInvisibility = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
toggleHubInvisibility((Player)event.getWhoClicked());
toggleHubInvisibility(player);
}
};
_toggleHubForcefield = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
toggleHubForcefield((Player)event.getWhoClicked());
toggleHubForcefield(player);
}
};
_toggleMacReports = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
toggleMacReports((Player)event.getWhoClicked());
toggleMacReports(player);
}
};
_toggleHubIgnoreVelocity = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
toggleHubIgnoreVelocity((Player)event.getWhoClicked());
toggleHubIgnoreVelocity(player);
}
};
}

View File

@ -1,12 +1,13 @@
package mineplex.core.punish.UI;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.punish.Category;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class PunishButton extends SingleButton
public class PunishButton implements IButton
{
private PunishPage _punishPage;
private Category _category;
@ -23,8 +24,7 @@ public class PunishButton extends SingleButton
_time = time;
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_punishPage.AddInfraction(_category, _severity, _ban, _time);
}

View File

@ -415,7 +415,8 @@ public class PunishPage extends CraftInventoryCustom implements Listener
{
if (_buttonMap.containsKey(event.getRawSlot()))
{
_buttonMap.get(event.getRawSlot()).Clicked(event);
if (event.getWhoClicked() instanceof Player)
_buttonMap.get(event.getRawSlot()).onClick(((Player) event.getWhoClicked()), event.getClick());
}
event.setCancelled(true);

View File

@ -1,12 +1,13 @@
package mineplex.core.punish.UI;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.punish.Punishment;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
public class RemovePunishmentButton extends SingleButton
public class RemovePunishmentButton implements IButton
{
private PunishPage _punishPage;
private Punishment _punishment;
@ -20,7 +21,7 @@ public class RemovePunishmentButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_punishPage.RemovePunishment(_punishment, _item);
}

View File

@ -1,31 +0,0 @@
package mineplex.core.shop.item;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
public abstract class ComplexButton implements IButton
{
@Override
public void Clicked(InventoryClickEvent event)
{
if (event.isLeftClick())
{
if (event.isShiftClick())
ClickedShiftLeft((Player) event.getWhoClicked());
else
ClickedLeft((Player) event.getWhoClicked());
}
if (event.isRightClick())
{
if (event.isShiftClick())
ClickedShiftRight((Player) event.getWhoClicked());
else
ClickedRight((Player) event.getWhoClicked());
}
}
public abstract void ClickedLeft(Player player);
public abstract void ClickedShiftLeft(Player player);
public abstract void ClickedRight(Player player);
public abstract void ClickedShiftRight(Player player);
}

View File

@ -1,8 +1,10 @@
package mineplex.core.shop.item;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
public interface IButton
{
public void Clicked(InventoryClickEvent event);
public void onClick(Player player, ClickType clickType);
}

View File

@ -1,15 +0,0 @@
package mineplex.core.shop.item;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
public abstract class SingleButton implements IButton
{
public abstract void Clicked(Player player);
@Override
public void Clicked(InventoryClickEvent event)
{
Clicked((Player)event.getWhoClicked());
}
}

View File

@ -19,6 +19,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends ShopBase<PluginType>> extends ShopPageBase<PluginType, ShopType> implements Runnable
@ -61,18 +62,18 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
IButton okClicked = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
OkClicked((Player)event.getWhoClicked());
OkClicked(player);
}
};
IButton cancelClicked = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
CancelClicked((Player)event.getWhoClicked());
CancelClicked(player);
}
};
@ -192,9 +193,9 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
IButton returnButton = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
CancelClicked((Player)event.getWhoClicked());
CancelClicked(player);
}
};
@ -212,9 +213,9 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
IButton returnButton = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
CancelClicked((Player)event.getWhoClicked());
CancelClicked(player);
}
};

View File

@ -3,11 +3,11 @@ package mineplex.core.shop.page;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventoryCustom;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
@ -15,7 +15,6 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilInv;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton;
@ -77,7 +76,7 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
protected abstract void BuildPage();
protected void AddItem(int slot, ShopItem item)
protected void AddItem(int slot, ItemStack item)
{
if (slot > inventory.getSize() - 1)
{
@ -85,7 +84,22 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
}
else
{
getInventory().setItem(slot, item.getHandle());
setItem(slot, item);
}
}
protected void AddItemFakeCount(int slot, ItemStack item, int fakeCount)
{
net.minecraft.server.v1_7_R4.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
nmsStack.count = fakeCount;
if (slot > inventory.getSize() - 1)
{
((CraftPlayer) Player).getHandle().inventory.setItem(getPlayerSlot(slot), nmsStack);
}
else
{
getInventory().setItem(slot, nmsStack);
}
}
@ -94,13 +108,20 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
return slot >= (inventory.getSize() + 27) ? slot - (inventory.getSize() + 27) : slot - (inventory.getSize() - 9);
}
protected void AddButton(int slot, ShopItem item, IButton button)
protected void AddButton(int slot, ItemStack item, IButton button)
{
AddItem(slot, item);
ButtonMap.put(slot, button);
}
protected void AddButtonFakeCount(int slot, ItemStack item, IButton button, int fakeItemCount)
{
AddItemFakeCount(slot, item, fakeItemCount);
ButtonMap.put(slot, button);
}
protected void addGlow(int slot)
{
UtilInv.addDullEnchantment(getItem(slot));
@ -116,7 +137,7 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
{
if (ButtonMap.containsKey(event.getRawSlot()))
{
ButtonMap.get(event.getRawSlot()).Clicked(event);
ButtonMap.get(event.getRawSlot()).onClick(Player, event.getClick());
}
else if (event.getRawSlot() != -999)
{

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Mineplex.Core" />
<orderEntry type="module" module-name="Mineplex.Core.Common" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.ClassCombat" />
<orderEntry type="module" module-name="Mineplex.Minecraft.Game.Core" />
<orderEntry type="library" name="craftbukkit" level="project" />
</component>
</module>

View File

@ -1,12 +1,13 @@
package mineplex.game.clans.shop;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.ComplexButton;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
public class PvpShopButton<PageType extends ShopPageBase<ClansManager, BuildingShop>> extends ComplexButton
public class PvpShopButton<PageType extends ShopPageBase<ClansManager, BuildingShop>> implements IButton
{
protected PageType Page;
protected PvpItem Item;
@ -16,27 +17,16 @@ public class PvpShopButton<PageType extends ShopPageBase<ClansManager, BuildingS
Page = page;
Item = item;
}
@Override
public void ClickedLeft(Player player)
{
int balance = Page.getDonationManager().Get(player.getName()).getGold();
}
@Override
public void ClickedShiftLeft(Player player)
public void onClick(Player player, ClickType clickType)
{
if (clickType == ClickType.LEFT)
{
int balance = Page.getDonationManager().Get(player.getName()).getGold();
}
}
@Override
public void ClickedRight(Player player)
{
}
@Override
public void ClickedShiftRight(Player player)
{
}
}

View File

@ -5,9 +5,11 @@ import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity;
@ -50,6 +52,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
@ -127,6 +130,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
private NewsManager _news;
private AchievementManager _achievementManager;
private TreasureManager _treasureManager;
private PetManager _petManager;
private Location _spawn;
private int _scoreboardTick = 0;
@ -180,6 +184,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
_treasureManager = new TreasureManager(_plugin, donationManager, _inventoryManager, petManager, _blockRestore, hologramManager);
new CosmeticManager(_plugin, clientManager, donationManager, _inventoryManager, _gadgetManager, _mountManager, petManager, _treasureManager);
_petManager = petManager;
_partyManager = partyManager;
_preferences = preferences;
_tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator);
@ -513,7 +518,15 @@ public class HubManager extends MiniClientPlugin<HubClient>
UtilTabTitle.setHeaderAndFooter(player, " ", "Visit " + C.cGreen + "www.mineplex.com" + ChatColor.RESET + " for News, Forums and Shop");
//Public Message
event.setJoinMessage(null);
if (_clientManager.Get(player).GetRank() != Rank.LEGEND)
event.setJoinMessage(null);
else
{
event.setJoinMessage(C.cGreen + C.Bold + "Legend " + player.getName() + " has joined!");
UtilFirework.playFirework(player.getEyeLocation(), org.bukkit.FireworkEffect.Type.BALL_LARGE, Color.LIME, true, true);
player.getWorld().playSound(player.getEyeLocation(), Sound.WITHER_SPAWN, 2f, 1f);
}
//Teleport
player.teleport(GetSpawn().add(0, 10, 0));
@ -888,6 +901,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
{
return _spawn.clone();
}
public PetManager getPetManager()
{
return _petManager;
}
public TutorialManager GetTutorial()
{

View File

@ -142,9 +142,9 @@ public class MailMessage implements Notification
}
@Override
public void clicked(final InventoryClickEvent event)
public void clicked(final Player player, ClickType clickType)
{
if (event.getClick() == ClickType.SHIFT_RIGHT)
if (clickType == ClickType.SHIFT_RIGHT)
{
_manager.archive(this, new Callback<Boolean>()
{
@ -153,7 +153,6 @@ public class MailMessage implements Notification
{
if (data)
{
Player player = (Player) event.getWhoClicked();
player.playSound(player.getLocation(), Sound.SPLASH, 1, 0);
}
}

View File

@ -20,6 +20,7 @@ import mineplex.core.disguise.disguises.DisguiseBat;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.disguise.disguises.DisguiseEnderman;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
@ -45,7 +46,8 @@ public class JumpManager extends MiniPlugin
//Chicken Cancel
DisguiseBase disguise = Manager.GetDisguise().getDisguise(player);
if (disguise != null && ((disguise instanceof DisguiseChicken && !((DisguiseChicken)disguise).isBaby()) || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman))
if (disguise != null &&
((disguise instanceof DisguiseChicken && !((DisguiseChicken)disguise).isBaby()) || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman || disguise instanceof DisguiseWither))
return;
event.setCancelled(true);

View File

@ -5,7 +5,9 @@ import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wither;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
@ -14,12 +16,14 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextTop;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.gadget.gadgets.MorphWither;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.mount.Mount;
import mineplex.core.mount.types.MountDragon;
import mineplex.core.updater.UpdateType;
@ -256,14 +260,30 @@ public class NewsManager extends MiniPlugin
UtilTextTop.display(text, UtilServer.getPlayers());
for (Creature pet : Manager.getPetManager().getPets())
{
if (pet instanceof Wither)
{
pet.setCustomName(text);
}
}
for (Mount mount : Manager.GetMount().getMounts())
{
if (mount instanceof MountDragon)
{
((MountDragon)mount).SetName(text);
((MountDragon)mount).setHealthPercent(healthPercent);
//((MountDragon)mount).setHealthPercent(healthPercent);
}
}
for (Gadget gadget : Manager.GetGadget().getGadgets(GadgetType.Morph))
{
if (gadget instanceof MorphWither)
{
((MorphWither)gadget).setWitherData(text, healthPercent);
}
}
}
@EventHandler

View File

@ -58,7 +58,7 @@ public class ParkourManager extends MiniPlugin
private HashSet<ParkourData> _parkour = new HashSet<ParkourData>();
private Location _snakeParkourReturn;
//private Location _snakeParkourReturn;
private Location _lavaParkourReturn;
private WeakHashMap<Player, Location> _lavaLocation = new WeakHashMap<Player, Location>();
private WeakHashMap<Player, Long> _lavaTimer = new WeakHashMap<Player, Long>();
@ -94,19 +94,19 @@ public class ParkourManager extends MiniPlugin
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
_parkour.add(new ParkourSnake("Snake Parkour", new String[]
{
"This parkour requires incredible timing",
"and great agility! Some say it was created",
"by the devil as a cruel joke!"
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
new Location(Manager.GetSpawn().getWorld(), 35,-200,-90), new Location(Manager.GetSpawn().getWorld(), -30,250,-46)));
// _parkour.add(new ParkourSnake("Snake Parkour", new String[]
// {
// "This parkour requires incredible timing",
// "and great agility! Some say it was created",
// "by the devil as a cruel joke!"
// }, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
// new Location(Manager.GetSpawn().getWorld(), 35,-200,-90), new Location(Manager.GetSpawn().getWorld(), -30,250,-46)));
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
_lavaParkourReturn.setYaw(90);
_snakeParkourReturn = new Location(Manager.GetSpawn().getWorld(), 16.5,72,-52.5);
_snakeParkourReturn.setYaw(180);
//_snakeParkourReturn = new Location(Manager.GetSpawn().getWorld(), 16.5,72,-52.5);
//_snakeParkourReturn.setYaw(180);
}
public boolean isParkourMode(Player player)
@ -259,24 +259,24 @@ public class ParkourManager extends MiniPlugin
event.getEntity().teleport(_lavaParkourReturn);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void snakeReturn(EntityDamageEvent event)
{
if (event.getCause() != DamageCause.VOID)
return;
if (!(event.getEntity() instanceof Player))
return;
Player player = (Player)event.getEntity();
if (!isParkourMode(player))
return;
event.getEntity().eject();
event.getEntity().leaveVehicle();
event.getEntity().teleport(_snakeParkourReturn);
}
// @EventHandler(priority = EventPriority.HIGHEST)
// public void snakeReturn(EntityDamageEvent event)
// {
// if (event.getCause() != DamageCause.VOID)
// return;
//
// if (!(event.getEntity() instanceof Player))
// return;
//
// Player player = (Player)event.getEntity();
//
// if (!isParkourMode(player))
// return;
//
// event.getEntity().eject();
// event.getEntity().leaveVehicle();
// event.getEntity().teleport(_snakeParkourReturn);
// }
@EventHandler
public void lavaBlockReturn(UpdateEvent event)
@ -458,14 +458,14 @@ public class ParkourManager extends MiniPlugin
}
}
@EventHandler
public void snakeUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER)
return;
for (ParkourData parkour : _parkour)
if (parkour instanceof ParkourSnake)
((ParkourSnake)parkour).Update();
}
// @EventHandler
// public void snakeUpdate(UpdateEvent event)
// {
// if (event.getType() != UpdateType.FASTER)
// return;
//
// for (ParkourData parkour : _parkour)
// if (parkour instanceof ParkourSnake)
// ((ParkourSnake)parkour).Update();
// }
}

View File

@ -12,6 +12,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Horse;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Wither;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent;
@ -48,7 +49,7 @@ public class StackerManager extends MiniPlugin implements IThrown
Manager = manager;
_projectileManager = new ProjectileManager(manager.GetPlugin());
}
}
@EventHandler
public void GrabEntity(PlayerInteractEntityEvent event)
@ -117,7 +118,7 @@ public class StackerManager extends MiniPlugin implements IThrown
if (stackee instanceof LivingEntity)
{
if (((LivingEntity)stackee).isCustomNameVisible())
if (Manager.getPetManager().getPets().contains(stackee) || stackee instanceof Wither || stackee instanceof EnderDragon || ((LivingEntity)stackee).isCustomNameVisible())
{
UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack this entity."));
return;

View File

@ -228,7 +228,7 @@ public class WorldManager extends MiniPlugin
@EventHandler
public void UpdateWeather(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
if (event.getType() != UpdateType.SEC)
return;
World world = UtilWorld.getWorld("world");

View File

@ -1,6 +1,8 @@
package mineplex.hub.notification.api;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
public interface Notification
@ -15,7 +17,7 @@ public interface Notification
public byte getData();
public void clicked(InventoryClickEvent event);
public void clicked(Player player, ClickType clickType);
public NotificationPriority getPriority();
}

View File

@ -30,8 +30,8 @@ public class NotificationButton implements IButton
}
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
_notification.clicked(event);
_notification.clicked(player, clickType);
}
}

View File

@ -16,6 +16,7 @@ import mineplex.hub.queue.QueueManager;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.event.inventory.InventoryClickEvent;
public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
@ -73,18 +74,18 @@ public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
IButton okClicked = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
OkClicked((Player)event.getWhoClicked());
OkClicked(player);
}
};
IButton cancelClicked = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
CancelClicked((Player)event.getWhoClicked());
CancelClicked(player);
}
};
@ -103,9 +104,9 @@ public class QueuePage extends ShopPageBase<QueueManager, QueueShop>
IButton queueButton = new IButton()
{
@Override
public void Clicked(InventoryClickEvent event)
public void onClick(Player player, ClickType clickType)
{
queuePlayer("Dominate", (Player)event.getWhoClicked());
queuePlayer("Dominate", player);
}
};

View File

@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank;
@ -14,8 +15,8 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilTime;
import mineplex.core.donation.DonationManager;
import mineplex.core.logger.Logger;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.hub.server.ServerInfo;
import mineplex.hub.server.ServerManager;
@ -246,10 +247,10 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
}
}
AddButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount + " Game" + (yellowCount == 1 ? "" : "s") + " In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 1 : yellowCount, false), new SingleButton()
AddButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount + " Game" + (yellowCount == 1 ? "" : "s") + " In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 1 : yellowCount, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_onMainPage = false;
}
@ -296,10 +297,10 @@ public class ServerNpcPage extends ShopPageBase<ServerManager, ServerNpcShop> im
}
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new SingleButton()
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
clear();
_onMainPage = true;

View File

@ -1,12 +1,13 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ServerInfo;
import mineplex.hub.server.ui.IServerPage;
public class JoinServerButton extends SingleButton
public class JoinServerButton implements IButton
{
private IServerPage _page;
private ServerInfo _serverInfo;
@ -18,7 +19,7 @@ public class JoinServerButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.SelectServer(player, _serverInfo);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectBHButton extends SingleButton
public class SelectBHButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectBHButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.OpenBH(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectBRButton extends SingleButton
public class SelectBRButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectBRButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.OpenBR(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectCSButton extends SingleButton
public class SelectCSButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectCSButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.openCS(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectDMTButton extends SingleButton
public class SelectDMTButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectDMTButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.openDMT(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectDOMButton extends SingleButton
public class SelectDOMButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectDOMButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.OpenDOM(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectMINButton extends SingleButton
public class SelectMINButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectMINButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.OpenMIN(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectMSButton extends SingleButton
public class SelectMSButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectMSButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.openMS(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectSGButton extends SingleButton
public class SelectSGButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectSGButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.OpenSG(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectSSMButton extends SingleButton
public class SelectSSMButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectSSMButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.OpenSSM(player);
}

View File

@ -1,11 +1,12 @@
package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectTDMButton extends SingleButton
public class SelectTDMButton implements IButton
{
private ServerGameMenu _menu;
@ -15,7 +16,7 @@ public class SelectTDMButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_menu.OpenTDM(player);
}

View File

@ -1,12 +1,13 @@
package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class DeleteCustomBuildButton extends SingleButton
public class DeleteCustomBuildButton implements IButton
{
private CustomBuildPage _page;
private CustomBuildToken _customBuild;
@ -18,7 +19,7 @@ public class DeleteCustomBuildButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.DeleteCustomBuild(_customBuild);
}

View File

@ -1,12 +1,13 @@
package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
public class DeselectItemButton extends SingleButton
public class DeselectItemButton implements IButton
{
private SkillPage _page;
private Item _item;
@ -20,7 +21,7 @@ public class DeselectItemButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.DeselectItem(player, _item, _index);
}

View File

@ -1,12 +1,13 @@
package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class EditAndSaveCustomBuildButton extends SingleButton
public class EditAndSaveCustomBuildButton implements IButton
{
private CustomBuildPage _page;
private CustomBuildToken _customBuild;
@ -18,7 +19,7 @@ public class EditAndSaveCustomBuildButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.EditAndSaveCustomBuild(_customBuild);
}

View File

@ -1,12 +1,13 @@
package mineplex.minecraft.game.classcombat.shop.button;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class PurchaseItemButton extends SingleButton
public class PurchaseItemButton implements IButton
{
private SkillPage _page;
private Item _item;
@ -18,7 +19,7 @@ public class PurchaseItemButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.PurchaseItem(player, _item);
}

View File

@ -1,12 +1,13 @@
package mineplex.minecraft.game.classcombat.shop.button;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.Skill.ISkill;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class PurchaseSkillButton extends SingleButton
public class PurchaseSkillButton implements IButton
{
private SkillPage _page;
private ISkill _skill;
@ -18,7 +19,7 @@ public class PurchaseSkillButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.PurchaseSkill(player, _skill);
}

View File

@ -1,12 +1,13 @@
package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.shop.page.ArmorPage;
public class SelectClassButton extends SingleButton
public class SelectClassButton implements IButton
{
ArmorPage _page;
private IPvpClass _pvpClass;
@ -18,7 +19,7 @@ public class SelectClassButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.SelectClass(player, _pvpClass);
}

View File

@ -1,12 +1,13 @@
package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class SelectCustomBuildButton extends SingleButton
public class SelectCustomBuildButton implements IButton
{
private CustomBuildPage _page;
private CustomBuildToken _customBuild;
@ -18,7 +19,7 @@ public class SelectCustomBuildButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
_page.SelectCustomBuild(_customBuild);
}

View File

@ -2,12 +2,13 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.ComplexButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
public class SelectItemButton extends ComplexButton
public class SelectItemButton implements IButton
{
private SkillPage _page;
private Item _item;
@ -19,34 +20,24 @@ public class SelectItemButton extends ComplexButton
_item = item;
_canAfford = canAfford;
}
@Override
public void ClickedLeft(Player player)
public void onClick(Player player, ClickType clickType)
{
if (!_canAfford)
if (clickType.isLeftClick())
{
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 1f, 0.5f);
return;
if (!_canAfford)
{
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 1f, 0.5f);
return;
}
_page.SelectItem(player, _item);
}
else if (clickType.isRightClick())
{
_page.DeselectItem(player, _item);
}
_page.SelectItem(player, _item);
}
@Override
public void ClickedRight(Player player)
{
_page.DeselectItem(player, _item);
}
@Override
public void ClickedShiftLeft(Player player)
{
ClickedLeft(player);
}
@Override
public void ClickedShiftRight(Player player)
{
ClickedRight(player);
}
}

View File

@ -2,13 +2,13 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.ComplexButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.Skill.ISkill;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
public class SelectSkillButton extends ComplexButton
public class SelectSkillButton implements IButton
{
private SkillPage _page;
private ISkill _skill;
@ -22,34 +22,24 @@ public class SelectSkillButton extends ComplexButton
_level = level;
_canAfford = canAfford;
}
@Override
public void ClickedLeft(Player player)
public void onClick(Player player, ClickType clickType)
{
if (!_canAfford)
if (clickType.isLeftClick())
{
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 1f, 0.5f);
return;
if (!_canAfford)
{
player.playSound(player.getLocation(), Sound.NOTE_BASS_GUITAR, 1f, 0.5f);
return;
}
_page.SelectSkill(player, _skill, _level);
}
else if (clickType.isRightClick())
{
_page.DeselectSkill(player, _skill);
}
_page.SelectSkill(player, _skill, _level);
}
@Override
public void ClickedRight(Player player)
{
_page.DeselectSkill(player, _skill);
}
@Override
public void ClickedShiftLeft(Player player)
{
ClickedLeft(player);
}
@Override
public void ClickedShiftRight(Player player)
{
ClickedRight(player);
}
}

View File

@ -13,6 +13,7 @@ import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.npc.NpcManager;
import mineplex.minecraft.game.core.combat.CombatManager;
@ -103,6 +104,8 @@ public class DamageManager extends MiniPlugin
//New Event
NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel);
//System.out.println(UtilEnt.getName(damagee) + " by " + event.getCause() + " at " + UtilWorld.locToStr(damagee.getLocation()));
event.setCancelled(true);
}

View File

@ -9,9 +9,11 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.EntityType;
@ -39,6 +41,7 @@ import mineplex.core.chat.Chat;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
@ -260,15 +263,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|| serverConfig.GameList.contains(GameType.ChampionsMOBA))
{
Energy energy = new Energy(plugin);
ItemFactory itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, energy,
_fire, _projectileManager, webAddress);
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
_conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
energy, webAddress);
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, itemFactory,
webAddress);
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, itemFactory, _achievementManager, clientManager);
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, false, "Class Shop");
_eloManager = new EloManager(_plugin, clientManager);
@ -513,12 +520,21 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler
public void MessageMOTD(ServerListPingEvent event)
{
//Mineplex Private Servers
// if (_gameHostManager.isHostExpired())
// {
// event.setMotd(ChatColor.RED + "Finished");
// return;
// }
//MPS
if (_gameHostManager != null && _gameHostManager.isPrivateServer())
{
if (_gameHostManager.isHostExpired())
{
event.setMotd(ChatColor.RED + "Finished");
return;
}
if (!GetServerConfig().PublicServer)
{
event.setMotd(ChatColor.GRAY + "Private");
return;
}
}
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName())
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
@ -556,7 +572,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation
public void MessageJoin(PlayerJoinEvent event)
{
if (_game == null || _game.AnnounceJoinQuit)
event.setJoinMessage(F.sys("Join", event.getPlayer().getName()));
{
Player player = event.getPlayer();
if (_clientManager.Get(player).GetRank() != Rank.LEGEND)
event.setJoinMessage(null);
else
{
event.setJoinMessage(C.cGreen + C.Bold + "Legend " + player.getName() + " has joined!");
UtilFirework.playFirework(player.getEyeLocation(), org.bukkit.FireworkEffect.Type.BALL_LARGE, Color.LIME, true, true);
player.getWorld().playSound(player.getEyeLocation(), Sound.WITHER_SPAWN, 2f, 1f);
}
}
else
event.setJoinMessage(null);
}

View File

@ -13,7 +13,7 @@ public enum GameType
ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0),
ChampionsMOBA("Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0),
Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0),
DeathTag("Death Tag", Material.SKULL, (byte)0),
DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0),
DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0),
DragonEscapeTeams("Dragon Escape Teams", Material.DRAGON_EGG, (byte)0),
DragonRiders("Dragon Riders", Material.DRAGON_EGG, (byte)0),
@ -56,19 +56,23 @@ public enum GameType
String _name;
String _lobbyName;
Material _mat;
Material _mat;
byte _data;
GameType(String name, Material mat, byte data)
{
_name = name;
_lobbyName = name;
_mat = mat;
_data = data;
}
GameType(String name, String lobbyName, Material mat, byte data)
{
_name = name;
_lobbyName = lobbyName;
_mat = mat;
_data = data;
}
public String GetName()

View File

@ -32,7 +32,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.gui.SpectatorShop;
import nautilus.game.arcade.gui.spectatorMenu.SpectatorShop;
public class CompassAddon extends MiniPlugin
{

View File

@ -69,21 +69,7 @@ public class SetCommand extends CommandBase<ArcadeManager>
}
GameType type = matches.get(0);
Plugin.GetGameCreationManager().SetNextGameType(type);
//End Current
if (Plugin.GetGame().GetState() == GameState.Recruit)
{
Plugin.GetGame().SetState(GameState.Dead);
Plugin.GetGame().Announce(C.cAqua + C.Bold + caller.getName() + " has changed game to " + type.GetName() + ".");
}
else
{
Plugin.GetGame().Announce(C.cAqua + C.Bold + caller.getName() + " set next game to " + type.GetName() + ".");
}
Plugin.GetGame().setGame(type, caller, true);
}
@Override

View File

@ -1075,6 +1075,9 @@ public abstract class Game implements Listener
public void Announce(String message)
{
if (message == null)
return;
Announce(message, true);
}
@ -1322,4 +1325,23 @@ public abstract class Game implements Listener
((CraftWorld) event.getWorld()).getHandle().spigotConfig.itemMerge = _itemMergeRadius;
}
}
public void setGame(GameType gameType, Player caller, boolean inform)
{
Manager.GetGameCreationManager().SetNextGameType(gameType);
//End Current
if (GetState() == GameState.Recruit)
{
SetState(GameState.Dead);
if (inform)
Announce(C.cAqua + C.Bold + caller.getName() + " has changed game to " + gameType.GetName() + ".");
}
else
{
if (inform)
Announce(C.cAqua + C.Bold + caller.getName() + " set next game to " + gameType.GetName() + ".");
}
}
}

View File

@ -35,6 +35,8 @@ public class GameServerConfig
public boolean PlayerKickIdle = true;
public boolean PublicServer = true;
public boolean IsValid()
{
return ServerType != null && MinPlayers != -1 && MaxPlayers != -1;

Some files were not shown because too many files have changed in this diff Show More