Merge branch 'chissbrokethis'

Conflicts:
	Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/ParticleBlizzard.java
This commit is contained in:
Chiss 2014-12-22 10:57:39 +11:00
commit 4a50e3ae62
110 changed files with 1596 additions and 560 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

@ -15,6 +15,9 @@ public enum Rank
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),

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

@ -131,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!"));

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

@ -15,6 +15,7 @@ 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;
@ -32,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;
@ -135,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

@ -1,19 +1,21 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
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.UtilFirework;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.gadget.types.ParticleGadget;
import mineplex.core.updater.UpdateType;
@ -22,15 +24,18 @@ import mineplex.core.gadget.GadgetManager;
public class ParticleBlizzard extends ParticleGadget
{
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
public ParticleBlizzard(GadgetManager manager)
{
super(manager, "Test", new String[]
super(manager, "Frost Lord", new String[]
{
C.cWhite + "",
C.cWhite + "You are a mighty frost lord.",
C.cWhite + "Your double jumps and arrows",
C.cWhite + "are enchanted with snow powers.",
},
1,
Material.FIREWORK, (byte)0);
Material.SNOW_BALL, (byte)0);
}
@EventHandler
@ -46,35 +51,90 @@ public class ParticleBlizzard extends ParticleGadget
if (Manager.isMoving(player))
{
for (int i=0 ; i<2 ; i++)
player.getWorld().playEffect(player.getLocation().add(r(1), Math.random() + 0.5, r(1)), Effect.COLOURED_DUST, 0);
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4);
}
else
{
for (int i=0 ; i<2 ; i++)
player.getWorld().playEffect(player.getLocation().add(r(2), Math.random() + 0.5, r(2)), Effect.COLOURED_DUST, 0);
if (Math.random() > 0.95)
{
//UtilFirework.launchFirework(player.getEyeLocation(), Type.BALL, color(), true, true, new Vector(r(0.1),r(0.1),r(0.1)), 1);
}
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation().add(0, 5, 0), 1f, 0f, 1f, 0, 30);
}
}
}
private Color color()
@EventHandler
public void jump(PlayerToggleFlightEvent event)
{
double r = Math.random();
if (!shouldDisplay(event.getPlayer()))
return;
if (r > 0.8) return Color.RED;
if (r > 0.6) return Color.YELLOW;
if (r > 0.4) return Color.LIME;
if (r > 0.2) return Color.AQUA;
else return Color.FUCHSIA;
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);
}
}
}
public double r(double mult)
@EventHandler
public void death(BloodEvent event)
{
return (Math.random() - 0.5)*mult;
if (event.getPlayer() == null)
return;
if (!IsActive(event.getPlayer()))
return;
if (!shouldDisplay(event.getPlayer()))
return;
event.setItem(Material.SNOW_BALL, (byte)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

@ -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

@ -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

@ -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

@ -526,6 +526,12 @@ public class ArcadeManager extends MiniPlugin implements IRelation
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName())
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
if (_gameHostManager.isPrivateServer() && _gameHostManager.isHostExpired())
{
event.setMotd(ChatColor.RED + "Finished");
return;
}
//Always Joinable
if (_game != null && _game.JoinInProgress)
{

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),
@ -63,12 +63,16 @@ public enum GameType
{
_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

@ -1322,4 +1322,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

@ -164,7 +164,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
event.GetDamagerPlayer(true).setFoodLevel(20);
//Effect
Host.Manager.GetBlood().Effects(event.GetDamageeEntity().getLocation(), 10, 0.2, null, 0f, 0f, Material.BLAZE_POWDER, (byte)0, 10, false);
Host.Manager.GetBlood().Effects(null, event.GetDamageeEntity().getLocation(), 10, 0.2, null, 0f, 0f, Material.BLAZE_POWDER, (byte)0, 10, false);
event.GetDamageeEntity().getWorld().playEffect(event.GetDamageeEntity().getLocation(), Effect.STEP_SOUND, 51);
//Remove
@ -423,7 +423,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
if (UtilMath.offset(loc, minion.getLocation()) > 16)
{
Host.Manager.GetBlood().Effects(minion.getEyeLocation(), 10, 0.2, Sound.SKELETON_HURT, 1f, 1f, Material.BONE, (byte)0, 20, false);
Host.Manager.GetBlood().Effects(null, minion.getEyeLocation(), 10, 0.2, Sound.SKELETON_HURT, 1f, 1f, Material.BONE, (byte)0, 20, false);
minion.teleport(loc);
continue;
}

View File

@ -1,12 +1,13 @@
package nautilus.game.arcade.game.games.searchanddestroy;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
public class EvolveButton extends SingleButton
public class EvolveButton implements IButton
{
private SearchAndDestroy _arcadeManager;
private Kit _kit;
@ -18,7 +19,7 @@ public class EvolveButton extends SingleButton
}
@Override
public void Clicked(Player player)
public void onClick(Player player, ClickType clickType)
{
// Make sure this player isn't a spectator
if (((CraftPlayer) player).getHandle().spectating)

View File

@ -0,0 +1,24 @@
package nautilus.game.arcade.gui.privateServer;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.page.MenuPage;
public class PrivateServerShop extends ShopBase<ArcadeManager>
{
public PrivateServerShop(ArcadeManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{
super(plugin, clientManager, donationManager, "Private Server Menu");
}
@Override
protected ShopPageBase<ArcadeManager, ? extends ShopBase<ArcadeManager>> BuildPagesFor(Player player)
{
return new MenuPage(Plugin, this, player);
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.gui.privateServer.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.page.BanPage;
public class BanButton implements IButton
{
private ArcadeManager _arcadeManager;
private PrivateServerShop _shop;
public BanButton(ArcadeManager arcadeManager, PrivateServerShop shop)
{
_shop = shop;
_arcadeManager = arcadeManager;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new BanPage(_arcadeManager, _shop, player));
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.gui.privateServer.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.page.EditRotationPage;
public class EditRotationButton implements IButton
{
private ArcadeManager _arcadeManager;
private PrivateServerShop _shop;
public EditRotationButton(ArcadeManager arcadeManager, PrivateServerShop shop)
{
_shop = shop;
_arcadeManager = arcadeManager;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new EditRotationPage(_arcadeManager, _shop, player));
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.gui.privateServer.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.page.GiveAdminPage;
public class GiveAdminButton implements IButton
{
private ArcadeManager _arcadeManager;
private PrivateServerShop _shop;
public GiveAdminButton(ArcadeManager arcadeManager, PrivateServerShop shop)
{
_shop = shop;
_arcadeManager = arcadeManager;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new GiveAdminPage(_arcadeManager, _shop, player));
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.gui.privateServer.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.page.OptionsPage;
public class OptionsButton implements IButton
{
private ArcadeManager _arcadeManager;
private PrivateServerShop _shop;
public OptionsButton(ArcadeManager arcadeManager, PrivateServerShop shop)
{
_shop = shop;
_arcadeManager = arcadeManager;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new OptionsPage(_arcadeManager, _shop, player));
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.gui.privateServer.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.page.SetGamePage;
public class SetGameButton implements IButton
{
private ArcadeManager _arcadeManager;
private PrivateServerShop _shop;
public SetGameButton(ArcadeManager arcadeManager, PrivateServerShop shop)
{
_shop = shop;
_arcadeManager = arcadeManager;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new SetGamePage(_arcadeManager, _shop, player));
}
}

View File

@ -0,0 +1,27 @@
package nautilus.game.arcade.gui.privateServer.button;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.page.UnbanPage;
public class UnbanButton implements IButton
{
private ArcadeManager _arcadeManager;
private PrivateServerShop _shop;
public UnbanButton(ArcadeManager arcadeManager, PrivateServerShop shop)
{
_shop = shop;
_arcadeManager = arcadeManager;
}
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new UnbanPage(_arcadeManager, _shop, player));
}
}

View File

@ -0,0 +1,33 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.entity.Player;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
public class BanPage extends PlayerPage
{
public BanPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Ban Players", player);
BuildPage();
}
@Override
public boolean showPlayer(Player player)
{
return !_manager.isAdmin(player);
}
@Override
public void clicked(int slot, Player player)
{
RemoveButton(slot);
_manager.ban(player);
}
@Override
public String getDisplayString(Player player)
{
return "Click to Ban Player";
}
}

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.gui.privateServer.page;
import java.util.Arrays;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import mineplex.core.common.util.C;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.managers.GameHostManager;
public abstract class BasePage extends ShopPageBase<ArcadeManager, PrivateServerShop>
{
protected GameHostManager _manager;
public BasePage(ArcadeManager plugin, PrivateServerShop shop, String pageName, Player player)
{
this(plugin, shop, pageName, player, 54);
}
public BasePage(ArcadeManager plugin, PrivateServerShop shop, String pageName, Player player, int slots)
{
super(plugin, shop, plugin.GetClients(), plugin.GetDonation(), pageName, player, slots);
_manager = plugin.GetGameHostManager();
}
public void addBackButton(int slot)
{
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(player, new MenuPage(Plugin, Shop, player));
}
});
}
public ItemStack getPlayerHead(String playerName, String title)
{
return getPlayerHead(playerName, title, null);
}
public ItemStack getPlayerHead(String playerName, String title, String[] lore)
{
ItemStack is = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
SkullMeta meta = ((SkullMeta) is.getItemMeta());
meta.setOwner(playerName);
meta.setDisplayName(title);
if (lore != null)
meta.setLore(Arrays.asList(lore));
is.setItemMeta(meta);
return is;
}
}

View File

@ -0,0 +1,72 @@
package nautilus.game.arcade.gui.privateServer.page;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
public class EditRotationPage extends BasePage
{
public EditRotationPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Edit Rotation", player);
BuildPage();
}
@Override
protected void BuildPage()
{
addBackButton(4);
int slot = 9;
List<GameType> enabledGames = Plugin.GetServerConfig().GameList;
for (GameType type : _manager.getAvailableGames(Player))
{
addGameButton(slot, type, enabledGames.contains(type));
slot++;
}
}
private void addGameButton(int slot, final GameType type, boolean enabled)
{
String titleString = ChatColor.RESET + (enabled ? C.cGreen : C.cRed) + ChatColor.BOLD + type.GetLobbyName();
String infoString = ChatColor.RESET + C.cGray + (enabled ? "Click to Disable" : "Click to Enable");
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), titleString, new String[]{infoString}, 1, false, false);
int itemCount = enabled ? 1 : 0;
AddButtonFakeCount(slot, shopItem, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
String announceString = C.Bold + type.GetLobbyName();
if (Plugin.GetServerConfig().GameList.contains(type))
{
Plugin.GetServerConfig().GameList.remove(type);
announceString = C.cRed + announceString + " removed from rotation.";
}
else
{
Plugin.GetServerConfig().GameList.add(type);
announceString = C.cGreen + announceString + " added to rotation.";
}
Plugin.GetGame().Announce(announceString);
Refresh();
}
}, itemCount);
if (enabled)
addGlow(slot);
}
}

