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

This commit is contained in:
libraryaddict 2015-03-01 15:16:15 +13:00
commit 3b4075392a
254 changed files with 1924 additions and 1937 deletions

View File

@ -10,4 +10,7 @@
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="TaskProjectConfiguration">
<server type="JIRA" url="http://184.154.0.242:8080" />
</component>
</project>

View File

@ -428,7 +428,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_plugin.getServer().getPluginManager().callEvent(event);
final String finalEntityName = event.getCustomName();
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -30,35 +30,35 @@ public abstract class MiniPlugin implements Listener
onEnable();
RegisterEvents(this);
registerEvents(this);
}
public PluginManager GetPluginManager()
public PluginManager getPluginManager()
{
return _plugin.getServer().getPluginManager();
}
public BukkitScheduler GetScheduler()
public BukkitScheduler getScheduler()
{
return _plugin.getServer().getScheduler();
}
public JavaPlugin GetPlugin()
public JavaPlugin getPlugin()
{
return _plugin;
}
public void RegisterEvents(Listener listener)
public void registerEvents(Listener listener)
{
_plugin.getServer().getPluginManager().registerEvents(listener, _plugin);
}
public void RegisterSelf()
public void registerSelf()
{
RegisterEvents(this);
registerEvents(this);
}
public void DeregisterSelf()
public void deregisterSelf()
{
HandlerList.unregisterAll(this);
}
@ -67,23 +67,23 @@ public abstract class MiniPlugin implements Listener
{
long epoch = System.currentTimeMillis();
log("Initializing...");
Enable();
AddCommands();
enable();
addCommands();
log("Enabled in " + UtilTime.convertString(System.currentTimeMillis() - epoch, 1, TimeUnit.FIT) + ".");
}
public final void onDisable()
{
Disable();
disable();
log("Disabled.");
}
public void Enable() { }
public void enable() { }
public void Disable() { }
public void disable() { }
public void AddCommands() { }
public void addCommands() { }
public final String getName()
{

View File

@ -67,7 +67,7 @@ public class CoreClientManager extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new UpdateRank(this));
}
@ -185,7 +185,7 @@ public class CoreClientManager extends MiniPlugin
{
final CoreClient client = Add(playerName);
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -209,7 +209,7 @@ public class CoreClientManager extends MiniPlugin
// JSON sql response
Bukkit.getServer().getPluginManager().callEvent(new ClientWebResponseEvent(response, uuid));
Bukkit.getServer().getScheduler().runTask(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -37,7 +37,7 @@ public class AchievementManager extends MiniPlugin
public AchievementManager(StatsManager statsManager, CoreClientManager clientManager, DonationManager donationManager)
{
super("Achievement Manager", statsManager.GetPlugin());
super("Achievement Manager", statsManager.getPlugin());
_statsManager = statsManager;
_shop = new AchievementShop(this, _statsManager, clientManager, donationManager, "Achievement");
@ -114,7 +114,7 @@ public class AchievementManager extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new StatsCommand(this));
}

View File

@ -24,32 +24,32 @@ public class AchievementShop extends ShopBase<AchievementManager>
}
@Override
protected ShopPageBase<AchievementManager, ? extends ShopBase<AchievementManager>> BuildPagesFor(Player player)
protected ShopPageBase<AchievementManager, ? extends ShopBase<AchievementManager>> buildPagesFor(Player player)
{
return BuildPagesFor(player, player);
}
protected ShopPageBase<AchievementManager, ? extends ShopBase<AchievementManager>> BuildPagesFor(Player player, Player target)
{
return new AchievementMainPage(Plugin, _statsManager, this, ClientManager, DonationManager, target.getName() + "'s Stats", player, target);
return new AchievementMainPage(getPlugin(), _statsManager, this, getClientManager(), getDonationManager(), target.getName() + "'s Stats", player, target);
}
public boolean attemptShopOpen(Player player, Player target)
{
if (!OpenedShop.contains(player.getName()))
if (!getOpenedShop().contains(player.getName()))
{
if (!CanOpenShop(player))
if (!canOpenShop(player))
return false;
OpenedShop.add(player.getName());
getOpenedShop().add(player.getName());
OpenShopForPlayer(player);
if (!PlayerPageMap.containsKey(player.getName()))
openShopForPlayer(player);
if (!getPlayerPageMap().containsKey(player.getName()))
{
PlayerPageMap.put(player.getName(), BuildPagesFor(player, target));
getPlayerPageMap().put(player.getName(), BuildPagesFor(player, target));
}
OpenPageForPlayer(player, GetOpeningPageForPlayer(player));
openPageForPlayer(player, getOpeningPageForPlayer(player));
return true;
}

View File

@ -34,7 +34,7 @@ public class ArcadeButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new ArcadeMainPage(_achievementManager, _statsManager, _shop, _clientManager, _donationManager, "Arcade Games", player, _target));
_shop.openPageForPlayer(player, new ArcadeMainPage(_achievementManager, _statsManager, _shop, _clientManager, _donationManager, "Arcade Games", player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
}

View File

@ -40,7 +40,7 @@ public class CategoryButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_shop.OpenPageForPlayer(player, new AchievementPage(_achievementManager, _statsManager, _category, _shop, _clientManager, _donationManager, player, _target));
_shop.openPageForPlayer(player, new AchievementPage(_achievementManager, _statsManager, _category, _shop, _clientManager, _donationManager, player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
}

View File

@ -36,11 +36,11 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
_target = target;
_statsManager = statsManager;
BuildPage();
buildPage();
}
@Override
protected void BuildPage()
protected void buildPage()
{
int globalSlot = 4;
int normalSlot = 18;
@ -50,11 +50,11 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
if (category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)
continue;
CategoryButton button = new CategoryButton(Shop, Plugin, _statsManager, category, DonationManager, ClientManager, _target);
CategoryButton button = new CategoryButton(getShop(), getPlugin(), _statsManager, category, getDonationManager(), getClientManager(), _target);
ArrayList<String> lore = new ArrayList<String>();
lore.add(" ");
category.addStats(ClientManager, _statsManager, lore, category == AchievementCategory.GLOBAL ? 5 : 2, Player, _target);
category.addStats(getClientManager(), _statsManager, lore, category == AchievementCategory.GLOBAL ? 5 : 2, getPlayer(), _target);
lore.add(" ");
addAchievements(category, lore, 9);
lore.add(" ");
@ -75,17 +75,17 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
normalSlot = 36;
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false);
AddButton(slot, shopItem, button);
addButton(slot, shopItem, button);
}
addArcadeButton();
}
protected void addArcadeButton()
{
ArcadeButton button = new ArcadeButton(Shop, Plugin, _statsManager, DonationManager, ClientManager, _target);
ArcadeButton button = new ArcadeButton(getShop(), getPlugin(), _statsManager, getDonationManager(), getClientManager(), _target);
ShopItem shopItem = new ShopItem(Material.BOW, (byte) 0, C.Bold + "Arcade Games", new String[] {" ", ChatColor.RESET + "Click for more!"}, 1, false, false);
AddButton(44, shopItem, button);
addButton(44, shopItem, button);
}
protected void addAchievements(AchievementCategory category, List<String> lore, int max)
@ -100,7 +100,7 @@ public class AchievementMainPage extends ShopPageBase<AchievementManager, Achiev
if (achievement.getMaxLevel() > 1)
continue;
AchievementData data = Plugin.get(_target, achievement);
AchievementData data = getPlugin().get(_target, achievement);
boolean finished = data.getLevel() >= achievement.getMaxLevel();
lore.add((finished ? C.cGreen : C.cRed) + achievement.getName());

View File

@ -40,11 +40,11 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
_category = category;
_target = target;
BuildPage();
buildPage();
}
@Override
protected void BuildPage()
protected void buildPage()
{
int currentIndex = ACHIEVEMENT_MIDDLE_INDEX - (getAchievements().size() / 2);
boolean hasAllAchievements = true;
@ -56,7 +56,7 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
List<Achievement> achievements = getAchievements();
for (Achievement achievement : achievements)
{
AchievementData data = Plugin.get(_target, achievement);
AchievementData data = getPlugin().get(_target, achievement);
boolean singleLevel = achievement.isSingleLevel();
boolean hasUnlocked = data.getLevel() >= achievement.getMaxLevel();
@ -99,7 +99,7 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
}
AddItem(currentIndex, new ShopItem(material, (byte) (hasUnlocked ? 0 : 0), itemName, lore.toArray(new String[0]), 1, false, false));
addItem(currentIndex, new ShopItem(material, (byte) (hasUnlocked ? 0 : 0), itemName, lore.toArray(new String[0]), 1, false, false));
}
masterAchievementLore.add((hasUnlocked ? C.cGreen : C.cRed) + achievement.getName());
@ -113,7 +113,7 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
{
String itemName = ChatColor.RESET + _category.getFriendlyName() + " Master Achievement";
masterAchievementLore.add(" ");
if (Player.equals(_target))
if (getPlayer().equals(_target))
{
if (_category.getReward() != null)
masterAchievementLore.add(C.cYellow + C.Bold + "Reward: " + ChatColor.RESET + _category.getReward());
@ -121,7 +121,7 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
masterAchievementLore.add(C.cYellow + C.Bold + "Reward: " + ChatColor.RESET + "Coming Soon...");
}
AddItem(40, new ShopItem(hasAllAchievements ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, (byte)0, itemName, masterAchievementLore.toArray(new String[0]), 1, false, true));
addItem(40, new ShopItem(hasAllAchievements ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK, (byte) 0, itemName, masterAchievementLore.toArray(new String[0]), 1, false, true));
}
addBackButton();
@ -130,17 +130,18 @@ 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 IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
AchievementMainPage page;
if (_category.getGameCategory() == AchievementCategory.GameCategory.ARCADE)
page = new ArcadeMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, "Arcade Games", player, _target);
page = new ArcadeMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), "Arcade Games", player, _target);
else
page = new AchievementMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, _target.getName() + "'s Stats", player, _target);;
page = new AchievementMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), _target.getName() + "'s Stats", player, _target);
;
Shop.OpenPageForPlayer(Player, page);
getShop().openPageForPlayer(getPlayer(), page);
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
}
});
@ -156,7 +157,7 @@ public class AchievementPage extends ShopPageBase<AchievementManager, Achievemen
String itemName = C.Bold + _category.getFriendlyName() + " Stats";
List<String> lore = new ArrayList<String>();
lore.add(" ");
_category.addStats(ClientManager, _statsManager, lore, Player, _target);
_category.addStats(getClientManager(), _statsManager, lore, getPlayer(), _target);
ItemStack item = new ItemStack(material);
ItemMeta meta = item.getItemMeta();

View File

@ -30,7 +30,7 @@ public class ArcadeMainPage extends AchievementMainPage
}
@Override
protected void BuildPage()
protected void buildPage()
{
int slot = 10;
@ -39,11 +39,11 @@ public class ArcadeMainPage extends AchievementMainPage
if (category.getGameCategory() != AchievementCategory.GameCategory.ARCADE)
continue;
CategoryButton button = new CategoryButton(Shop, Plugin, _statsManager, category, DonationManager, ClientManager, _target);
CategoryButton button = new CategoryButton(getShop(), getPlugin(), _statsManager, category, getDonationManager(), getClientManager(), _target);
ArrayList<String> lore = new ArrayList<String>();
lore.add(" ");
category.addStats(ClientManager, _statsManager, lore, 2, Player, _target);
category.addStats(getClientManager(), _statsManager, lore, 2, getPlayer(), _target);
lore.add(" ");
addAchievements(category, lore, 9);
lore.add(" ");
@ -53,7 +53,7 @@ public class ArcadeMainPage extends AchievementMainPage
slot++;
ShopItem shopItem = new ShopItem(category.getIcon(), category.getIconData(), C.Bold + category.getFriendlyName(), lore.toArray(new String[0]), 1, false, false);
AddButton(slot, shopItem, button);
addButton(slot, shopItem, button);
slot += 2;
}
@ -63,11 +63,11 @@ public class ArcadeMainPage extends AchievementMainPage
private void addBackButton()
{
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new AchievementMainPage(Plugin, _statsManager, Shop, ClientManager, DonationManager, _target.getName() + "'s Stats", player, _target));
getShop().openPageForPlayer(getPlayer(), new AchievementMainPage(getPlugin(), _statsManager, getShop(), getClientManager(), getDonationManager(), _target.getName() + "'s Stats", player, _target));
player.playSound(player.getLocation(), Sound.CLICK, 1, 1);
}
});

View File

@ -379,7 +379,7 @@ public class AntiHack extends MiniPlugin
//Record
ServerListPingEvent event = new ServerListPingEvent(null, Bukkit.getServer().getMotd(), Bukkit.getServer().getOnlinePlayers().size(), Bukkit.getServer().getMaxPlayers());
GetPluginManager().callEvent(event);
getPluginManager().callEvent(event);
String motd = event.getMotd();
String game = "N/A";

View File

@ -27,7 +27,7 @@ public class Fly extends MiniPlugin implements Detector
public Fly (AntiHack host)
{
super("Fly Detector", host.GetPlugin());
super("Fly Detector", host.getPlugin());
Host = host;
}

View File

@ -25,7 +25,7 @@ public class Idle extends MiniPlugin implements Detector
public Idle (AntiHack host)
{
super("Idle Detector", host.GetPlugin());
super("Idle Detector", host.getPlugin());
Host = host;
}

View File

@ -29,7 +29,7 @@ public class Reach extends MiniPlugin implements Detector
public Reach (AntiHack host)
{
super("Speed Detector", host.GetPlugin());
super("Speed Detector", host.getPlugin());
Host = host;
}

View File

@ -26,7 +26,7 @@ public class Speed extends MiniPlugin implements Detector
public Speed (AntiHack host)
{
super("Speed Detector", host.GetPlugin());
super("Speed Detector", host.getPlugin());
Host = host;
}

View File

@ -36,7 +36,7 @@ public class BenefitManager extends MiniDbClientPlugin<BenefitData>
@EventHandler(priority = EventPriority.LOWEST)
public void giveBenefit(final PlayerJoinEvent event)
{
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -78,7 +78,7 @@ public class Chat extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new SilenceCommand(this));
addCommand(new BroadcastCommand(this));

View File

