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

This commit is contained in:
Jonathan Williams 2015-02-28 10:26:25 -08:00
commit e5189bea40
353 changed files with 3800 additions and 3807 deletions

View File

@ -3,6 +3,7 @@
<output-path>$PROJECT_DIR$/../Testing/Clans/plugins</output-path>
<root id="root">
<element id="artifact" artifact-name="Mineplex.Game.Clans:jar" />
<element id="library" level="project" name="NoCheatPlus" />
</root>
</artifact>
</component>

View File

@ -1,13 +1,13 @@
<component name="libraryTable">
<library name="jooq">
<CLASSES>
<root url="jar://$PROJECT_DIR$/Libraries/jooq-3.4.2.jar!/" />
<root url="jar://$PROJECT_DIR$/Libraries/jooq-3.5.2.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/Libraries/jooq-3.4.2-javadoc.jar!/" />
<root url="jar://$PROJECT_DIR$/Libraries/jooq-3.5.2-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/Libraries/jooq-3.4.2-sources.jar!/" />
<root url="jar://$PROJECT_DIR$/Libraries/jooq-3.5.2-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -1,9 +1,9 @@
<component name="libraryTable">
<library name="jooq-codegen">
<CLASSES>
<root url="jar://$PROJECT_DIR$/Libraries/jooq-3.4.2.jar!/" />
<root url="jar://$PROJECT_DIR$/Libraries/jooq-codegen-3.4.2.jar!/" />
<root url="jar://$PROJECT_DIR$/Libraries/jooq-meta-3.4.2.jar!/" />
<root url="jar://$PROJECT_DIR$/Libraries/jooq-3.5.2.jar!/" />
<root url="jar://$PROJECT_DIR$/Libraries/jooq-codegen-3.5.2.jar!/" />
<root url="jar://$PROJECT_DIR$/Libraries/jooq-meta-3.5.2.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

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

@ -1,5 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Clans" type="Application" factoryName="Application" singleton="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="org.bukkit.craftbukkit.Main" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />

View File

@ -19,7 +19,7 @@
<include name="*.yml"/>
</fileset>
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/jooq-3.5.2.jar" />
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />

View File

@ -27,7 +27,7 @@
<include name="**/*.class"/>
</fileset>
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/jooq-3.5.2.jar" />
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
@ -78,7 +78,7 @@
<zipfileset src="../Libraries/commons-io-2.4.jar" />
<zipfileset src="../Libraries/commons-dbcp2-2.0.1.jar" />
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/jooq-3.5.2.jar" />
<zipfileset src="../Libraries/jedis-2.4.2.jar" />
<zipfileset src="../Libraries/commons-pool2-2.2.jar" />
<zipfileset src="../Libraries/commons-dbcp2-2.0.1.jar" />
@ -112,7 +112,7 @@
<include name="**/*.class"/>
</fileset>
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/jooq-3.5.2.jar" />
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
@ -148,7 +148,7 @@
<include name="**/*.class"/>
</fileset>
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/jooq-3.5.2.jar" />
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
@ -228,7 +228,7 @@
<zipfileset src="../Libraries/commons-io-2.4.jar" />
<zipfileset src="../Libraries/jedis-2.4.2.jar" />
<zipfileset src="../Libraries/commons-pool2-2.2.jar" />
<zipfileset src="../Libraries/jooq-3.4.2.jar" />
<zipfileset src="../Libraries/jooq-3.5.2.jar" />
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -10,7 +10,7 @@
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-pool2-2.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-dbcp2-2.0.1.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.4.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.2.jar"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/craftbukkit.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>

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,13 +35,13 @@ 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",
@ -54,95 +54,95 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
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),
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();
refresh();
}
});
}
if (Plugin.getMountManager().getActive(Player) != null)
if (getPlugin().getMountManager().getActive(getPlayer()) != null)
{
final Mount<?> mount = Plugin.getMountManager().getActive(Player);
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),
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);
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,25 +80,25 @@ 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(),
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()));
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(),
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));
}
@ -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