View File

@ -0,0 +1,34 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.entity.Player;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
public class GiveAdminPage extends PlayerPage
{
public GiveAdminPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Give Admin", player);
BuildPage();
}
@Override
public boolean showPlayer(Player player)
{
return !_manager.isAdmin(player);
}
@Override
public void clicked(int slot, Player player)
{
RemoveButton(slot);
_manager.giveAdmin(player);
}
@Override
public String getDisplayString(Player player)
{
return "Click to Make Admin";
}
}

View File

@ -0,0 +1,55 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
import nautilus.game.arcade.gui.privateServer.button.BanButton;
import nautilus.game.arcade.gui.privateServer.button.EditRotationButton;
import nautilus.game.arcade.gui.privateServer.button.GiveAdminButton;
import nautilus.game.arcade.gui.privateServer.button.SetGameButton;
import nautilus.game.arcade.gui.privateServer.button.OptionsButton;
import nautilus.game.arcade.gui.privateServer.button.UnbanButton;
public class MenuPage extends BasePage
{
public MenuPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Private Server Menu", player, 9*3);
BuildPage();
}
@Override
protected void BuildPage()
{
ItemStack ownerHead = getOwnerHead();
setItem(4, ownerHead);
SetGameButton setGameButton = new SetGameButton(Plugin, Shop);
AddButton(1 + 9, new ShopItem(Material.BOOK_AND_QUILL, "Set Game", new String[] {}, 1, false), setGameButton);
EditRotationButton editRotationButton = new EditRotationButton(Plugin, Shop);
AddButton(1 + 18, new ShopItem(Material.BOOK, "Edit Game Rotation", new String[]{}, 1, false), editRotationButton);
GiveAdminButton giveAdminButton = new GiveAdminButton(Plugin, Shop);
AddButton(3 + 9, new ShopItem(Material.DIAMOND_SWORD, "Give Admin", new String[] {}, 1, false), giveAdminButton);
OptionsButton optionsButton = new OptionsButton(Plugin, Shop);
AddButton(5 + 9, new ShopItem(Material.REDSTONE_COMPARATOR, "Game Options", new String[] {}, 1, false), optionsButton);
BanButton banButton = new BanButton(Plugin, Shop);
AddButton(7 + 9, new ShopItem(Material.LAVA_BUCKET, "Ban Player", new String[] {}, 1, false), banButton);
UnbanButton unbanButton = new UnbanButton(Plugin, Shop);
AddButton(7 + 18, new ShopItem(Material.WATER_BUCKET, "Unban Player", new String[] {}, 1, false), unbanButton);
}
private ItemStack getOwnerHead()
{
return getPlayerHead(Plugin.GetHost(), ChatColor.RESET + "Host: " + ChatColor.YELLOW + Plugin.GetHost());
}
}