@ -98,7 +98,7 @@ public class CosmeticManager extends MiniPlugin
if (event.getItemDrop().getItemStack().getType() == Material.CHEST)
{
Bukkit.getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
Bukkit.getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -24,13 +24,13 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
{
super(plugin, clientManager, donationManager, name, CurrencyType.Gems, CurrencyType.Coins);
plugin.GetPlugin().getServer().getMessenger().registerIncomingPluginChannel(plugin.GetPlugin(), "MC|ItemName", this);
plugin.getPlugin().getServer().getMessenger().registerIncomingPluginChannel(plugin.getPlugin(), "MC|ItemName", this);
}
@Override
protected ShopPageBase<CosmeticManager, ? extends ShopBase<CosmeticManager>> BuildPagesFor(Player player)
protected ShopPageBase<CosmeticManager, ? extends ShopBase<CosmeticManager>> buildPagesFor(Player player)
{
return new Menu(Plugin, this, ClientManager, DonationManager, player);
return new Menu(getPlugin(), this, getClientManager(), getDonationManager(), player);
}
@Override
@ -39,13 +39,13 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
if (!channel.equalsIgnoreCase("MC|ItemName"))
return;
if (PlayerPageMap.containsKey(player.getName()) && PlayerPageMap.get(player.getName()) instanceof PetTagPage)
if (getPlayerPageMap().containsKey(player.getName()) && getPlayerPageMap().get(player.getName()) instanceof PetTagPage)
{
if (message != null && message.length >= 1)
{
String tagName = new String(message);
((PetTagPage)PlayerPageMap.get(player.getName())).SetTagName(tagName);
((PetTagPage) getPlayerPageMap().get(player.getName())).SetTagName(tagName);
}
}
}
@ -53,7 +53,7 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
@EventHandler
public void itemGadgetEmptyAmmo(ItemGadgetOutOfAmmoEvent event)
{
new GadgetPage(Plugin, this, ClientManager, DonationManager, "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget());
new GadgetPage(getPlugin(), this, getClientManager(), getDonationManager(), "Gadgets", event.getPlayer()).purchaseGadget(event.getPlayer(), event.getGadget());
}
@EventHandler
@ -62,7 +62,7 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
if (event.getType() != UpdateType.TICK)
return;
for (ShopPageBase<CosmeticManager, ? extends ShopBase<CosmeticManager>> shop : PlayerPageMap.values())
for (ShopPageBase<CosmeticManager, ? extends ShopBase<CosmeticManager>> shop : getPlayerPageMap().values())
{
if (shop instanceof TreasurePage)
((TreasurePage) shop).update();

View File

@ -22,8 +22,8 @@ public class ActivateMountButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_page.playAcceptSound(player);
_mount.Enable(player);
_page.getShop().OpenPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
}
}

View File

@ -22,8 +22,8 @@ public class ActivatePetButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_page.playAcceptSound(player);
_page.getPlugin().getPetManager().AddPetOwner(player, _pet.GetPetType(), player.getLocation());
_page.getShop().OpenPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
}
}

View File

@ -20,8 +20,8 @@ public class DeactivateMountButton implements IButton
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_page.playAcceptSound(player);
_mount.Disable(player);
_page.Refresh();
_page.refresh();
}
}

View File

@ -20,8 +20,8 @@ public class DeactivatePetButton implements IButton
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_page.playAcceptSound(player);
_petManager.RemovePet(player, true);
_page.Refresh();
_page.refresh();
}
}

View File

@ -25,12 +25,12 @@ public class MountButton implements IButton
@Override
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()
_page.getShop().openPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
{
public void run()
{
_page.getPlugin().getInventoryManager().addItemToInventory(null, player, "Mount", _mount.GetName(), 1);
_page.Refresh();
_page.refresh();
}
}, _page, _mount, CurrencyType.Coins, player));
}

View File

@ -19,6 +19,6 @@ public class OpenGadgets implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", player));
_page.getShop().openPageForPlayer(player, new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", player));
}
}

View File

@ -18,6 +18,6 @@ public class OpenMorphs implements IButton
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Morphs", player));
_page.getShop().openPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Morphs", player));
}
}

View File

@ -18,6 +18,6 @@ public class OpenMounts implements IButton
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new MountPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player));
_page.getShop().openPageForPlayer(player, new MountPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player));
}
}

View File

@ -18,6 +18,6 @@ public class OpenParticles implements IButton
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new ParticlePage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player));
_page.getShop().openPageForPlayer(player, new ParticlePage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player));
}
}

View File

@ -19,6 +19,6 @@ public class OpenPets implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new PetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player));
_page.getShop().openPageForPlayer(player, new PetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player));
}
}

View File

@ -20,7 +20,7 @@ public class RenamePetButton implements IButton
@Override
public void onClick(Player player, ClickType clickType)
{
_page.PlayAcceptSound(player);
_page.playAcceptSound(player);
Creature currentPet = _page.getPlugin().getPetManager().getActivePet(player.getName());
_page.renamePet(player, new Pet(currentPet.getCustomName(), currentPet.getType(), 1), false);
}

View File

@ -29,16 +29,16 @@ public class CostumePage extends GadgetPage
{
super(plugin, shop, clientManager, donationManager, name, player);
BuildPage();
buildPage();
}
protected void BuildPage()
protected void buildPage()
{
int slot;
List<Class> costumeClasses = new ArrayList<Class>();
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.Costume))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume))
{
OutfitGadget outfitGadget = ((OutfitGadget) gadget);
Class clazz = gadget.getClass();
@ -59,16 +59,16 @@ public class CostumePage extends GadgetPage
addGadget(gadget, slot);
if (gadget.IsActive(Player))
if (gadget.IsActive(getPlayer()))
addGlow(slot);
}
AddButton(8, new ShopItem(Material.TNT, C.cRed + C.Bold + "Remove all Clothing", new String[] { }, 1, false), new IButton()
addButton(8, new ShopItem(Material.TNT, C.cRed + C.Bold + "Remove all Clothing", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
boolean gadgetDisabled = false;
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.Costume))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Costume))
{
if (gadget.IsActive(player))
{
@ -79,17 +79,17 @@ public class CostumePage extends GadgetPage
if (gadgetDisabled)
{
BuildPage();
buildPage();
player.playSound(player.getEyeLocation(), Sound.SPLASH, 1, 1);
}
}
});
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
@ -98,16 +98,16 @@ public class CostumePage extends GadgetPage
{
if (gadget instanceof ItemGadget)
{
if (Plugin.getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0)
if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0)
{
purchaseGadget(player, gadget);
return;
}
}
PlayAcceptSound(player);
playAcceptSound(player);
gadget.Enable(player);
BuildPage();
buildPage();
}
}

View File

@ -32,18 +32,18 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
BuildPage();
buildPage();
}
protected void BuildPage()
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.Item))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Item))
{
addGadget(gadget, slot);
if (Plugin.getInventoryManager().Get(Player).getItemCount(gadget.GetDisplayName()) > 0)
if (getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetDisplayName()) > 0)
addGlow(slot);
slot++;
@ -52,11 +52,11 @@ 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 IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
@ -88,24 +88,24 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cGreen + "Right-Click To Purchase:");
itemLore.add(C.cWhite + ((ItemGadget)gadget).getAmmo().GetDisplayName() + " for " + C.cYellow + ((ItemGadget)gadget).getAmmo().GetCost(CurrencyType.Coins) + " Coins");
itemLore.add(C.cBlack);
itemLore.add(C.cWhite + "Your Ammo : " + C.cGreen + Plugin.getInventoryManager().Get(Player).getItemCount(gadget.GetName()));
itemLore.add(C.cWhite + "Your Ammo : " + C.cGreen + getPlugin().getInventoryManager().Get(getPlayer()).getItemCount(gadget.GetName()));
}
if (gadget.IsFree() || DonationManager.Get(Player.getName()).OwnsUnknownPackage(gadget.GetName()))
if (gadget.IsFree() || getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(gadget.GetName()))
{
if (gadget.GetActive().contains(Player))
if (gadget.GetActive().contains(getPlayer()))
{
AddButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Deactivate " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateGadgetButton(gadget, this));
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Deactivate " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateGadgetButton(gadget, this));
}
else
{
AddButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Activate " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this));
addButton(slot, new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), "Activate " + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateGadgetButton(gadget, this));
}
}
else
{
if (gadget.GetCost(CurrencyType.Coins) > 0 && DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins))
AddButton(slot, new ShopItem(Material.INK_SACK, (byte)8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new GadgetButton(gadget, this));
if (gadget.GetCost(CurrencyType.Coins) > 0 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= gadget.GetCost(CurrencyType.Coins))
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new GadgetButton(gadget, this));
else
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, (gadget.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + gadget.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
@ -113,31 +113,31 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void purchaseGadget(final Player player, final Gadget gadget)
{
Shop.OpenPageForPlayer(Player, new ConfirmationPage<CosmeticManager, CosmeticShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
getShop().openPageForPlayer(getPlayer(), new ConfirmationPage<CosmeticManager, CosmeticShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
{
public void run()
{
Plugin.getInventoryManager().addItemToInventory(Player, gadget.getGadgetType().name(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget)gadget).getAmmo().getQuantity() : gadget.getQuantity()));
Refresh();
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), gadget.getGadgetType().name(), gadget.GetName(), (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo().getQuantity() : gadget.getQuantity()));
refresh();
}
}, this, (gadget instanceof ItemGadget ? ((ItemGadget)gadget).getAmmo() : gadget), CurrencyType.Coins, Player));
}, this, (gadget instanceof ItemGadget ? ((ItemGadget) gadget).getAmmo() : gadget), CurrencyType.Coins, getPlayer()));
}
public void activateGadget(Player player, Gadget gadget)
{
if (gadget instanceof ItemGadget)
{
if (Plugin.getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0)
if (getPlugin().getInventoryManager().Get(player).getItemCount(gadget.GetName()) <= 0)
{
purchaseGadget(player, gadget);
return;
}
}
PlayAcceptSound(player);
playAcceptSound(player);
gadget.Enable(player);
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
public void handleRightClick(Player player, Gadget gadget)
@ -150,8 +150,8 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void deactivateGadget(Player player, Gadget gadget)
{
PlayAcceptSound(player);
playAcceptSound(player);
gadget.Disable(player);
Refresh();
refresh();
}
}

View File

@ -35,114 +35,114 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
{
super(plugin, shop, clientManager, donationManager, "Inventory", player);
BuildPage();
buildPage();
}
@Override
protected void BuildPage()
protected void buildPage()
{
AddItem(4, new ShopItem(175, DonationManager.Get(Player.getName()).getCoins() + " Coins", new String[]
addItem(4, new ShopItem(175, getDonationManager().Get(getPlayer().getName()).getCoins() + " Coins", new String[]
{
" ",
ChatColor.RESET + C.cYellow + "Purchase Coins",
ChatColor.RESET + "www.mineplex.com/shop",
" ",
ChatColor.RESET + C.cAqua + "Ultra Rank",
ChatColor.RESET + "Receives 7500 Coins per Month",
" ",
ChatColor.RESET + C.cPurple + "Hero Rank",
ChatColor.RESET + "Receives 15000 Coins per Month",
" ",
ChatColor.RESET + C.cYellow + "Purchase Coins",
ChatColor.RESET + "www.mineplex.com/shop",
" ",
ChatColor.RESET + C.cAqua + "Ultra Rank",
ChatColor.RESET + "Receives 7500 Coins per Month",
" ",
ChatColor.RESET + C.cPurple + "Hero Rank",
ChatColor.RESET + "Receives 15000 Coins per Month",
}, 1, false));
AddButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
AddButton(20, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
AddButton(22, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
AddButton(24, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
AddButton(26, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this));
addButton(18, new ShopItem(Material.NETHER_STAR, "Particle Effects", 1, false), new OpenParticles(this));
addButton(20, new ShopItem(Material.BOW, "Gadgets", 1, false), new OpenGadgets(this));
addButton(22, new ShopItem(Material.LEATHER, "Morphs", 1, false), new OpenMorphs(this));
addButton(24, new ShopItem(Material.IRON_BARDING, "Mounts", 1, false), new OpenMounts(this));
addButton(26, new ShopItem(Material.BONE, "Pets", 1, false), new OpenPets(this));
//
AddButton(48, new ShopItem(Material.GOLD_CHESTPLATE, "Costumes", 1, false), new OpenCostumes(this));
AddButton(50, new ShopItem(Material.GREEN_RECORD, "Music", 1, false), new OpenMusic(this));
addButton(48, new ShopItem(Material.GOLD_CHESTPLATE, "Costumes", 1, false), new OpenCostumes(this));
addButton(50, new ShopItem(Material.GREEN_RECORD, "Music", 1, false), new OpenMusic(this));
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Particle) != null)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle) != null)
{
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Particle);
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Particle);
AddButton(18 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
addButton(18 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
playAcceptSound(player);
gadget.Disable(player);
Refresh();
refresh();
}
});
}
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Item) != null)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Item) != null)
{
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Item);
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Item);
AddButton(20 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
addButton(20 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
playAcceptSound(player);
gadget.Disable(player);
Refresh();
refresh();
}
});
}
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Morph) != null)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) != null)
{
final Gadget gadget = Plugin.getGadgetManager().getActive(Player, GadgetType.Morph);
final Gadget gadget = getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph);
AddButton(22 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[] {}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
gadget.Disable(player);
Refresh();
}
});
}
if (Plugin.getMountManager().getActive(Player) != null)
{
final Mount<?> mount = Plugin.getMountManager().getActive(Player);
AddButton(24 + 9,
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), ChatColor.RESET + C.mItem + mount.GetName(), new String[] {}, 1, false, false),
addButton(22 + 9,
new ShopItem(gadget.GetDisplayMaterial(), gadget.GetDisplayData(), ChatColor.RESET + C.mItem + gadget.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
playAcceptSound(player);
gadget.Disable(player);
refresh();
}
});
}
if (getPlugin().getMountManager().getActive(getPlayer()) != null)
{
final Mount<?> mount = getPlugin().getMountManager().getActive(getPlayer());
addButton(24 + 9,
new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), ChatColor.RESET + C.mItem + mount.GetName(), new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
playAcceptSound(player);
mount.Disable(player);
Refresh();
refresh();
}
});
}
if (Plugin.getPetManager().hasActivePet(Player.getName()))
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()))
{
Creature activePet = Plugin.getPetManager().getActivePet(Player.getName());
Creature activePet = getPlugin().getPetManager().getActivePet(getPlayer().getName());
String petName = activePet.getType() == EntityType.WITHER ? "Widder" : activePet.getCustomName();
AddButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte)Plugin.getPetManager().getActivePet(Player.getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + petName, new String[] {}, 1, false, false),
addButton(26 + 9, new ShopItem(Material.MONSTER_EGG, (byte) getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType().getTypeId(), ChatColor.RESET + C.mItem + petName, new String[]{}, 1, false, false),
new IButton()
{
public void onClick(Player player, ClickType clickType)
{
PlayAcceptSound(player);
Plugin.getPetManager().RemovePet(player, true);
Refresh();
playAcceptSound(player);
getPlugin().getPetManager().RemovePet(player, true);
refresh();
}
});
}
@ -150,23 +150,23 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
public void openCostumes(Player player)
{
Shop.OpenPageForPlayer(player, new CostumePage(Plugin, Shop, ClientManager, DonationManager, "Costumes", player));
getShop().openPageForPlayer(player, new CostumePage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Costumes", player));
}
public void openMusic(Player player)
{
Shop.OpenPageForPlayer(player, new MusicPage(Plugin, Shop, ClientManager, DonationManager, "Music", player));
getShop().openPageForPlayer(player, new MusicPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Music", player));
}
public void attemptPurchaseKey(Player player)
{
Shop.OpenPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
getShop().openPageForPlayer(player, new ConfirmationPage<CosmeticManager, CosmeticShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
{
public void run()
{
Plugin.getInventoryManager().addItemToInventory(Player, "Treasure", "Treasure Key", 1);
Refresh();
getPlugin().getInventoryManager().addItemToInventory(getPlayer(), "Treasure", "Treasure Key", 1);
refresh();
}
}, this, new TreasureKey(), CurrencyType.Coins, Player));
}, this, new TreasureKey(), CurrencyType.Coins, getPlayer()));
}
}