@ -70,7 +70,7 @@ public class FriendsGUI implements Listener
buildPage();
_plugin.RegisterEvents(this);
_plugin.registerEvents(this);
getFriendData().setGui(this);
}
@ -521,16 +521,18 @@ public class FriendsGUI implements Listener
{
if (isSender || clickType.isRightClick())
{
CommandCenter.Instance.OnPlayerCommandPreprocess(new PlayerCommandPreprocessEvent(player, "/unfriend "
+ name));
_plugin.removeFriend(_player, name);
// CommandCenter.Instance.OnPlayerCommandPreprocess(new PlayerCommandPreprocessEvent(player, "/unfriend "
// + name));
_inventory.setItem(slot, new ItemStack(Material.AIR));
_buttonMap.remove(slot);
}
else if (!isSender && clickType.isLeftClick())
{
CommandCenter.Instance.OnPlayerCommandPreprocess(new PlayerCommandPreprocessEvent(player, "/friend "
+ name));
_plugin.addFriend(_player, name);
// CommandCenter.Instance.OnPlayerCommandPreprocess(new PlayerCommandPreprocessEvent(player, "/friend "
// + name));
_inventory.setItem(slot, new ItemStack(Material.AIR));
_buttonMap.remove(slot);

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));
@ -232,7 +232,7 @@ public class MessageManager extends MiniClientPlugin<ClientMessage>
// Module Functions
@Override
public void Enable()
public void enable()
{
_randomMessage = new LinkedList<String>();
_randomMessage.clear();
@ -517,7 +517,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

@ -6,6 +6,9 @@ import java.util.Collection;
import java.util.Iterator;
import mineplex.core.common.Rank;
import mineplex.core.common.jsonchat.ChildJsonMessage;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -15,6 +18,8 @@ import mineplex.core.party.redis.RedisPartyData;
import mineplex.serverdata.Region;
import mineplex.serverdata.ServerGroup;
import mineplex.serverdata.ServerManager;
import mineplex.serverdata.transfers.ServerTransfer;
import mineplex.serverdata.transfers.TransferCommand;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -29,7 +34,8 @@ public class Party
private PartyManager _manager;
private boolean _isHub;
private String _creator = null;
private String _creator;
private String _previousServer;
private ArrayList<String> _players = new ArrayList<String>();
private NautHashMap<String, Long> _invitee = new NautHashMap<String, Long>();
@ -47,13 +53,14 @@ public class Party
_players = new ArrayList(Arrays.asList(partyData.getPlayers()));
_creator = partyData.getLeader();
_previousServer = partyData.getPreviousServer();
}
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);
@ -135,12 +142,27 @@ public class Party
// Instruct
if (inviteeInParty)
{
UtilPlayer.message(player,
F.main("Party", "Type " + F.link("/party leave") + " then " + F.link("/party " + GetLeader()) + " to join."));
ChildJsonMessage message = new JsonMessage("").extra(C.mHead + "Party> " + C.mBody + "Type ");
message.add(F.link("/party leave")).click(ClickEvent.RUN_COMMAND, "/party leave");
message.add(C.mBody + " then ");
message.add(F.link("/party " + GetLeader())).click(ClickEvent.RUN_COMMAND, "/party " + GetLeader());
message.add(C.mBody + " to join.");
message.sendToPlayer(player);
}
else
{
UtilPlayer.message(player, F.main("Party", "Type " + F.link("/party " + GetLeader()) + " to join."));
ChildJsonMessage message = new JsonMessage("").extra(C.mHead + "Party> " + C.mBody + "Type ");
message.add(F.link("/party " + GetLeader())).click(ClickEvent.RUN_COMMAND, "/party " + GetLeader());
message.add(C.mBody + " to join.");
message.sendToPlayer(player);
}
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1.5f);
@ -191,8 +213,33 @@ public class Party
_players.remove(player.getName());
_players.add(0, player.getName());
if (_informNewLeaderTimer < System.currentTimeMillis())
{
Announce("Party Leadership returned to " + F.name(GetLeader()) + ".");
}
if (_previousServer != null)
{
for (String playerName : _players)
{
Player p = Bukkit.getPlayerExact(playerName);
if (p != null)
{
continue;
}
TransferCommand transferCommand = new TransferCommand(
new ServerTransfer(playerName, _manager.getServerName()));
transferCommand.setTargetServers(_previousServer);
transferCommand.publish();
}
_previousServer = null;
}
}
}
// Shuffle Leader
@ -201,7 +248,7 @@ public class Party
if (player.getName().equals(GetLeader()))
{
_players.remove(player.getName());
_players.add(0, player.getName());
_players.add(player.getName());
if (_informNewLeaderTimer < System.currentTimeMillis())
{
@ -365,20 +412,24 @@ public class Party
}
else
{
if (UtilTime.elapsed(_partyOfflineTimer, online == 0 ? 15000 : 120000)) // 15 seconds for no players, 2 minutes if
if (UtilTime.elapsed(_partyOfflineTimer, online == 0 ? 5000 : 120000)) // 5 seconds for no players, 2 minutes if
// one player.
{
return true;
}
}
}
else if (_partyOfflineTimer > 0)
{
_partyOfflineTimer = -1;
}
return false;
}
public void resetWaitingTime()
{
_partyOfflineTimer = System.currentTimeMillis();
_partyOfflineTimer = -1;
}
public void switchedServer()