View File

@ -0,0 +1,129 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.GameServerConfig;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
public class OptionsPage extends BasePage
{
private GameServerConfig _config;
public OptionsPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Game Options", player);
_config = Plugin.GetServerConfig();
BuildPage();
}
@Override
protected void BuildPage()
{
addBackButton(4);
//TeamForceBalance
//GameAutoStart
//GameTimeout
//PlayerKickIdle
buildPreference(18, Material.LEVER, "Enforce Whitelist", true/* TODO */, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleWhitelist();
}
});
buildPreference(20, Material.BONE, "Force Team Balancing", _config.TeamForceBalance, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleTeamBalance();
}
});
buildPreference(22, Material.REDSTONE_TORCH_ON, "Game Auto Start", _config.GameAutoStart, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleAutoStart();
}
});
buildPreference(24, Material.COMPASS, "Game Timeout", _config.GameTimeout, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleTimeout();
}
});
buildPreference(26, Material.WATCH, "Kick Idle Players", _config.PlayerKickIdle, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
toggleKickIdle();
}
});
}
private void toggleTeamBalance()
{
_config.TeamForceBalance = !_config.TeamForceBalance;
Refresh();
}
private void toggleAutoStart()
{
_config.GameAutoStart = !_config.GameAutoStart;
Refresh();
}
private void toggleTimeout()
{
_config.GameTimeout = !_config.GameTimeout;
Refresh();
}
private void toggleKickIdle()
{
_config.PlayerKickIdle = !_config.PlayerKickIdle;
Refresh();
}
private void toggleWhitelist()
{
// TODO CHISSPIE
Refresh();
}
private void buildPreference(int index, Material material, String name, boolean preference, IButton button)
{
buildPreference(index, material, (byte) 0, name, preference, button);
}
private void buildPreference(int index, Material material, byte data, String name, boolean preference, IButton button)
{
String[] description = new String[] {
"" + (preference ? ChatColor.GREEN + "Enabled" : ChatColor.RED + "Disabled"),
ChatColor.RED + " ",
ChatColor.RESET + "Click to " + (preference ? "Disable" : "Enable") };
AddButton(index, new ShopItem(material, data, (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
AddButton(index + 9, new ShopItem(Material.INK_SACK, (preference ? (byte)10 : (byte)8), (preference ? ChatColor.GREEN : ChatColor.RED) + name, description, 1, false, false), button);
}
}

View File

@ -0,0 +1,66 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
public abstract class PlayerPage extends BasePage
{
public PlayerPage(ArcadeManager plugin, PrivateServerShop shop, String pageName, Player player)
{
super(plugin, shop, pageName, player);
}
@Override
protected void BuildPage()
{
addBackButton(4);
Player[] players = UtilServer.getPlayers();
int slot = 9;
for (Player player : players)
{
if (showPlayer(player))
{
ItemStack head = getPlayerHead(player.getName(), C.cGreen + C.Bold + player.getName(), new String[]{ ChatColor.RESET + C.cGray + getDisplayString(player) });
AddButton(slot, head, new Button(slot, player));
slot++;
}
}
}
public abstract boolean showPlayer(Player player);
public abstract void clicked(int slot, Player player);
public abstract String getDisplayString(Player player);
private class Button implements IButton
{
private int _slot;
private Player _player;
public Button(int slot, Player player)
{
_slot = slot;
_player = player;
}
@Override
public void onClick(Player player, ClickType clickType)
{
clicked(_slot, _player);
}
}
}

View File

@ -0,0 +1,49 @@
package nautilus.game.arcade.gui.privateServer.page;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import mineplex.core.common.util.C;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
public class SetGamePage extends BasePage
{
public SetGamePage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Set Game", player);
BuildPage();
}
@Override
protected void BuildPage()
{
addBackButton(4);
int slot = 9;
for (GameType type : _manager.getAvailableGames(Player))
{
addGameButton(slot, type);
slot++;
}
}
private void addGameButton(int slot, final GameType type)
{
String infoString = ChatColor.RESET + C.cGray + "Click to make this next Game Type";
ShopItem shopItem = new ShopItem(type.GetMaterial(), type.GetMaterialData(), type.GetLobbyName(), new String[]{infoString}, 1, false, false);
AddButton(slot, shopItem, new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
Plugin.GetGame().setGame(type, player, true);
player.closeInventory();
}
});
}
}

View File

@ -0,0 +1,65 @@
package nautilus.game.arcade.gui.privateServer.page;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.shop.item.IButton;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.gui.privateServer.PrivateServerShop;
public class UnbanPage extends BasePage
{
public UnbanPage(ArcadeManager plugin, PrivateServerShop shop, Player player)
{
super(plugin, shop, "Unban Players", player);
BuildPage();
}
@Override
protected void BuildPage()
{
addBackButton(4);
HashSet<String> blackList = _manager.getBlacklist();
Iterator<String> iterator = blackList.iterator();
int slot = 9;
while (iterator.hasNext())
{
String name = iterator.next();
ItemStack head = getPlayerHead(name, C.cGreen + C.Bold + name, new String[] {ChatColor.RESET + C.cGray + "Click to Unban"});
AddButton(slot, head, getUnbanButton(slot, name));
slot++;
}
// int arrayModifier = _currentPage * 9 * 4;
// for (int i = 0; i < _currentPage; i++)
// {
// int slot = 9 + i;
// ItemStack head = getPlayerHead(blackList.)
//
// }
}
private IButton getUnbanButton(final int slot, final String playerName)
{
return new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
_manager.getBlacklist().remove(playerName);
RemoveButton(slot);
}
};
}
}

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