View File

@ -11,7 +11,6 @@ import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.IButton;
@ -23,15 +22,15 @@ public class MorphPage extends GadgetPage
}
@Override
protected void BuildPage()
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.Morph))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Morph))
{
addGadget(gadget, slot);
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Morph) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
addGlow(slot);
slot++;
@ -40,11 +39,11 @@ public class MorphPage extends GadgetPage
slot = 28;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}

View File

@ -18,7 +18,6 @@ import mineplex.core.cosmetic.ui.button.DeactivateMountButton;
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.page.ShopPageBase;
@ -29,14 +28,14 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
BuildPage();
buildPage();
}
protected void BuildPage()
protected void buildPage()
{
int slot = 19;
for (Mount<?> mount : Plugin.getMountManager().getMounts())
for (Mount<?> mount : getPlugin().getMountManager().getMounts())
{
addMount(mount, slot);
slot++;
@ -58,30 +57,30 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
itemLore.add(C.cBlack);
itemLore.addAll(Arrays.asList(mount.GetDescription()));
if (DonationManager.Get(Player.getName()).OwnsUnknownPackage(mount.GetName()))
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(mount.GetName()))
{
if (mount.GetActive().containsKey(Player))
if (mount.GetActive().containsKey(getPlayer()))
{
AddButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Deactivate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this));
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Deactivate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivateMountButton(mount, this));
}
else
{
AddButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Activate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this));
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), "Activate " + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivateMountButton(mount, this));
}
}
else
{
if (mount.GetCost(CurrencyType.Coins) != -1 && DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins))
AddButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new MountButton(mount, this));
if (mount.GetCost(CurrencyType.Coins) != -1 && getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= mount.GetCost(CurrencyType.Coins))
addButton(slot, new ShopItem(mount.GetDisplayMaterial(), mount.GetDisplayData(), (mount.GetCost(CurrencyType.Coins) < 0 ? "" : "Purchase ") + mount.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new MountButton(mount, this));
else
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 IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}

View File

@ -24,11 +24,11 @@ public class MusicPage extends GadgetPage
super(plugin, shop, clientManager, donationManager, name, player);
}
protected void BuildPage()
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.MusicDisc))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.MusicDisc))
{
addGadget(gadget, slot);
@ -38,11 +38,11 @@ public class MusicPage extends GadgetPage
slot = 28;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}

View File

@ -11,8 +11,6 @@ import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.MorphGadget;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.IButton;
@ -24,15 +22,15 @@ public class ParticlePage extends GadgetPage
}
@Override
protected void BuildPage()
protected void buildPage()
{
int slot = 19;
for (Gadget gadget : Plugin.getGadgetManager().getGadgets(GadgetType.Particle))
for (Gadget gadget : getPlugin().getGadgetManager().getGadgets(GadgetType.Particle))
{
addGadget(gadget, slot);
if (Plugin.getGadgetManager().getActive(Player, GadgetType.Morph) == gadget)
if (getPlugin().getGadgetManager().getActive(getPlayer(), GadgetType.Morph) == gadget)
addGlow(slot);
slot++;
@ -41,11 +39,11 @@ public class ParticlePage extends GadgetPage
slot = 28;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}

View File

@ -12,7 +12,6 @@ import net.minecraft.server.v1_7_R4.PacketPlayOutSetSlot;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Creature;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
@ -28,7 +27,6 @@ import mineplex.core.cosmetic.ui.button.DeactivatePetButton;
import mineplex.core.cosmetic.ui.button.PetButton;
import mineplex.core.cosmetic.ui.button.RenamePetButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.Pet;
import mineplex.core.pet.PetExtra;
import mineplex.core.pet.types.Elf;
@ -44,14 +42,14 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
super(plugin, shop, clientManager, donationManager, name, player, 54);
BuildPage();
buildPage();
}
protected void BuildPage()
protected void buildPage()
{
int slot = 19;
List<Pet> pets = new ArrayList<Pet>(Plugin.getPetManager().GetFactory().GetPets());
List<Pet> pets = new ArrayList<Pet>(getPlugin().getPetManager().GetFactory().GetPets());
Collections.sort(pets, new PetSorter());
@ -82,27 +80,27 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
//Owned
if (DonationManager.Get(Player.getName()).OwnsUnknownPackage(pet.GetPetName()))
if (getDonationManager().Get(getPlayer().getName()).OwnsUnknownPackage(pet.GetPetName()))
{
String petName = Plugin.getPetManager().Get(Player).GetPets().get(pet.GetPetType());
String petName = getPlugin().getPetManager().Get(getPlayer()).GetPets().get(pet.GetPetType());
if (petName == null)
{
petName = pet.GetName();
}
if (Plugin.getPetManager().hasActivePet(Player.getName()) && Plugin.getPetManager().getActivePet(Player.getName()).getType() == pet.GetPetType())
if (getPlugin().getPetManager().hasActivePet(getPlayer().getName()) && getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() == pet.GetPetType())
{
AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(),
"Deactivate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, Plugin.getPetManager()));
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(),
"Deactivate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new DeactivatePetButton(this, getPlugin().getPetManager()));
addGlow(slot);
}
else
{
AddButton(slot, new ShopItem(Material.MONSTER_EGG, (byte)pet.GetPetType().getTypeId(),
"Activate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
addButton(slot, new ShopItem(Material.MONSTER_EGG, (byte) pet.GetPetType().getTypeId(),
"Activate " + pet.GetPetName() + " (" + C.cWhite + petName + C.cGreen + ")",
itemLore.toArray(new String[itemLore.size()]), 1, false, false), new ActivatePetButton(pet, this));
}
}
//Not Owned
@ -117,8 +115,8 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (pet.GetCost(CurrencyType.Coins) == -1)
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
else if (DonationManager.Get(Player.getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins))
AddButton(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new PetButton(pet, this));
else if (getDonationManager().Get(getPlayer().getName()).GetBalance(CurrencyType.Coins) >= pet.GetCost(CurrencyType.Coins))
addButton(slot, new ShopItem(Material.INK_SACK, (byte) 8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, false, false), new PetButton(pet, this));
else
setItem(slot, new ShopItem(Material.INK_SACK, (byte)8, "Purchase " + pet.GetPetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false));
}
@ -130,28 +128,28 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
slot = 49;
for (PetExtra petExtra : Plugin.getPetManager().GetFactory().GetPetExtras())
for (PetExtra petExtra : getPlugin().getPetManager().GetFactory().GetPetExtras())
{
List<String> itemLore = new ArrayList<String>();
if (!Plugin.getPetManager().hasActivePet(Player.getName()))
if (!getPlugin().getPetManager().hasActivePet(getPlayer().getName()))
{
itemLore.add(C.cWhite + "You must have an active pet to use this!");
getInventory().setItem(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, C.cRed + petExtra.GetName(), itemLore.toArray(new String[itemLore.size()]), 1, true, false).getHandle());
}
else if (Plugin.getPetManager().getActivePet(Player.getName()).getType() != EntityType.WITHER)
else if (getPlugin().getPetManager().getActivePet(getPlayer().getName()).getType() != EntityType.WITHER)
{
AddButton(slot, new ShopItem(petExtra.GetMaterial(), (byte)0, "Rename " + Plugin.getPetManager().getActivePet(Player.getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.Coins) + C.cGreen + " Coins", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this));
addButton(slot, new ShopItem(petExtra.GetMaterial(), (byte) 0, "Rename " + getPlugin().getPetManager().getActivePet(getPlayer().getName()).getCustomName() + " for " + C.cYellow + petExtra.GetCost(CurrencyType.Coins) + C.cGreen + " Coins", itemLore.toArray(new String[itemLore.size()]), 1, false, false), new RenamePetButton(this));
}
slot++;
}
AddButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[] { }, 1, false), new IButton()
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
}
});
}
@ -163,10 +161,10 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void renamePet(Player player, Pet pet, boolean petPurchase)
{
PlayAcceptSound(player);
playAcceptSound(player);
PetTagPage petTagPage = new PetTagPage(Plugin, Shop, ClientManager, DonationManager, "Repairing", Player, pet, petPurchase);
EntityPlayer entityPlayer = ((CraftPlayer)Player).getHandle();
PetTagPage petTagPage = new PetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Repairing", getPlayer(), pet, petPurchase);
EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle();
int containerCounter = entityPlayer.nextContainerCounter();
entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 0, true));
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory());
@ -174,13 +172,13 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
entityPlayer.activeContainer.addSlotListener(entityPlayer);
entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R4.ItemStack(Items.NAME_TAG)));
Shop.SetCurrentPageForPlayer(Player, petTagPage);
getShop().setCurrentPageForPlayer(getPlayer(), petTagPage);
}
public void deactivatePet(Player player)
{
PlayAcceptSound(player);
Plugin.getPetManager().RemovePet(player, true);
Refresh();
playAcceptSound(player);
getPlugin().getPetManager().RemovePet(player, true);
refresh();
}
}

View File

@ -10,7 +10,6 @@ import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.button.CloseButton;
import mineplex.core.cosmetic.ui.button.SelectTagButton;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.pet.Pet;
import mineplex.core.pet.PetExtra;
import mineplex.core.pet.repository.token.PetChangeToken;
@ -37,27 +36,27 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
_pet = pet;
_petPurchase = petPurchase;
BuildPage();
buildPage();
Player.setLevel(5);
getPlayer().setLevel(5);
}
@Override
protected void BuildPage()
protected void buildPage()
{
inventory.setItem(0, new ItemStack(Items.NAME_TAG));
ButtonMap.put(0, new CloseButton());
ButtonMap.put(1, new CloseButton());
ButtonMap.put(2, new SelectTagButton(this));
getButtonMap().put(0, new CloseButton());
getButtonMap().put(1, new CloseButton());
getButtonMap().put(2, new SelectTagButton(this));
}
@Override
public void PlayerClosed()
public void playerClosed()
{
super.PlayerClosed();
super.playerClosed();
Player.setLevel(0);
getPlayer().setLevel(0);
}
public void SelectTag()
@ -67,10 +66,10 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (_tagName.length() > 16)
{
UtilPlayer.message(Player, F.main(Plugin.getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
PlayDenySound(Player);
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
playDenySound(getPlayer());
Shop.OpenPageForPlayer(Player, new PetPage(Plugin, Shop, ClientManager, DonationManager, "Pets", Player));
getShop().openPageForPlayer(getPlayer(), new PetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pets", getPlayer()));
return;
}
@ -78,12 +77,12 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
_pet.setDisplayName(C.cGreen + "Purchase " + _tagName);
Shop.OpenPageForPlayer(Player, new ConfirmationPage<CosmeticManager, CosmeticShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
getShop().openPageForPlayer(getPlayer(), new ConfirmationPage<CosmeticManager, CosmeticShop>(getPlugin(), getShop(), getClientManager(), getDonationManager(), new Runnable()
{
public void run()
{
PetChangeToken token = new PetChangeToken();
token.Name = Player.getName();
token.Name = getPlayer().getName();
token.PetType = _pet.GetPetType().toString();
token.PetName = _tagName;
@ -92,21 +91,21 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (_petPurchase)
{
Plugin.getPetManager().GetRepository().AddPet(token);
Plugin.getPetManager().addPetOwnerToQueue(Player.getName(), _pet.GetPetType());
getPlugin().getPetManager().GetRepository().AddPet(token);
getPlugin().getPetManager().addPetOwnerToQueue(getPlayer().getName(), _pet.GetPetType());
}
else
{
Plugin.getPetManager().GetRepository().UpdatePet(token);
Plugin.getPetManager().addRenamePetToQueue(Player.getName(), token.PetName);
getPlugin().getPetManager().GetRepository().UpdatePet(token);
getPlugin().getPetManager().addRenamePetToQueue(getPlayer().getName(), token.PetName);
}
Plugin.getPetManager().Get(Player).GetPets().put(_pet.GetPetType(), token.PetName);
getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName);
Plugin.getInventoryManager().addItemToInventory(null, Player, "Pet", _pet.GetPetType().toString(), 1);
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, Player));
getPlugin().getInventoryManager().addItemToInventory(null, getPlayer(), "Pet", _pet.GetPetType().toString(), 1);
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
}
}, null, _petPurchase ? _pet : tag, CurrencyType.Coins, Player));
}, null, _petPurchase ? _pet : tag, CurrencyType.Coins, getPlayer()));
}
public void SetTagName(String tagName)