View File

@ -27,6 +27,7 @@ public class PartyManager extends MiniPlugin
private CoreClientManager _clientManager;
private PreferencesManager _preferenceManager;
private Portal _portal;
private String _serverName;
public HashSet<Party> _parties = new HashSet<Party>();
@ -37,13 +38,14 @@ public class PartyManager extends MiniPlugin
_portal = portal;
_clientManager = clientManager;
_preferenceManager = preferenceManager;
_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));
}
@ -67,6 +69,11 @@ public class PartyManager extends MiniPlugin
return party;
}
public String getServerName()
{
return _serverName;
}
public void addParty(Party party)
{
for (Party parties : _parties)
@ -91,9 +98,19 @@ public class PartyManager extends MiniPlugin
{
party.switchedServer();
RedisPartyData data = new RedisPartyData(party, event.getServer());
boolean destLobby = event.getServer().equalsIgnoreCase("lobby");
RedisPartyData data = new RedisPartyData(party, destLobby ? _serverName : null);
if (!destLobby)
{
data.setTargetServers(event.getServer());
}
data.publish();
if (!destLobby)
{
for (Player player : party.GetPlayersOnline())
{
if (player != event.getPlayer())
@ -101,6 +118,7 @@ public class PartyManager extends MiniPlugin
_portal.sendPlayerToServer(player, event.getServer());
}
}
}
break;
}

View File