View File

@ -64,9 +64,9 @@ public class TreasurePage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
@Override
protected void BuildPage()
protected void buildPage()
{
int treasureCount = Plugin.getInventoryManager().Get(Player).getItemCount("Treasure Chest");
int treasureCount = getPlugin().getInventoryManager().Get(getPlayer()).getItemCount("Treasure Chest");
_rotationColorOne = _ticks % 2 == 0 ? ((short) _random.nextInt(15)) : _rotationColorOne;
_rotationColorTwo = _ticks % 20 == 0 ? ((short) _random.nextInt(15)) : _rotationColorTwo;
@ -96,11 +96,11 @@ public class TreasurePage extends ShopPageBase<CosmeticManager, CosmeticShop>
if (_ticks == 0)
{
Player.playSound(Player.getEyeLocation(), Sound.ANVIL_USE, 4, 1);
getPlayer().playSound(getPlayer().getEyeLocation(), Sound.ANVIL_USE, 4, 1);
}
else if (_ticks == 20)
{
Player.playSound(Player.getEyeLocation(), Sound.CHEST_OPEN, 4, 1);
getPlayer().playSound(getPlayer().getEyeLocation(), Sound.CHEST_OPEN, 4, 1);
}
else if (_ticks >= 30 && _ticks <= 120 && _ticks % 20 == 0)
{
@ -111,9 +111,9 @@ public class TreasurePage extends ShopPageBase<CosmeticManager, CosmeticShop>
String[] lore = new String[] { ChatColor.RESET.toString() + ChatColor.WHITE + "Click to Open" };
Player.playSound(Player.getEyeLocation(), Sound.NOTE_PLING, 4, 1);
getPlayer().playSound(getPlayer().getEyeLocation(), Sound.NOTE_PLING, 4, 1);
final int slot = _chestSlots.poll();
AddButton(slot, new ShopItem(Material.CHEST, chestName, lore, 1, false), new IButton()
addButton(slot, new ShopItem(Material.CHEST, chestName, lore, 1, false), new IButton()
{
public void onClick(Player player, ClickType clickType)
{
@ -127,7 +127,7 @@ public class TreasurePage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
else if (_ticks == 140)
{
Player.playSound(Player.getEyeLocation(), Sound.LEVEL_UP, 4, 1F);
getPlayer().playSound(getPlayer().getEyeLocation(), Sound.LEVEL_UP, 4, 1F);
ItemStack is = new ItemStack(Material.BOOK);
ItemMeta meta = is.getItemMeta();
meta.setDisplayName(ChatColor.RESET.toString() + "Select a Chest");
@ -169,7 +169,7 @@ public class TreasurePage extends ShopPageBase<CosmeticManager, CosmeticShop>
public void update()
{
BuildPage();
buildPage();
}
}

View File

@ -41,7 +41,7 @@ public class Creature extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new MobCommand(this));
}

View File

@ -56,7 +56,7 @@ public class KillCommand extends CommandBase<Creature>
}
CreatureKillEntitiesEvent event = new CreatureKillEntitiesEvent(killList);
Plugin.GetPlugin().getServer().getPluginManager().callEvent(event);
Plugin.getPlugin().getServer().getPluginManager().callEvent(event);
for (Entity entity : event.GetEntities())
{

View File

@ -235,7 +235,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
final List<Packet> armorPackets = tempArmor;
Bukkit.getServer().getScheduler().runTaskLater(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskLater(getPlugin(), new Runnable()
{
public void run()
{
@ -297,7 +297,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
final List<Packet> armorPackets = tempArmor;
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{
@ -597,7 +597,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20)
{
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{
@ -649,7 +649,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20)
{
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -38,7 +38,7 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new GemCommand(this));
addCommand(new CoinCommand(this));

View File

@ -81,7 +81,7 @@ public class EloManager extends MiniDbClientPlugin<EloClientData>
public void saveElo(final String uuid, final String gameType, final int elo)
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -62,7 +62,7 @@ public class FriendManager extends MiniDbClientPlugin<FriendData>
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new AddFriend(this));
addCommand(new DeleteFriend(this));
@ -150,7 +150,7 @@ public class FriendManager extends MiniDbClientPlugin<FriendData>
final boolean updateFinal = update;
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -218,7 +218,7 @@ public class FriendManager extends MiniDbClientPlugin<FriendData>
public void removeFriend(final Player caller, final String name)
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -74,7 +74,7 @@ public class AddFriendPage implements Listener
_friends = friends;
openInventory();
friends.RegisterEvents(this);
friends.registerEvents(this);
}
@EventHandler

View File

@ -72,9 +72,9 @@ public class BlockForm
//Inform
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false));
if (!blockName.contains("Block"))
UtilPlayer.message(_player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false) + " Block") + "!"));
UtilPlayer.message(_player, F.main("Morph", "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false) + " Block") + "!"));
else
UtilPlayer.message(_player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false)) + "!"));
UtilPlayer.message(_player, F.main("Morph", "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false)) + "!"));
//Sound
_player.playSound(_player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
@ -132,9 +132,9 @@ public class BlockForm
Bukkit.getServer().getPluginManager().callEvent(event);
//Not Able
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)) || event.getBlocks().isEmpty())
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)) || event.getBlocks().isEmpty() || event.isCancelled())
{
UtilPlayer.message(_player, F.main("Game", "You cannot become a Solid Block here."));
UtilPlayer.message(_player, F.main("Morph", "You cannot become a Solid Block here."));
_player.setExp(0f);
return;
}

View File

@ -1,7 +1,6 @@
package mineplex.core.gadget.gadgets;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton.SkeletonType;
@ -44,7 +43,7 @@ public class MorphPumpkinKing extends MorphGadget
player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{

View File

@ -38,7 +38,7 @@ public abstract class Gadget extends SalesPackageBase implements Listener
Manager = manager;
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
}
public GadgetType getGadgetType()

View File

@ -86,7 +86,7 @@ public abstract class ItemGadget extends Gadget
{
final Player player = event.getPlayer();
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{

View File

@ -73,7 +73,7 @@ public class IgnoreManager extends MiniDbClientPlugin<IgnoreData>
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new Ignore(this));
addCommand(new Unignore(this));
@ -136,7 +136,7 @@ public class IgnoreManager extends MiniDbClientPlugin<IgnoreData>
ignoreData.getIgnored().add(name);
}
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -175,7 +175,7 @@ public class IgnoreManager extends MiniDbClientPlugin<IgnoreData>
caller.sendMessage(F.main(getName(), "No longer ignoring " + ChatColor.GREEN + name + ChatColor.GRAY + "!"));
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -38,7 +38,7 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
_repository = new InventoryRepository(plugin);
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskLaterAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -151,7 +151,7 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
public void addItemToInventoryForOffline(final Callback<Boolean> callback, final String uuidString, final String category, final String item, final int count)
{
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -183,7 +183,7 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
if (callback != null)
{
Bukkit.getServer().getScheduler().runTask(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTask(getPlugin(), new Runnable()
{
public void run()
{
@ -244,7 +244,7 @@ public class InventoryManager extends MiniDbClientPlugin<ClientInventory>
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new GiveItemCommand(this));
}

View File

@ -12,8 +12,6 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
import net.minecraft.server.v1_7_R4.NBTTagByte;
import net.minecraft.server.v1_7_R4.NBTTagCompound;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -70,7 +68,7 @@ public class ItemStackFactory extends MiniPlugin
public void AddStatListener(Listener listener)
{
_statListeners.add(listener);
RegisterEvents(listener);
registerEvents(listener);
}
private void SetCustom()

View File

@ -65,7 +65,7 @@ public class LeaderboardManager extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new SetTournamentCommand(this));
}

View File

@ -62,7 +62,7 @@ public class Map implements Listener
ex.printStackTrace();
}
plugin.RegisterEvents(this);
plugin.registerEvents(this);
// Clear out the area to make room for the picture
{

View File

@ -59,7 +59,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
_ignoreManager = ignoreManager;
_punish = punish;
_friendsManager = friendManager;
_serverName = GetPlugin().getConfig().getString("serverstatus.name");
_serverName = getPlugin().getConfig().getString("serverstatus.name");
MessageHandler messageHandler = new MessageHandler(this);
@ -71,7 +71,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
.registerCommandType("RedisMessageCallback", RedisMessageCallback.class, messageHandler);
}
public void AddCommands()
public void addCommands()
{
addCommand(new MessageCommand(this));
addCommand(new ResendCommand(this));
@ -242,7 +242,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// Module Functions
@Override
public void Enable()
public void enable()
{
_randomMessage = new LinkedList<String>();
_randomMessage.clear();
@ -522,7 +522,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
};
// This will activate in 2 seconds
runnable.runTaskLater(GetPlugin(), 40);
runnable.runTaskLater(getPlugin(), 40);
// The key is the UUID its trading between servers
_messageTimeouts.put(uuid, runnable);

View File

@ -7,8 +7,6 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
@ -55,7 +53,7 @@ public class DragonData
Chicken.setPassenger(Rider);
Bukkit.getServer().getScheduler().runTaskLater(Host.Manager.GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTaskLater(Host.Manager.getPlugin(), new Runnable()
{
public void run()
{

View File

@ -14,7 +14,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.shop.item.SalesPackageBase;
@ -31,7 +30,7 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
Manager = manager;
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
}
@Override

View File

@ -22,7 +22,7 @@ public class Movement extends MiniClientPlugin<ClientMovement>
{
if (event.getType() == UpdateType.TICK)
{
for (Player cur : GetPlugin().getServer().getOnlinePlayers())
for (Player cur : getPlugin().getServer().getOnlinePlayers())
{
ClientMovement player = Get(cur);

View File

@ -130,7 +130,7 @@ public class NpcManager extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new NpcCommand(this));
}
@ -669,7 +669,7 @@ public class NpcManager extends MiniPlugin
public String getServerName()
{
String serverName = GetPlugin().getClass().getSimpleName();
String serverName = getPlugin().getClass().getSimpleName();
if (Bukkit.getMotd() != null && Bukkit.getMotd().equalsIgnoreCase("test"))
serverName += "-Test";

View File

@ -59,8 +59,8 @@ public class Party
public Party(PartyManager manager)
{
_manager = manager;
Region region = manager.GetPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
String groupName = manager.GetPlugin().getConfig().getString("serverstatus.group");
Region region = manager.getPlugin().getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
String groupName = manager.getPlugin().getConfig().getString("serverstatus.group");
ServerGroup serverGroup = ServerManager.getServerRepository(region).getServerGroup(groupName);

View File

@ -38,14 +38,14 @@ public class PartyManager extends MiniPlugin
_portal = portal;
_clientManager = clientManager;
_preferenceManager = preferenceManager;
_serverName = GetPlugin().getConfig().getString("serverstatus.name");
_serverName = getPlugin().getConfig().getString("serverstatus.name");
ServerCommandManager.getInstance().registerCommandType("RedisPartyData", RedisPartyData.class,
new RedisPartyHandler(this));
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new PartyCommand(this));
}

View File

@ -97,7 +97,7 @@ public class PersonalServerManager extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new HostServerCommand(this));
}
@ -106,10 +106,10 @@ public class PersonalServerManager extends MiniPlugin
{
try
{
GetPlugin().getConfig().addDefault("serverstatus.us", true);
GetPlugin().getConfig().set("serverstatus.us", GetPlugin().getConfig().getBoolean("serverstatus.us"));
getPlugin().getConfig().addDefault("serverstatus.us", true);
getPlugin().getConfig().set("serverstatus.us", getPlugin().getConfig().getBoolean("serverstatus.us"));
GetPlugin().saveConfig();
getPlugin().saveConfig();
}
catch (Exception e)
{
@ -119,12 +119,23 @@ public class PersonalServerManager extends MiniPlugin
public void hostServer(Player player, String serverName)
{
createGroup(player, serverName, 12, 24, "Smash");
int ram = 1024;
int cpu = 1;
Rank rank = _clientManager.Get(player).GetRank();
if (rank.Has(Rank.SNR_MODERATOR) || rank == Rank.YOUTUBE)
{
ram = 2048;
cpu = 3;
}
createGroup(player, serverName, ram, cpu, 12, 24, "Smash");
}
private void createGroup(final Player host, final String serverName, final int minPlayers, final int maxPlayers, final String games)
private void createGroup(final Player host, final String serverName, final int ram, final int cpu, final int minPlayers, final int maxPlayers, final String games)
{
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -141,15 +152,15 @@ public class PersonalServerManager extends MiniPlugin
}
}
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), 1024, 1, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
final ServerGroup serverGroup = new ServerGroup(serverName, serverName, host.getName(), ram, cpu, 1, 0, UtilMath.random.nextInt(250) + 19999, true, "arcade.zip", "Arcade.jar", "plugins/Arcade/", minPlayers, maxPlayers,
true, false, false, games, "Player", true, false, true, false, true, true, false, false, false, false, true, true, true, false, false, "", _us ? Region.US : Region.EU);
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
_repository.updateServerGroup(serverGroup);
Bukkit.getScheduler().runTask(GetPlugin(), new Runnable()
Bukkit.getScheduler().runTask(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -21,7 +21,7 @@ public class ServerCommand extends CommandBase<Portal>
public void Execute(final Player player, final String[] args)
{
final Rank playerRank = CommandCenter.GetClientManager().Get(player).GetRank();
final String serverName = Plugin.GetPlugin().getConfig().getString("serverstatus.name");
final String serverName = Plugin.getPlugin().getConfig().getString("serverstatus.name");
if (args == null || args.length == 0)
{

View File

@ -7,6 +7,7 @@ import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
@ -52,7 +53,7 @@ public class Portal extends MiniPlugin
_region = plugin.getConfig().getBoolean("serverstatus.us") ? Region.US : Region.EU;
_repository = ServerManager.getServerRepository(_region);
Bukkit.getMessenger().registerOutgoingPluginChannel(GetPlugin(), "BungeeCord");
Bukkit.getMessenger().registerOutgoingPluginChannel(getPlugin(), "BungeeCord");
// Register the server command type for future use
ServerCommandManager.getInstance().registerCommandType("TransferCommand", TransferCommand.class, new TransferHandler());
@ -132,13 +133,13 @@ public class Portal extends MiniPlugin
if (callback == null)
return;
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
final boolean serverExists = ServerManager.getServerRepository(_region).serverExists(serverName);
Bukkit.getScheduler().runTask(GetPlugin(), new Runnable()
Bukkit.getScheduler().runTask(getPlugin(), new Runnable()
{
public void run()
{
@ -149,12 +150,25 @@ public class Portal extends MiniPlugin
});
}
public void AddCommands()
public void addCommands()
{
addCommand(new ServerCommand(this));
addCommand(new SendCommand(this));
}
public void sendToHub(Player player, String message)
{
if (message != null)
{
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cGold + C.Bold + message);
UtilPlayer.message(player, " ");
}
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
sendPlayerToServer(player, "Lobby");
}
private void sendPlayer(final Player player, String serverName)
{
ByteArrayOutputStream b = new ByteArrayOutputStream();
@ -181,10 +195,10 @@ public class Portal extends MiniPlugin
}
}
player.sendPluginMessage(GetPlugin(), "BungeeCord", b.toByteArray());
player.sendPluginMessage(getPlugin(), "BungeeCord", b.toByteArray());
_connectingPlayers.add(player.getName());
GetScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -48,9 +48,9 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
{
try
{
GetPlugin().getConfig().addDefault("preferences.connectionurl", "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10");
GetPlugin().getConfig().set("preferences.connectionurl", GetPlugin().getConfig().getString("preferences.connectionurl"));
GetPlugin().saveConfig();
getPlugin().getConfig().addDefault("preferences.connectionurl", "jdbc:mysql://db.mineplex.com:3306/Account?autoReconnect=true&failOverReadOnly=false&maxReconnects=10");
getPlugin().getConfig().set("preferences.connectionurl", getPlugin().getConfig().getString("preferences.connectionurl"));
getPlugin().saveConfig();
}
catch (Exception e)
{
@ -84,7 +84,7 @@ public class PreferencesManager extends MiniDbClientPlugin<UserPreferences>
_saveBuffer.clear();
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -4,7 +4,6 @@ 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;
import mineplex.core.common.Rank;
@ -44,7 +43,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
super(plugin, shop, clientManager, donationManager, name, player, 54);
createButtons();
BuildPage();
buildPage();
}
private void createButtons()
@ -152,96 +151,96 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
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);
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);
}
protected void toggleHubForcefield(org.bukkit.entity.Player player)
{
Plugin.Get(player).HubForcefield = !Plugin.Get(player).HubForcefield;
getPlugin().Get(player).HubForcefield = !getPlugin().Get(player).HubForcefield;
_hubForcefieldToggled = !_hubForcefieldToggled;
BuildPage();
buildPage();
}
protected void toggleHubInvisibility(org.bukkit.entity.Player player)
{
Plugin.Get(player).Invisibility = !Plugin.Get(player).Invisibility;
getPlugin().Get(player).Invisibility = !getPlugin().Get(player).Invisibility;
_hubInvisibilityToggled = !_hubInvisibilityToggled;
BuildPage();
buildPage();
}
protected void toggleHubPartyRequests(org.bukkit.entity.Player player)
{
Plugin.Get(player).PartyRequests = !Plugin.Get(player).PartyRequests;
getPlugin().Get(player).PartyRequests = !getPlugin().Get(player).PartyRequests;
_hubPartyRequestsToggled = !_hubPartyRequestsToggled;
BuildPage();
buildPage();
}
protected void togglePendingFriendRequests(org.bukkit.entity.Player player)
{
Plugin.Get(player).PendingFriendRequests = !Plugin.Get(player).PendingFriendRequests;
getPlugin().Get(player).PendingFriendRequests = !getPlugin().Get(player).PendingFriendRequests;
_pendingFriendRequestsToggled = !_pendingFriendRequestsToggled;
BuildPage();
buildPage();
}
protected void togglePrivateChat(org.bukkit.entity.Player player)
{
Plugin.Get(player).PrivateMessaging = !Plugin.Get(player).PrivateMessaging;
getPlugin().Get(player).PrivateMessaging = !getPlugin().Get(player).PrivateMessaging;
_hubPrivateChatToggled = !_hubPrivateChatToggled;
BuildPage();
buildPage();
}
protected void toggleChat(org.bukkit.entity.Player player)
{
Plugin.Get(player).ShowChat = !Plugin.Get(player).ShowChat;
getPlugin().Get(player).ShowChat = !getPlugin().Get(player).ShowChat;
_hubChatToggled = !_hubChatToggled;
BuildPage();
buildPage();
}
protected void toggleHubPlayers(org.bukkit.entity.Player player)
{
Plugin.Get(player).ShowPlayers = !Plugin.Get(player).ShowPlayers;
getPlugin().Get(player).ShowPlayers = !getPlugin().Get(player).ShowPlayers;
_hubPlayersToggled = !_hubPlayersToggled;
BuildPage();
buildPage();
}
protected void toggleHubGames(org.bukkit.entity.Player player)
{
Plugin.Get(player).HubGames = !Plugin.Get(player).HubGames;
getPlugin().Get(player).HubGames = !getPlugin().Get(player).HubGames;
_hubGamesToggled = !_hubGamesToggled;
BuildPage();
buildPage();
}
protected void toggleMacReports(org.bukkit.entity.Player player)
{
Plugin.Get(player).ShowMacReports = !Plugin.Get(player).ShowMacReports;
getPlugin().Get(player).ShowMacReports = !getPlugin().Get(player).ShowMacReports;
_macReportsToggled = !_macReportsToggled;
BuildPage();
buildPage();
}
protected void toggleHubIgnoreVelocity(org.bukkit.entity.Player player)
{
Plugin.Get(player).IgnoreVelocity = !Plugin.Get(player).IgnoreVelocity;
getPlugin().Get(player).IgnoreVelocity = !getPlugin().Get(player).IgnoreVelocity;
_hubIgnoreVelocityToggled = !_hubIgnoreVelocityToggled;
BuildPage();
buildPage();
}
@Override
public void PlayerClosed()
public void playerClosed()
{
super.PlayerClosed();
super.playerClosed();
if (preferencesChanged())
{
Plugin.savePreferences(Player);
getPlugin().savePreferences(getPlayer());
}
}
@Override
protected void BuildPage()
protected void buildPage()
{
clear();
UserPreferences userPreferences = Plugin.Get(Player);
UserPreferences userPreferences = getPlugin().Get(getPlayer());
int index = 9;
buildPreference(index, Material.FIREBALL, "Hub Stacker", userPreferences.HubGames, _toggleHubGames);
@ -256,19 +255,19 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
buildPreference(40, Material.RED_ROSE, "Show Pending Friend Requests", userPreferences.PendingFriendRequests, _togglePendingFriendRequests);
if (ClientManager.Get(Player).GetRank() == Rank.YOUTUBE)
if (getClientManager().Get(getPlayer()).GetRank() == Rank.YOUTUBE)
{
buildPreference(38, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(42, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
}
if (ClientManager.Get(Player).GetRank().Has(Rank.ADMIN))
if (getClientManager().Get(getPlayer()).GetRank().Has(Rank.ADMIN))
{
buildPreference(36, Material.NETHER_STAR, "Hub Invisibility", userPreferences.Invisibility, _toggleHubInvisibility);
buildPreference(38, Material.SLIME_BALL, "Hub Forcefield", userPreferences.HubForcefield, _toggleHubForcefield);
buildPreference(42, Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(44, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);
}
else if (ClientManager.Get(Player).GetRank().Has(Rank.MODERATOR))
else if (getClientManager().Get(getPlayer()).GetRank().Has(Rank.MODERATOR))
{
buildPreference(38, Material.PAPER, "Mac Reports", userPreferences.ShowMacReports, _toggleMacReports);
buildPreference(42, Material.SADDLE, "Hub Ignore Velocity", userPreferences.IgnoreVelocity, _toggleHubIgnoreVelocity);

View File

@ -16,8 +16,8 @@ public class PreferencesShop extends ShopBase<PreferencesManager>
}
@Override
protected ShopPageBase<PreferencesManager, ? extends ShopBase<PreferencesManager>> BuildPagesFor(Player player)
protected ShopPageBase<PreferencesManager, ? extends ShopBase<PreferencesManager>> buildPagesFor(Player player)
{
return new PreferencesPage(Plugin, this, ClientManager, DonationManager, " " + ChatColor.UNDERLINE + "User Preferences", player);
return new PreferencesPage(getPlugin(), this, getClientManager(), getDonationManager(), " " + ChatColor.UNDERLINE + "User Preferences", player);
}
}

View File

@ -53,7 +53,7 @@ public class Punish extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new PunishCommand(this));
}
@ -154,7 +154,7 @@ public class Punish extends MiniPlugin
if (caller == null)
System.out.println(F.main(getName(), F.elem(caller == null ? "Mineplex Anti-Cheat" : caller.getName()) + " banned " + F.elem(playerName) + " because of " + F.elem(reason) + " for " + durationString + "."));
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -34,7 +34,7 @@ public class PunishmentHandler implements CommandCallback
{
if (ban)
{
Bukkit.getServer().getScheduler().runTask(_punishManager.GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTask(_punishManager.getPlugin(), new Runnable()
{
public void run()
{

View File

@ -63,7 +63,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
BuildPage();
_player.openInventory(this);
_plugin.RegisterEvents(this);
_plugin.registerEvents(this);
}
private void BuildPage()

View File

@ -51,7 +51,7 @@ public class ReportManager {
this.activeReports = new HashMap<String, Integer>();
// TODO: Get JavaPlugin instance and locate ConnectionString from config?
this.reportSqlRepository = new ReportRepository(ReportPlugin.getPlugin(), "CONNECTION STRING HERE");
this.reportSqlRepository = new ReportRepository(ReportPlugin.getPluginInstance(), "CONNECTION STRING HERE");
reportSqlRepository.initialize();
}

View File

@ -11,7 +11,7 @@ public class ReportPlugin extends MiniPlugin
{
private static JavaPlugin instance;
public static JavaPlugin getPlugin() { return instance; }
public static JavaPlugin getPluginInstance() { return instance; }
public ReportPlugin(JavaPlugin plugin, String serverName)
{
@ -21,7 +21,7 @@ public class ReportPlugin extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new ReportCommand(this));
addCommand(new ReportHandleCommand(this));

View File

@ -40,7 +40,7 @@ public class RewardManager
int legendValueMin, int legendValueMax,
boolean doubleGadgetValue)
{
_plugin = donationManager.GetPlugin();
_plugin = donationManager.getPlugin();
_treasureMap = new HashMap<RewardRarity, List<Reward>>();
_random = new Random();

View File

@ -36,42 +36,42 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
private List<CurrencyType> _availableCurrencyTypes;
protected PluginType Plugin;
protected CoreClientManager ClientManager;
protected DonationManager DonationManager;
protected String Name;
protected NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>> PlayerPageMap;
private PluginType _plugin;
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private String _name;
private NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>> _playerPageMap;
protected HashSet<String> OpenedShop = new HashSet<String>();
private HashSet<String> _openedShop = new HashSet<String>();
public ShopBase(PluginType plugin, CoreClientManager clientManager, DonationManager donationManager, String name, CurrencyType...currencyTypes)
{
Plugin = plugin;
ClientManager = clientManager;
DonationManager = donationManager;
Name = name;
_plugin = plugin;
_clientManager = clientManager;
_donationManager = donationManager;
_name = name;
PlayerPageMap = new NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>>();
_playerPageMap = new NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>>();
_errorThrottling = new NautHashMap<String, Long>();
_purchaseBlock = new NautHashMap<String, Long>();
_availableCurrencyTypes = new ArrayList<CurrencyType>();
_availableCurrencyTypes.addAll(Arrays.asList(currencyTypes));
Plugin.RegisterEvents(this);
_plugin.registerEvents(this);
}
public List<CurrencyType> GetAvailableCurrencyTypes()
public List<CurrencyType> getAvailableCurrencyTypes()
{
return _availableCurrencyTypes;
}
@EventHandler(priority = EventPriority.LOWEST)
public void OnPlayerDamageEntity(NpcDamageByEntityEvent event)
public void onPlayerDamageEntity(NpcDamageByEntityEvent event)
{
if (event.getDamager() instanceof Player)
{
if (AttemptShopOpen((Player)event.getDamager(), event.getNpc()))
if (attemptShopOpen((Player) event.getDamager(), event.getNpc()))
{
event.setCancelled(true);
}
@ -79,28 +79,28 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
}
@EventHandler(priority = EventPriority.LOWEST)
public void OnPlayerInteractEntity(NpcInteractEntityEvent event)
public void onPlayerInteractEntity(NpcInteractEntityEvent event)
{
if (AttemptShopOpen(event.getPlayer(), (LivingEntity)event.getNpc()))
if (attemptShopOpen(event.getPlayer(), (LivingEntity) event.getNpc()))
event.setCancelled(true);
}
private boolean AttemptShopOpen(Player player, LivingEntity entity)
private boolean attemptShopOpen(Player player, LivingEntity entity)
{
if (!OpenedShop.contains(player.getName()) && entity.isCustomNameVisible() && entity.getCustomName() != null && ChatColor.stripColor(entity.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(Name)))
if (!_openedShop.contains(player.getName()) && entity.isCustomNameVisible() && entity.getCustomName() != null && ChatColor.stripColor(entity.getCustomName()).equalsIgnoreCase(ChatColor.stripColor(_name)))
{
if (!CanOpenShop(player))
if (!canOpenShop(player))
return false;
OpenedShop.add(player.getName());
_openedShop.add(player.getName());
OpenShopForPlayer(player);
if (!PlayerPageMap.containsKey(player.getName()))
openShopForPlayer(player);
if (!_playerPageMap.containsKey(player.getName()))
{
PlayerPageMap.put(player.getName(), BuildPagesFor(player));
_playerPageMap.put(player.getName(), buildPagesFor(player));
}
OpenPageForPlayer(player, GetOpeningPageForPlayer(player));
openPageForPlayer(player, getOpeningPageForPlayer(player));
return true;
}
@ -110,20 +110,20 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
public boolean attemptShopOpen(Player player)
{
if (!OpenedShop.contains(player.getName()))
if (!_openedShop.contains(player.getName()))
{
if (!CanOpenShop(player))
if (!canOpenShop(player))
return false;
OpenedShop.add(player.getName());
_openedShop.add(player.getName());
OpenShopForPlayer(player);
if (!PlayerPageMap.containsKey(player.getName()))
openShopForPlayer(player);
if (!_playerPageMap.containsKey(player.getName()))
{
PlayerPageMap.put(player.getName(), BuildPagesFor(player));
_playerPageMap.put(player.getName(), buildPagesFor(player));
}
OpenPageForPlayer(player, GetOpeningPageForPlayer(player));
openPageForPlayer(player, getOpeningPageForPlayer(player));
return true;
}
@ -131,34 +131,34 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
return false;
}
protected ShopPageBase<PluginType, ? extends ShopBase<PluginType>> GetOpeningPageForPlayer(Player player)
protected ShopPageBase<PluginType, ? extends ShopBase<PluginType>> getOpeningPageForPlayer(Player player)
{
return PlayerPageMap.get(player.getName());
return _playerPageMap.get(player.getName());
}
@EventHandler
public void OnInventoryClick(InventoryClickEvent event)
public void onInventoryClick(InventoryClickEvent event)
{
if (PlayerPageMap.containsKey(event.getWhoClicked().getName()) && PlayerPageMap.get(event.getWhoClicked().getName()).getName().equalsIgnoreCase(event.getInventory().getName()))
if (_playerPageMap.containsKey(event.getWhoClicked().getName()) && _playerPageMap.get(event.getWhoClicked().getName()).getName().equalsIgnoreCase(event.getInventory().getName()))
{
PlayerPageMap.get(event.getWhoClicked().getName()).PlayerClicked(event);
_playerPageMap.get(event.getWhoClicked().getName()).playerClicked(event);
event.setCancelled(true);
}
}
@EventHandler
public void OnInventoryClose(InventoryCloseEvent event)
public void onInventoryClose(InventoryCloseEvent event)
{
if (PlayerPageMap.containsKey(event.getPlayer().getName()) && PlayerPageMap.get(event.getPlayer().getName()).getTitle() != null && PlayerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle()))
if (_playerPageMap.containsKey(event.getPlayer().getName()) && _playerPageMap.get(event.getPlayer().getName()).getTitle() != null && _playerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle()))
{
PlayerPageMap.get(event.getPlayer().getName()).PlayerClosed();
PlayerPageMap.get(event.getPlayer().getName()).Dispose();
_playerPageMap.get(event.getPlayer().getName()).playerClosed();
_playerPageMap.get(event.getPlayer().getName()).dispose();
PlayerPageMap.remove(event.getPlayer().getName());
_playerPageMap.remove(event.getPlayer().getName());
CloseShopForPlayer((Player)event.getPlayer());
closeShopForPlayer((Player) event.getPlayer());
OpenedShop.remove(event.getPlayer().getName());
_openedShop.remove(event.getPlayer().getName());
}
}
@ -168,53 +168,53 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
if (!event.isCancelled())
return;
if (PlayerPageMap.containsKey(event.getPlayer().getName()) && PlayerPageMap.get(event.getPlayer().getName()).getTitle() != null && PlayerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle()))
if (_playerPageMap.containsKey(event.getPlayer().getName()) && _playerPageMap.get(event.getPlayer().getName()).getTitle() != null && _playerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle()))
{
PlayerPageMap.get(event.getPlayer().getName()).PlayerClosed();
PlayerPageMap.get(event.getPlayer().getName()).Dispose();
_playerPageMap.get(event.getPlayer().getName()).playerClosed();
_playerPageMap.get(event.getPlayer().getName()).dispose();
PlayerPageMap.remove(event.getPlayer().getName());
_playerPageMap.remove(event.getPlayer().getName());
CloseShopForPlayer((Player)event.getPlayer());
closeShopForPlayer((Player) event.getPlayer());
OpenedShop.remove(event.getPlayer().getName());
_openedShop.remove(event.getPlayer().getName());
}
}
protected boolean CanOpenShop(Player player)
protected boolean canOpenShop(Player player)
{
return true;
}
protected void OpenShopForPlayer(Player player) { }
protected void openShopForPlayer(Player player) { }
protected void CloseShopForPlayer(Player player) { }
protected void closeShopForPlayer(Player player) { }
@EventHandler
public void OnPlayerQuit(PlayerQuitEvent event)
public void onPlayerQuit(PlayerQuitEvent event)
{
if (PlayerPageMap.containsKey(event.getPlayer().getName()))
if (_playerPageMap.containsKey(event.getPlayer().getName()))
{
PlayerPageMap.get(event.getPlayer().getName()).PlayerClosed();
PlayerPageMap.get(event.getPlayer().getName()).Dispose();
_playerPageMap.get(event.getPlayer().getName()).playerClosed();
_playerPageMap.get(event.getPlayer().getName()).dispose();
event.getPlayer().closeInventory();
CloseShopForPlayer(event.getPlayer());
closeShopForPlayer(event.getPlayer());
PlayerPageMap.remove(event.getPlayer().getName());
_playerPageMap.remove(event.getPlayer().getName());
OpenedShop.remove(event.getPlayer().getName());
_openedShop.remove(event.getPlayer().getName());
}
}
public void OpenPageForPlayer(Player player, ShopPageBase<PluginType, ? extends ShopBase<PluginType>> page)
public void openPageForPlayer(Player player, ShopPageBase<PluginType, ? extends ShopBase<PluginType>> page)
{
if (PlayerPageMap.containsKey(player.getName()))
if (_playerPageMap.containsKey(player.getName()))
{
PlayerPageMap.get(player.getName()).PlayerClosed();
_playerPageMap.get(player.getName()).playerClosed();
}
SetCurrentPageForPlayer(player, page);
setCurrentPageForPlayer(player, page);
EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
if (nmsPlayer.activeContainer != nmsPlayer.defaultContainer)
@ -226,12 +226,12 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
player.openInventory(page);
}
public void SetCurrentPageForPlayer(Player player, ShopPageBase<PluginType, ? extends ShopBase<PluginType>> page)
public void setCurrentPageForPlayer(Player player, ShopPageBase<PluginType, ? extends ShopBase<PluginType>> page)
{
PlayerPageMap.put(player.getName(), page);
_playerPageMap.put(player.getName(), page);
}
public void AddPlayerProcessError(Player player)
public void addPlayerProcessError(Player player)
{
if (_errorThrottling.containsKey(player.getName()) && (System.currentTimeMillis() - _errorThrottling.get(player.getName()) <= 5000))
_purchaseBlock.put(player.getName(), System.currentTimeMillis());
@ -239,20 +239,50 @@ public abstract class ShopBase<PluginType extends MiniPlugin> implements Listene
_errorThrottling.put(player.getName(), System.currentTimeMillis());
}
public boolean CanPlayerAttemptPurchase(Player player)
public boolean canPlayerAttemptPurchase(Player player)
{
return !_purchaseBlock.containsKey(player.getName()) || (System.currentTimeMillis() - _purchaseBlock.get(player.getName()) > 10000);
}
public NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>> GetPageMap()
public NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>> getPageMap()
{
return PlayerPageMap;
return _playerPageMap;
}
protected abstract ShopPageBase<PluginType, ? extends ShopBase<PluginType>> BuildPagesFor(Player player);
protected abstract ShopPageBase<PluginType, ? extends ShopBase<PluginType>> buildPagesFor(Player player);
public boolean isPlayerInShop(Player player)
{
return PlayerPageMap.containsKey(player.getName());
return _playerPageMap.containsKey(player.getName());
}
protected PluginType getPlugin()
{
return _plugin;
}
protected CoreClientManager getClientManager()
{
return _clientManager;
}
protected DonationManager getDonationManager()
{
return _donationManager;
}
protected String getName()
{
return _name;
}
protected NautHashMap<String, ShopPageBase<PluginType, ? extends ShopBase<PluginType>>> getPlayerPageMap()
{
return _playerPageMap;
}
protected HashSet<String> getOpenedShop()
{
return _openedShop;
}
}

View File

@ -1,12 +1,12 @@
package mineplex.core.shop.page;
import mineplex.core.MiniPlugin;
import mineplex.core.donation.DonationManager;
import mineplex.core.server.util.TransactionResponse;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SalesPackageBase;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
@ -20,7 +20,6 @@ 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
{
@ -33,29 +32,29 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
private ShopItem _progressItem;
private int _taskId;
public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager, Runnable runnable, ShopPageBase<PluginType, ShopType> returnPage, SalesPackageBase salesItem, CurrencyType currencyType, Player player)
public ConfirmationPage(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, Runnable runnable, ShopPageBase<PluginType, ShopType> returnPage, SalesPackageBase salesItem, CurrencyType currencyType, Player player)
{
super(plugin, shop, clientManager, donationManager, " Confirmation", player);
_runnable = runnable;
_returnPage = returnPage;
_salesItem = salesItem;
SelectedCurrency = currencyType;
setCurrencyType(currencyType);
_progressItem = new ShopItem(Material.LAPIS_BLOCK, (byte)11, ChatColor.BLUE + "Processing", null, 1, false, true);
_okSquareSlotStart = 27;
if (Shop.CanPlayerAttemptPurchase(player))
if (getShop().canPlayerAttemptPurchase(player))
{
BuildPage();
buildPage();
}
else
{
BuildErrorPage(new String[] { ChatColor.RED + "You have attempted too many invalid transactions.", ChatColor.RED + "Please wait 10 seconds before retrying." });
_taskId = plugin.GetScheduler().scheduleSyncRepeatingTask(plugin.GetPlugin(), this, 2L, 2L);
buildErrorPage(new String[]{ChatColor.RED + "You have attempted too many invalid transactions.", ChatColor.RED + "Please wait 10 seconds before retrying."});
_taskId = plugin.getScheduler().scheduleSyncRepeatingTask(plugin.getPlugin(), this, 2L, 2L);
}
}
protected void BuildPage()
protected void buildPage()
{
this.getInventory().setItem(22, new ShopItem(_salesItem.GetDisplayMaterial(), (byte)0, _salesItem.GetDisplayName(), _salesItem.GetDescription(), 1, false, true).getHandle());
@ -64,7 +63,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
@Override
public void onClick(Player player, ClickType clickType)
{
OkClicked(player);
okClicked(player);
}
};
@ -73,27 +72,27 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
@Override
public void onClick(Player player, ClickType clickType)
{
CancelClicked(player);
cancelClicked(player);
}
};
BuildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte)0, ChatColor.GREEN + "OK", null, 1, false, true), okClicked);
BuildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte)0, ChatColor.RED + "CANCEL", null, 1, false, true), cancelClicked);
buildSquareAt(_okSquareSlotStart, new ShopItem(Material.EMERALD_BLOCK, (byte) 0, ChatColor.GREEN + "OK", null, 1, false, true), okClicked);
buildSquareAt(_okSquareSlotStart + 6, new ShopItem(Material.REDSTONE_BLOCK, (byte) 0, ChatColor.RED + "CANCEL", null, 1, false, true), cancelClicked);
this.getInventory().setItem(4, new ShopItem(SelectedCurrency.GetDisplayMaterial(), (byte)0, SelectedCurrency.toString(), new String[] { C.cGray + _salesItem.GetCost(SelectedCurrency) + " " + SelectedCurrency.toString() + " will be deducted from your account balance." }, 1, false, true).getHandle());
this.getInventory().setItem(4, new ShopItem(getCurrencyType().GetDisplayMaterial(), (byte)0, getCurrencyType().toString(), new String[] { C.cGray + _salesItem.GetCost(getCurrencyType()) + " " + getCurrencyType().toString() + " will be deducted from your account balance." }, 1, false, true).getHandle());
}
protected void OkClicked(Player player)
protected void okClicked(Player player)
{
ProcessTransaction();
processTransaction();
}
protected void CancelClicked(Player player)
protected void cancelClicked(Player player)
{
Plugin.GetScheduler().cancelTask(_taskId);
getPlugin().getScheduler().cancelTask(_taskId);
if (_returnPage != null)
Shop.OpenPageForPlayer(player, _returnPage);
getShop().openPageForPlayer(player, _returnPage);
else
{
player.closeInventory();
@ -101,30 +100,30 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
}
private void BuildSquareAt(int slot, ShopItem item, IButton button)
private void buildSquareAt(int slot, ShopItem item, IButton button)
{
AddButton(slot, item, button);
AddButton(slot + 1, item, button);
AddButton(slot + 2, item, button);
addButton(slot, item, button);
addButton(slot + 1, item, button);
addButton(slot + 2, item, button);
slot += 9;
AddButton(slot, item, button);
AddButton(slot + 1, item, button);
AddButton(slot + 2, item, button);
addButton(slot, item, button);
addButton(slot + 1, item, button);
addButton(slot + 2, item, button);
slot += 9;
AddButton(slot, item, button);
AddButton(slot + 1, item, button);
AddButton(slot + 2, item, button);
addButton(slot, item, button);
addButton(slot + 1, item, button);
addButton(slot + 2, item, button);
}
private void ProcessTransaction()
private void processTransaction()
{
for (int i=_okSquareSlotStart; i < 54; i++)
{
ButtonMap.remove(i);
getButtonMap().remove(i);
clear(i);
}
@ -132,50 +131,50 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
if (_salesItem.IsKnown())
{
DonationManager.PurchaseKnownSalesPackage(new Callback<TransactionResponse> ()
getDonationManager().PurchaseKnownSalesPackage(new Callback<TransactionResponse>()
{
public void run(TransactionResponse response)
{
ShowResultsPage(response);
showResultsPage(response);
}
}, Player.getName(), Player.getUniqueId(), _salesItem.GetCost(SelectedCurrency), _salesItem.GetSalesPackageId());
}, getPlayer().getName(), getPlayer().getUniqueId(), _salesItem.GetCost(getCurrencyType()), _salesItem.GetSalesPackageId());
}
else
{
DonationManager.PurchaseUnknownSalesPackage(new Callback<TransactionResponse> ()
getDonationManager().PurchaseUnknownSalesPackage(new Callback<TransactionResponse>()
{
public void run(TransactionResponse response)
{
ShowResultsPage(response);
showResultsPage(response);
}
}, Player.getName(), Player.getUniqueId(), _salesItem.GetName(), SelectedCurrency == CurrencyType.Coins, _salesItem.GetCost(SelectedCurrency), _salesItem.OneTimePurchase());
}, getPlayer().getName(), getPlayer().getUniqueId(), _salesItem.GetName(), getCurrencyType() == CurrencyType.Coins, _salesItem.GetCost(getCurrencyType()), _salesItem.OneTimePurchase());
}
_taskId = Plugin.GetScheduler().scheduleSyncRepeatingTask(Plugin.GetPlugin(), this, 2L, 2L);
_taskId = getPlugin().getScheduler().scheduleSyncRepeatingTask(getPlugin().getPlugin(), this, 2L, 2L);
}
private void ShowResultsPage(TransactionResponse response)
private void showResultsPage(TransactionResponse response)
{
_processing = false;
switch (response)
{
case Failed:
BuildErrorPage(ChatColor.RED + "There was an error processing your request.");
Shop.AddPlayerProcessError(Player);
buildErrorPage(ChatColor.RED + "There was an error processing your request.");
getShop().addPlayerProcessError(getPlayer());
break;
case AlreadyOwns:
BuildErrorPage(ChatColor.RED + "You already own this package.");
Shop.AddPlayerProcessError(Player);
buildErrorPage(ChatColor.RED + "You already own this package.");
getShop().addPlayerProcessError(getPlayer());
break;
case InsufficientFunds:
BuildErrorPage(ChatColor.RED + "Your account has insufficient funds.");
Shop.AddPlayerProcessError(Player);
buildErrorPage(ChatColor.RED + "Your account has insufficient funds.");
getShop().addPlayerProcessError(getPlayer());
break;
case Success:
_salesItem.Sold(Player, SelectedCurrency);
_salesItem.Sold(getPlayer(), getCurrencyType());
BuildSuccessPage("Your purchase was successful.");
buildSuccessPage("Your purchase was successful.");
if (_runnable != null)
_runnable.run();
@ -188,55 +187,55 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
_progressCount = 0;
}
private void BuildErrorPage(String...message)
private void buildErrorPage(String... message)
{
IButton returnButton = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
CancelClicked(player);
cancelClicked(player);
}
};
ShopItem item = new ShopItem(Material.REDSTONE_BLOCK, (byte)0, ChatColor.RED + "" + ChatColor.UNDERLINE + "ERROR", message, 1, false, true);
for (int i = 0; i < this.getSize(); i++)
{
AddButton(i, item, returnButton);
addButton(i, item, returnButton);
}
Player.playSound(Player.getLocation(), Sound.BLAZE_DEATH, 1, .1f);
getPlayer().playSound(getPlayer().getLocation(), Sound.BLAZE_DEATH, 1, .1f);
}
private void BuildSuccessPage(String message)
private void buildSuccessPage(String message)
{
IButton returnButton = new IButton()
{
@Override
public void onClick(Player player, ClickType clickType)
{
CancelClicked(player);
cancelClicked(player);
}
};
ShopItem item = new ShopItem(Material.EMERALD_BLOCK, (byte)0, ChatColor.GREEN + message, null, 1, false, true);
for (int i = 0; i < this.getSize(); i++)
{
AddButton(i, item, returnButton);
addButton(i, item, returnButton);
}
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1, .9f);
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, .9f);
}
@Override
public void PlayerClosed()
public void playerClosed()
{
super.PlayerClosed();
super.playerClosed();
Bukkit.getScheduler().cancelTask(_taskId);
if (_returnPage != null && Shop != null)
Shop.SetCurrentPageForPlayer(Player, _returnPage);
if (_returnPage != null && getShop() != null)
getShop().setCurrentPageForPlayer(getPlayer(), _returnPage);
}
@Override
@ -264,13 +263,13 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
{
Bukkit.getScheduler().cancelTask(_taskId);
if (_returnPage != null && Shop != null)
if (_returnPage != null && getShop() != null)
{
Shop.OpenPageForPlayer(Player, _returnPage);
getShop().openPageForPlayer(getPlayer(), _returnPage);
}
else if (Player != null)
else if (getPlayer() != null)
{
Player.closeInventory();
getPlayer().closeInventory();
}
}
catch (Exception exception)
@ -279,7 +278,7 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
}
finally
{
Dispose();
dispose();
}
}
}
@ -288,9 +287,9 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
}
@Override
public void Dispose()
public void dispose()
{
super.Dispose();
super.dispose();
Bukkit.getScheduler().cancelTask(_taskId);
}