@ -2,12 +2,17 @@ package mineplex.core.party.commands;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
import mineplex.core.common.jsonchat.ChildJsonMessage;
import mineplex.core.common.jsonchat.ClickEvent;
import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.party.Party;
import mineplex.core.party.PartyManager;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
@ -15,7 +20,10 @@ public class PartyCommand extends CommandBase<PartyManager>
{
public PartyCommand(PartyManager plugin)
{
super(plugin, Rank.ALL, new String[] {"party","z"});
super(plugin, Rank.ALL, new String[]
{
"party", "z"
});
}
@Override
@ -31,10 +39,10 @@ public class PartyCommand extends CommandBase<PartyManager>
return;
}
//Callers Party
// Callers Party
Party party = Plugin.GetParty(caller);
//Leave
// Leave
if (args[0].equalsIgnoreCase("leave"))
{
if (party == null)
@ -49,7 +57,7 @@ public class PartyCommand extends CommandBase<PartyManager>
return;
}
//Leave
// Leave
if (args[0].equalsIgnoreCase("kick"))
{
if (party == null)
@ -61,7 +69,8 @@ public class PartyCommand extends CommandBase<PartyManager>
if (party.GetLeader().equals(caller.getName()))
{
String target = UtilPlayer.searchCollection(caller, args[1], party.GetPlayers(), "Party ", true);
if (target == null) return;
if (target == null)
return;
if (target.equals(caller.getName()))
{
@ -80,9 +89,10 @@ public class PartyCommand extends CommandBase<PartyManager>
return;
}
//Main
// Main
Player target = UtilPlayer.searchOnline(caller, args[0], true);
if (target == null) return;
if (target == null)
return;
if (target.equals(caller))
{
@ -93,11 +103,14 @@ public class PartyCommand extends CommandBase<PartyManager>
// Preference check
if (!Plugin.getPreferenceManager().Get(target).PartyRequests)
{
UtilPlayer.message(caller, F.main("Party", "You may not party with " + F.name(UtilEnt.getName(target)) + "! They are not accepting party requests!"));
UtilPlayer.message(
caller,
F.main("Party", "You may not party with " + F.name(UtilEnt.getName(target))
+ "! They are not accepting party requests!"));
return;
}
//Invite or Suggest
// Invite or Suggest
if (party != null)
{
if (party.GetPlayers().size() + party.GetInvitees().size() >= 16)
@ -105,36 +118,48 @@ public class PartyCommand extends CommandBase<PartyManager>
UtilPlayer.message(caller, "Your party cannot be larger than 16 players.");
caller.playSound(caller.getLocation(), Sound.NOTE_BASS, 1f, 1.5f);
}
//Decline
// Decline
else if (party.GetPlayers().contains(target.getName()))
{
UtilPlayer.message(caller, F.main("Party", F.name(target.getName()) + " is already in the Party."));
caller.playSound(caller.getLocation(), Sound.NOTE_BASS, 1f, 1.5f);
}
//Decline
// Decline
else if (party.GetInvitees().contains(target.getName()))
{
UtilPlayer.message(caller, F.main("Party", F.name(target.getName()) + " is already invited to the Party."));
caller.playSound(caller.getLocation(), Sound.NOTE_BASS, 1f, 1.5f);
}
//Invite
// Invite
else if (party.GetLeader().equals(caller.getName()))
{
party.InviteParty(target, Plugin.GetParty(target) != null);
}
//Suggest
// Suggest
else
{
party.Announce(F.name(caller.getName()) + " suggested " + F.name(target.getName()) + " be invited to the Party.");
UtilPlayer.message(UtilPlayer.searchExact(party.GetLeader()), F.main("Party", "Type " + F.link("/party " + target.getName()) + " to invite them."));
Player leader = Bukkit.getPlayerExact(party.GetLeader());
if (leader != null)
{
ChildJsonMessage message = new JsonMessage("").extra(C.mHead + "Party> " + C.mBody + "Type ");
message.add(F.link("/party " + target.getName())).click(ClickEvent.RUN_COMMAND, "/party " + target.getName());
message.add(C.mBody + " to invite them.");
message.sendToPlayer(leader);
}
}
//Create or Join
}
// Create or Join
else
{
Party targetParty = Plugin.GetParty(target);
//Try to Join
// Try to Join
if (targetParty != null)
{
if (targetParty.GetInvitees().contains(caller.getName()))
@ -144,7 +169,7 @@ public class PartyCommand extends CommandBase<PartyManager>
}
}
//Create
// Create
party = Plugin.CreateParty(caller);
party.InviteParty(target, Plugin.GetParty(target) != null);
}

View File

@ -8,13 +8,18 @@ public class RedisPartyData extends ServerCommand
private String[] _players;
private String _leader;
private String _previousServer;
public RedisPartyData(Party party, String newServer)
public RedisPartyData(Party party, String previousServer)
{
_players = party.GetPlayers().toArray(new String[0]);
_leader = party.GetLeader();
_previousServer = previousServer;
}
setTargetServers(newServer);
public String getPreviousServer()
{
return _previousServer;
}
public String[] getPlayers()

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;
}
private void createGroup(final Player host, final String serverName, final int minPlayers, final int maxPlayers, final String games)
createGroup(player, serverName, ram, cpu, 12, 24, "Smash");
}
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()
{

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