View File

@ -21,17 +21,17 @@ import mineplex.core.shop.item.IButton;
public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType extends ShopBase<PluginType>> extends CraftInventoryCustom implements Listener
{
protected PluginType Plugin;
protected CoreClientManager ClientManager;
protected DonationManager DonationManager;
protected ShopType Shop;
protected Player Player;
protected CoreClient Client;
protected CurrencyType SelectedCurrency;
protected NautHashMap<Integer, IButton> ButtonMap;
protected boolean ShowCurrency = false;
private PluginType _plugin;
private CoreClientManager _clientManager;
private DonationManager _donationManager;
private ShopType _shop;
private Player _player;
private CoreClient _client;
private CurrencyType _currencyType;
private NautHashMap<Integer, IButton> _buttonMap;
private boolean _showCurrency = false;
protected int CurrencySlot = 4;
private int _currencySlot = 4;
public ShopPageBase(PluginType plugin, ShopType shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
{
@ -42,44 +42,44 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
{
super(null, slots, name);
Plugin = plugin;
ClientManager = clientManager;
DonationManager = donationManager;
Shop = shop;
Player = player;
ButtonMap = new NautHashMap<Integer, IButton>();
_plugin = plugin;
_clientManager = clientManager;
_donationManager = donationManager;
_shop = shop;
_player = player;
_buttonMap = new NautHashMap<Integer, IButton>();
Client = ClientManager.Get(player);
_client = _clientManager.Get(player);
if (shop.GetAvailableCurrencyTypes().size() > 0)
if (shop.getAvailableCurrencyTypes().size() > 0)
{
SelectedCurrency = shop.GetAvailableCurrencyTypes().get(0);
_currencyType = shop.getAvailableCurrencyTypes().get(0);
}
}
protected void ChangeCurrency(Player player)
protected void changeCurrency(Player player)
{
PlayAcceptSound(player);
playAcceptSound(player);
int currentIndex = Shop.GetAvailableCurrencyTypes().indexOf(SelectedCurrency);
int currentIndex = _shop.getAvailableCurrencyTypes().indexOf(_currencyType);
if (currentIndex + 1 < Shop.GetAvailableCurrencyTypes().size())
if (currentIndex + 1 < _shop.getAvailableCurrencyTypes().size())
{
SelectedCurrency = Shop.GetAvailableCurrencyTypes().get(currentIndex + 1);
_currencyType = _shop.getAvailableCurrencyTypes().get(currentIndex + 1);
}
else
{
SelectedCurrency = Shop.GetAvailableCurrencyTypes().get(0);
_currencyType = _shop.getAvailableCurrencyTypes().get(0);
}
}
protected abstract void BuildPage();
protected abstract void buildPage();
protected void AddItem(int slot, ItemStack item)
protected void addItem(int slot, ItemStack item)
{
if (slot > inventory.getSize() - 1)
{
Player.getInventory().setItem(getPlayerSlot(slot), item);
_player.getInventory().setItem(getPlayerSlot(slot), item);
}
else
{
@ -87,14 +87,14 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
}
}
protected void AddItemFakeCount(int slot, ItemStack item, int fakeCount)
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);
((CraftPlayer) _player).getHandle().inventory.setItem(getPlayerSlot(slot), nmsStack);
}
else
{
@ -107,18 +107,18 @@ 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, ItemStack item, IButton button)
protected void addButton(int slot, ItemStack item, IButton button)
{
AddItem(slot, item);
addItem(slot, item);
ButtonMap.put(slot, button);
_buttonMap.put(slot, button);
}
protected void AddButtonFakeCount(int slot, ItemStack item, IButton button, int fakeItemCount)
protected void addButtonFakeCount(int slot, ItemStack item, IButton button, int fakeItemCount)
{
AddItemFakeCount(slot, item, fakeItemCount);
addItemFakeCount(slot, item, fakeItemCount);
ButtonMap.put(slot, button);
_buttonMap.put(slot, button);
}
protected void addGlow(int slot)
@ -126,74 +126,74 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
UtilInv.addDullEnchantment(getItem(slot));
}
protected void RemoveButton(int slot)
protected void removeButton(int slot)
{
getInventory().setItem(slot, null);
ButtonMap.remove(slot);
_buttonMap.remove(slot);
}
public void PlayerClicked(InventoryClickEvent event)
public void playerClicked(InventoryClickEvent event)
{
if (ButtonMap.containsKey(event.getRawSlot()))
if (_buttonMap.containsKey(event.getRawSlot()))
{
ButtonMap.get(event.getRawSlot()).onClick(Player, event.getClick());
_buttonMap.get(event.getRawSlot()).onClick(_player, event.getClick());
}
else if (event.getRawSlot() != -999)
{
if (event.getInventory().getTitle() == inventory.getInventoryName() && (inventory.getSize() <= event.getSlot() || inventory.getItem(event.getSlot()) != null))
{
PlayDenySound(Player);
playDenySound(_player);
}
else if (event.getInventory() == Player.getInventory() && Player.getInventory().getItem(event.getSlot()) != null)
else if (event.getInventory() == _player.getInventory() && _player.getInventory().getItem(event.getSlot()) != null)
{
PlayDenySound(Player);
playDenySound(_player);
}
}
}
public void PlayerOpened()
public void playerOpened()
{
}
public void PlayerClosed()
public void playerClosed()
{
this.inventory.onClose((CraftPlayer)Player);
this.inventory.onClose((CraftPlayer) _player);
}
public void PlayAcceptSound(Player player)
public void playAcceptSound(Player player)
{
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
}
public void PlayRemoveSound(Player player)
public void playRemoveSound(Player player)
{
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1, 0.6f);
}
public void PlayDenySound(Player player)
public void playDenySound(Player player)
{
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
}
public void Dispose()
public void dispose()
{
Player = null;
Client = null;
Shop = null;
Plugin = null;
_player = null;
_client = null;
_shop = null;
_plugin = null;
}
public void Refresh()
public void refresh()
{
clearPage();
BuildPage();
buildPage();
}
public void clearPage()
{
clear();
ButtonMap.clear();
_buttonMap.clear();
}
public void setItem(int column, int row, ItemStack itemStack)
@ -203,21 +203,56 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
public ShopType getShop()
{
return Shop;
return _shop;
}
public PluginType getPlugin()
{
return Plugin;
return _plugin;
}
public CoreClientManager getClientManager()
{
return ClientManager;
return _clientManager;
}
public DonationManager getDonationManager()
{
return DonationManager;
return _donationManager;
}
protected Player getPlayer()
{
return _player;
}
protected CoreClient getClient()
{
return _client;
}
protected CurrencyType getCurrencyType()
{
return _currencyType;
}
protected void setCurrencyType(CurrencyType type)
{
_currencyType = type;
}
protected NautHashMap<Integer, IButton> getButtonMap()
{
return _buttonMap;
}
protected boolean shouldShowCurrency()
{
return _showCurrency;
}
protected int getCurrencySlot()
{
return _currencySlot;
}
}

View File

@ -38,7 +38,7 @@ public class SimpleStats extends MiniPlugin
if (updateEvent.getType() != UpdateType.SLOW)
return;
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -55,7 +55,7 @@ public class SimpleStats extends MiniPlugin
final String statNameFinal = statName;
final String statValueFinal = statValue;
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -71,7 +71,7 @@ public class SimpleStats extends MiniPlugin
{
final String statNameFinal = statName;
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -36,7 +36,7 @@ public class Spawn extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new SpawnCommand(this));
}

View File

@ -61,7 +61,7 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
// Verify stat is in our local cache, if not add it remotely.
if (!_stats.containsKey(statName))
{
Bukkit.getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
Bukkit.getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -187,7 +187,7 @@ public class StatsManager extends MiniDbClientPlugin<PlayerStats>
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new TimeCommand(this));
addCommand(new GiveStatCommand(this));

View File

@ -4,7 +4,6 @@ import java.sql.SQLException;
import org.bukkit.entity.Player;
import mineplex.core.achievement.AchievementManager;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.util.F;
@ -36,7 +35,7 @@ public class TimeCommand extends CommandBase<StatsManager>
if (target == null)
{
Plugin.GetPlugin().getServer().getScheduler().runTaskAsynchronously(Plugin.GetPlugin(), new Runnable()
Plugin.getPlugin().getServer().getScheduler().runTaskAsynchronously(Plugin.getPlugin(), new Runnable()
{
@Override
public void run()
@ -45,7 +44,7 @@ public class TimeCommand extends CommandBase<StatsManager>
{
final PlayerStats stats = Plugin.getOfflinePlayerStats(args[0]);
Plugin.GetPlugin().getServer().getScheduler().runTask(Plugin.GetPlugin(), new Runnable()
Plugin.getPlugin().getServer().getScheduler().runTask(Plugin.getPlugin(), new Runnable()
{
@Override
public void run()

View File

@ -10,8 +10,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.GenericRunnable;
import mineplex.core.common.ProcessRunner;
import mineplex.core.common.util.Callback;
import mineplex.core.monitor.LagMeter;
import mineplex.core.updater.UpdateType;
@ -69,25 +67,25 @@ public class ServerStatusManager extends MiniPlugin
{
try
{
GetPlugin().getConfig().addDefault("serverstatus.connectionurl", "db.mineplex.com:3306");
GetPlugin().getConfig().set("serverstatus.connectionurl", GetPlugin().getConfig().getString("serverstatus.connectionurl"));
getPlugin().getConfig().addDefault("serverstatus.connectionurl", "db.mineplex.com:3306");
getPlugin().getConfig().set("serverstatus.connectionurl", getPlugin().getConfig().getString("serverstatus.connectionurl"));
GetPlugin().getConfig().addDefault("serverstatus.username", "root");
GetPlugin().getConfig().set("serverstatus.username", GetPlugin().getConfig().getString("serverstatus.username"));
getPlugin().getConfig().addDefault("serverstatus.username", "root");
getPlugin().getConfig().set("serverstatus.username", getPlugin().getConfig().getString("serverstatus.username"));
GetPlugin().getConfig().addDefault("serverstatus.password", "tAbechAk3wR7tuTh");
GetPlugin().getConfig().set("serverstatus.password", GetPlugin().getConfig().getString("serverstatus.password"));
getPlugin().getConfig().addDefault("serverstatus.password", "tAbechAk3wR7tuTh");
getPlugin().getConfig().set("serverstatus.password", getPlugin().getConfig().getString("serverstatus.password"));
GetPlugin().getConfig().addDefault("serverstatus.us", true);
GetPlugin().getConfig().set("serverstatus.us", GetPlugin().getConfig().getBoolean("serverstatus.us"));
getPlugin().getConfig().addDefault("serverstatus.us", true);
getPlugin().getConfig().set("serverstatus.us", getPlugin().getConfig().getBoolean("serverstatus.us"));
GetPlugin().getConfig().addDefault("serverstatus.name", "TEST-1");
GetPlugin().getConfig().set("serverstatus.name", GetPlugin().getConfig().getString("serverstatus.name"));
getPlugin().getConfig().addDefault("serverstatus.name", "TEST-1");
getPlugin().getConfig().set("serverstatus.name", getPlugin().getConfig().getString("serverstatus.name"));
GetPlugin().getConfig().addDefault("serverstatus.group", "Testing");
GetPlugin().getConfig().set("serverstatus.group", GetPlugin().getConfig().getString("serverstatus.group"));
getPlugin().getConfig().addDefault("serverstatus.group", "Testing");
getPlugin().getConfig().set("serverstatus.group", getPlugin().getConfig().getString("serverstatus.group"));
GetPlugin().saveConfig();
getPlugin().saveConfig();
}
catch (Exception e)
{
@ -100,7 +98,7 @@ public class ServerStatusManager extends MiniPlugin
if (!_enabled)
return;
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -131,7 +129,7 @@ public class ServerStatusManager extends MiniPlugin
private void saveServerStatus()
{
final MinecraftServer serverSnapshot = generateServerSnapshot();
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{
@ -167,8 +165,8 @@ public class ServerStatusManager extends MiniPlugin
*/
private MinecraftServer generateServerSnapshot()
{
ServerListPingEvent event = new ServerListPingEvent(null, GetPlugin().getServer().getMotd(), GetPlugin().getServer().getOnlinePlayers().size(), GetPlugin().getServer().getMaxPlayers());
GetPluginManager().callEvent(event);
ServerListPingEvent event = new ServerListPingEvent(null, getPlugin().getServer().getMotd(), getPlugin().getServer().getOnlinePlayers().size(), getPlugin().getServer().getMaxPlayers());
getPluginManager().callEvent(event);
String motd = _enabled ? event.getMotd() : "Restarting";
int playerCount = _clientManager.getPlayerCountIncludingConnecting();
@ -194,7 +192,7 @@ public class ServerStatusManager extends MiniPlugin
if (!_enabled)
return;
GetPlugin().getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
getPlugin().getServer().getScheduler().runTaskAsynchronously(getPlugin(), new Runnable()
{
public void run()
{

View File

@ -44,7 +44,7 @@ public class Teleport extends MiniPlugin
{
super("Teleport", plugin);
_serverName = GetPlugin().getConfig().getString("serverstatus.name");
_serverName = getPlugin().getConfig().getString("serverstatus.name");
RedisLocateHandler locateHandler = new RedisLocateHandler(this);
@ -53,7 +53,7 @@ public class Teleport extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new TeleportCommand(this));
addCommand(new LocateCommand(this));

View File

@ -14,7 +14,7 @@ public class RedisLocateHandler implements CommandCallback
public RedisLocateHandler(Teleport plugin)
{
_plugin = plugin;
_serverName = _plugin.GetPlugin().getConfig().getString("serverstatus.name");
_serverName = _plugin.getPlugin().getConfig().getString("serverstatus.name");
}
@Override

View File

@ -124,12 +124,29 @@ public class Treasure
}
Block block = _player.getTargetBlock(null, 3);
if (block.getType() == Material.CHEST)
if (block.getType() == _treasureType.getMaterial())
{
ChestData data = getChestData(block);
if (data != null && !data.isOpened())
if (!isFinished() && data != null && !data.isOpened())
{
UtilParticle.PlayParticle(UtilParticle.ParticleType.ENCHANTMENT_TABLE, block.getLocation().add(0.5, 0.5, 0.5), 0F, 0F, 0F, 1, 4);
UtilParticle.ParticleType type = getTreasureType().getStyle().getHoverParticle();
if (_treasureType == TreasureType.OLD)
{
UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0F, 0F, 0F, 1, 4);
}
else if (_treasureType == TreasureType.ANCIENT)
{
double yDif = 0.2 + 0.6 * Math.sin(Math.PI * (_tickCount / 10.0));
double xDif = 0.7 * Math.sin(Math.PI * (_tickCount / 5.0));
double zDif = 0.7 * Math.cos(Math.PI * (_tickCount / 5.0));
float red = 0.1F + (float)( 0.4 * (1 + Math.cos(Math.PI * (_tickCount / 20.0))));
UtilParticle.PlayParticle(type, block.getLocation().add(0.5 + xDif, 0.5 + yDif, 0.5 + zDif), red, 0.2F, 0.2F, 1F, 0);
}
else
{
UtilParticle.PlayParticle(type, block.getLocation().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0.2F, 0);
}
}
}
@ -303,6 +320,9 @@ public class Treasure
public void resetBlockInfo(BlockInfo blockInfo)
{
if (blockInfo == null)
return;
Block block = blockInfo.getBlock();
if (block.getType().equals(Material.CHEST))

View File

@ -112,7 +112,7 @@ public class TreasureManager extends MiniPlugin
}
@Override
public void Disable()
public void disable()
{
for (TreasureLocation treasureLocation : _treasureLocations)
{

View File

@ -9,30 +9,35 @@ public enum TreasureStyle
OLD(
ParticleType.EXPLODE,
ParticleType.EXPLODE,
ParticleType.ENCHANTMENT_TABLE,
Sound.FIZZ,
Sound.HORSE_ARMOR),
ANCIENT(
ParticleType.FLAME,
ParticleType.LAVA,
ParticleType.MOB_SPELL,
Sound.LAVA_POP,
Sound.EXPLODE),
MYTHICAL(
ParticleType.HAPPY_VILLAGER,
ParticleType.LARGE_EXPLODE,
ParticleType.INSTANT_SPELL,
Sound.PORTAL_TRAVEL,
Sound.ANVIL_LAND);
private ParticleType _secondaryParticle;
private ParticleType _chestSpawnParticle;
private ParticleType _hoverParticle;
private Sound _sound;
private Sound _chestSpawnSound;
TreasureStyle(ParticleType secondaryParticle, ParticleType chestSpawnParticle, Sound sound, Sound chestSpawnSound)
TreasureStyle(ParticleType secondaryParticle, ParticleType chestSpawnParticle, ParticleType hoverParticle, Sound sound, Sound chestSpawnSound)
{
_secondaryParticle = secondaryParticle;
_chestSpawnParticle = chestSpawnParticle;
_hoverParticle = hoverParticle;
_sound = sound;
_chestSpawnSound = chestSpawnSound;
}
@ -47,6 +52,11 @@ public enum TreasureStyle
return _chestSpawnParticle;
}
public ParticleType getHoverParticle()
{
return _hoverParticle;
}
public Sound getSound()
{
return _sound;

View File

@ -4,9 +4,7 @@ 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;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.page.ConfirmationPage;
@ -38,13 +36,13 @@ public class BuyChestButton implements IButton
@Override
public void onClick(final Player player, ClickType clickType)
{
_page.getShop().OpenPageForPlayer(player, new ConfirmationPage<TreasureManager, TreasureShop>(
_page.getShop().openPageForPlayer(player, new ConfirmationPage<TreasureManager, TreasureShop>(
_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), new Runnable()
{
public void run()
{
_inventoryManager.addItemToInventory(player, "Item", _chestName, 1);
_page.Refresh();
_page.refresh();
}
}, _page, new ChestPackage(_chestName, _chestMat, _chestCost), CurrencyType.Coins, player));
}

View File

@ -8,17 +8,12 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.donation.DonationManager;
import mineplex.core.inventory.InventoryManager;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.treasure.TreasureKey;
import mineplex.core.treasure.TreasureLocation;
import mineplex.core.treasure.TreasureManager;
import mineplex.core.treasure.TreasureType;
@ -35,15 +30,15 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
_treasureLocation = treasureLocation;
_inventoryManager = inventoryManager;
BuildPage();
buildPage();
}
@Override
protected void BuildPage()
protected void buildPage()
{
int basicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.OLD.getItemName());
int heroicCount = _inventoryManager.Get(Player).getItemCount(TreasureType.ANCIENT.getItemName());
int legendaryCount = _inventoryManager.Get(Player).getItemCount(TreasureType.MYTHICAL.getItemName());
int basicCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.OLD.getItemName());
int heroicCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.ANCIENT.getItemName());
int legendaryCount = _inventoryManager.Get(getPlayer()).getItemCount(TreasureType.MYTHICAL.getItemName());
List<String> basicLore = new ArrayList<String>();
basicLore.add(" ");
@ -106,13 +101,13 @@ public class TreasurePage extends ShopPageBase<TreasureManager, TreasureShop>
ShopItem heroic = new ShopItem(Material.TRAPPED_CHEST, C.cGold + C.Bold + "Ancient Chest", heroicLore.toArray(new String[0]), 0, false, false);
ShopItem legendary = new ShopItem(Material.ENDER_CHEST, C.cRed + C.Bold + "Mythical Chest", legendaryLore.toArray(new String[0]), 0, false, false);
if (basicCount > 0) AddButton(2, basic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.OLD));
else AddButton(2, basic, new BuyChestButton(Player, _inventoryManager, this, "Old Chest", Material.CHEST, 1000));
if (basicCount > 0) addButton(2, basic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.OLD));
else addButton(2, basic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Old Chest", Material.CHEST, 1000));
if (heroicCount > 0) AddButton(4, heroic, new OpenTreasureButton(Player, _treasureLocation, TreasureType.ANCIENT));
else AddButton(4, heroic, new BuyChestButton(Player, _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000));
if (heroicCount > 0) addButton(4, heroic, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.ANCIENT));
else addButton(4, heroic, new BuyChestButton(getPlayer(), _inventoryManager, this, "Ancient Chest", Material.CHEST, 5000));
if (legendaryCount > 0) AddButton(6, legendary, new OpenTreasureButton(Player, _treasureLocation, TreasureType.MYTHICAL));
else AddButton(6, legendary, new BuyChestButton(Player, _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000));
if (legendaryCount > 0) addButton(6, legendary, new OpenTreasureButton(getPlayer(), _treasureLocation, TreasureType.MYTHICAL));
else addButton(6, legendary, new BuyChestButton(getPlayer(), _inventoryManager, this, "Mythical Chest", Material.ENDER_CHEST, 10000));
}
}

View File

@ -23,8 +23,8 @@ public class TreasureShop extends ShopBase<TreasureManager>
}
@Override
protected ShopPageBase<TreasureManager, ? extends ShopBase<TreasureManager>> BuildPagesFor(Player player)
protected ShopPageBase<TreasureManager, ? extends ShopBase<TreasureManager>> buildPagesFor(Player player)
{
return new TreasurePage(Plugin, this, _treasureLocation, ClientManager, DonationManager, _inventoryManager, player);
return new TreasurePage(getPlugin(), this, _treasureLocation, getClientManager(), getDonationManager(), _inventoryManager, player);
}
}

View File

@ -53,7 +53,7 @@ public class FileUpdater extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new RestartServerCommand(this));
}
@ -69,7 +69,7 @@ public class FileUpdater extends MiniPlugin
RestartServerEvent restartEvent = new RestartServerEvent();
GetPluginManager().callEvent(restartEvent);
getPluginManager().callEvent(restartEvent);
if (!restartEvent.isCancelled())
{
@ -78,7 +78,7 @@ public class FileUpdater extends MiniPlugin
player.sendMessage(F.main("Updater", C.cGold + _serverName + C.cGray + " is restarting for an update."));
}
GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{
@ -86,11 +86,11 @@ public class FileUpdater extends MiniPlugin
}
}, 60L);
GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(getPlugin(), new Runnable()
{
public void run()
{
GetPlugin().getServer().shutdown();
getPlugin().getServer().shutdown();
}
}, 100L);
}

View File

@ -206,7 +206,7 @@ public class ClansAdmin
{
public void run(final Boolean nameExists)
{
Bukkit.getServer().getScheduler().runTask(Clans.GetPlugin(), new Runnable()
Bukkit.getServer().getScheduler().runTask(Clans.getPlugin(), new Runnable()
{
public void run()
{

View File

@ -1,7 +1,6 @@
package mineplex.game.clans.clans;
import java.sql.Timestamp;
import java.util.Date;
import org.bukkit.Chunk;
import org.bukkit.Location;
@ -23,7 +22,7 @@ public class ClansDataAccessLayer
public ClansDataAccessLayer(ClansManager clans)
{
_manager = clans;
_repository = new ClanRepository(clans.GetPlugin(), clans.getServerName());
_repository = new ClanRepository(clans.getPlugin(), clans.getServerName());
}
public void delete(ClanInfo clan)

View File

@ -152,7 +152,7 @@ public class ClansGame extends MiniPlugin
final Block block = event.getBlock();
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Clans.GetPlugin(), new Runnable()
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Clans.getPlugin(), new Runnable()
{
public void run()
{

View File

@ -159,7 +159,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new ClansCommand(this));
addCommand(new ClansChatCommand(this));

View File

@ -1099,7 +1099,7 @@ public class ClansCommand extends CommandBase<ClansManager>
}
/*
CoreClient client = Plugin.getClientManager().Get(caller);
CoreClient client = _plugin.getClientManager().Get(caller);
for (Player cur : clan.GetHome().getWorld().getPlayers())
if (client.Clan().GetRelation(cur.getName()) == ClanRelation.NEUTRAL)
if (clan.GetClaimSet().contains(UtilWorld.chunkToStr(cur.getLocation().getChunk())))

View File

@ -67,7 +67,7 @@ public class FieldBlock extends MiniPlugin
}
@Override
public void AddCommands()
public void addCommands()
{
addCommand(new FieldBlockCommand(this));
}

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