Refactored IButton

Added ComplexButton

Added Clans farming.
Added Clans Recipes.
Added Clans gameplay.
Added shop files structure.
This commit is contained in:
Jonathan Williams 2014-12-04 05:05:27 -08:00
parent abaf9f4693
commit 59f93d46ec
61 changed files with 1167 additions and 564 deletions

View File

@ -6,7 +6,7 @@ public enum CurrencyType
{
Tokens(" Tokens", Material.EMERALD),
Coins(" Coins", Material.DOUBLE_PLANT),
Gems("Gems", Material.DIAMOND);
Gems(" Gems", Material.EMERALD);
private String _prefix;
private Material _displayMaterial;

View File

@ -4,9 +4,9 @@ import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ComplexButton;
public class ActivateGadgetButton implements IButton
public class ActivateGadgetButton extends ComplexButton
{
private Gadget _gadget;
private GadgetPage _page;
@ -28,4 +28,16 @@ public class ActivateGadgetButton implements IButton
{
_page.handleRightClick(player, _gadget);
}
@Override
public void ClickedShiftLeft(Player player)
{
_page.activateGadget(player, _gadget);
}
@Override
public void ClickedShiftRight(Player player)
{
_page.handleRightClick(player, _gadget);
}
}

View File

@ -5,9 +5,9 @@ import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.mount.Mount;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
public class ActivateMountButton implements IButton
public class ActivateMountButton extends SingleButton
{
private Mount<?> _mount;
private MountPage _page;
@ -17,16 +17,12 @@ public class ActivateMountButton implements IButton
_mount = mount;
_page = page;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.activateMount(player, _mount);
}
@Override
public void ClickedRight(Player player)
{
_page.activateMount(player, _mount);
_page.PlayAcceptSound(player);
_mount.Enable(player);
_page.getShop().OpenPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));
}
}

View File

@ -2,11 +2,12 @@ package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.pet.Pet;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
public class ActivatePetButton implements IButton
public class ActivatePetButton extends SingleButton
{
private Pet _pet;
private PetPage _page;
@ -18,14 +19,10 @@ public class ActivatePetButton implements IButton
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.activatePet(player, _pet);
}
@Override
public void ClickedRight(Player player)
{
_page.activatePet(player, _pet);
_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));
}
}

View File

@ -2,18 +2,12 @@ package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
public class CloseButton implements IButton
public class CloseButton extends SingleButton
{
@Override
public void ClickedLeft(Player player)
{
player.closeInventory();
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
player.closeInventory();
}

View File

@ -4,9 +4,9 @@ import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ComplexButton;
public class DeactivateGadgetButton implements IButton
public class DeactivateGadgetButton extends ComplexButton
{
private Gadget _gadget;
private GadgetPage _page;
@ -28,4 +28,16 @@ public class DeactivateGadgetButton implements IButton
{
_page.handleRightClick(player, _gadget);
}
@Override
public void ClickedShiftLeft(Player player)
{
_page.deactivateGadget(player, _gadget);
}
@Override
public void ClickedShiftRight(Player player)
{
_page.handleRightClick(player, _gadget);
}
}

View File

@ -2,11 +2,11 @@ package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.core.mount.Mount;
public class DeactivateMountButton implements IButton
public class DeactivateMountButton extends SingleButton
{
private Mount<?> _mount;
private ShopPageBase<?,?> _page;
@ -16,17 +16,9 @@ public class DeactivateMountButton implements IButton
_mount = mount;
_page = page;
}
@Override
public void ClickedLeft(Player player)
{
_page.PlayAcceptSound(player);
_mount.Disable(player);
_page.Refresh();
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_page.PlayAcceptSound(player);
_mount.Disable(player);

View File

@ -3,10 +3,10 @@ package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.pet.PetManager;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ShopPageBase;
public class DeactivatePetButton implements IButton
public class DeactivatePetButton extends SingleButton
{
private ShopPageBase<?,?> _page;
private PetManager _petManager;
@ -18,15 +18,7 @@ public class DeactivatePetButton implements IButton
}
@Override
public void ClickedLeft(Player player)
{
_page.PlayAcceptSound(player);
_petManager.RemovePet(player, true);
_page.Refresh();
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_page.PlayAcceptSound(player);
_petManager.RemovePet(player, true);

View File

@ -4,9 +4,9 @@ import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
public class GadgetButton implements IButton
public class GadgetButton extends SingleButton
{
private Gadget _gadget;
private GadgetPage _page;
@ -16,15 +16,9 @@ public class GadgetButton implements IButton
_gadget = gadget;
_page = page;
}
@Override
public void ClickedLeft(Player player)
{
_page.purchaseGadget(player, _gadget);
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_page.purchaseGadget(player, _gadget);
}

View File

@ -2,11 +2,15 @@ package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ConfirmationPage;
import mineplex.core.common.CurrencyType;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.cosmetic.ui.CosmeticShop;
import mineplex.core.cosmetic.ui.page.MountPage;
import mineplex.core.mount.Mount;
public class MountButton implements IButton
public class MountButton extends SingleButton
{
private Mount<?> _mount;
private MountPage _page;
@ -16,16 +20,17 @@ public class MountButton implements IButton
_mount = mount;
_page = page;
}
@Override
public void ClickedLeft(Player player)
{
_page.purchaseMount(player, _mount);
}
@Override
public void ClickedRight(Player player)
public void Clicked(final Player player)
{
_page.purchaseMount(player, _mount);
_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, _mount, CurrencyType.Coins, player));
}
}

View File

@ -5,9 +5,6 @@ import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.SingleButton;
/**
* Created by shaun on 14-09-15.
*/
public class OpenCostumes extends SingleButton
{
private Menu _menu;

View File

@ -1,9 +1,11 @@
package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.GadgetPage;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
public class OpenGadgets implements IButton
{
@ -13,16 +15,10 @@ public class OpenGadgets implements IButton
{
_page = page;
}
@Override
public void ClickedLeft(Player player)
{
_page.openGadgets(player);
}
@Override
public void ClickedRight(Player player)
public void Clicked(InventoryClickEvent event)
{
_page.openGadgets(player);
_page.getShop().OpenPageForPlayer((Player)event.getWhoClicked(), new GadgetPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Gadgets", (Player)event.getWhoClicked()));
}
}

View File

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

View File

@ -1,11 +1,12 @@
package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
import mineplex.core.cosmetic.ui.page.MorphPage;
import mineplex.core.shop.item.SingleButton;
import org.bukkit.entity.Player;
public class OpenMounts implements IButton
public class OpenMounts extends SingleButton
{
private Menu _page;
@ -15,14 +16,8 @@ public class OpenMounts implements IButton
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.openMounts(player);
}
@Override
public void ClickedRight(Player player)
{
_page.openMounts(player);
_page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Mounts", player));
}
}

View File

@ -1,11 +1,12 @@
package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
import mineplex.core.cosmetic.ui.page.MorphPage;
import mineplex.core.shop.item.SingleButton;
import org.bukkit.entity.Player;
public class OpenParticles implements IButton
public class OpenParticles extends SingleButton
{
private Menu _page;
@ -13,16 +14,10 @@ public class OpenParticles implements IButton
{
_page = page;
}
@Override
public void ClickedLeft(Player player)
{
_page.openParticles(player);
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_page.openParticles(player);
_page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Particles", player));
}
}

View File

@ -1,11 +1,12 @@
package mineplex.core.cosmetic.ui.button;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
import mineplex.core.cosmetic.ui.page.MorphPage;
import mineplex.core.shop.item.SingleButton;
import org.bukkit.entity.Player;
public class OpenPets implements IButton
public class OpenPets extends SingleButton
{
private Menu _page;
@ -13,16 +14,9 @@ public class OpenPets implements IButton
{
_page = page;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.openPets(player);
}
@Override
public void ClickedRight(Player player)
{
_page.openPets(player);
_page.getShop().OpenPageForPlayer(player, new MorphPage(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), "Pets", player));
}
}

View File

@ -4,9 +4,9 @@ import org.bukkit.entity.Player;
import mineplex.core.pet.Pet;
import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
public class PetButton implements IButton
public class PetButton extends SingleButton
{
private Pet _pet;
private PetPage _page;
@ -16,15 +16,9 @@ public class PetButton implements IButton
_pet = pet;
_page = page;
}
@Override
public void ClickedLeft(Player player)
{
_page.purchasePet(player, _pet);
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_page.purchasePet(player, _pet);
}

View File

@ -1,11 +1,13 @@
package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.PetPage;
import mineplex.core.shop.item.IButton;
import mineplex.core.pet.Pet;
import mineplex.core.shop.item.SingleButton;
public class RenamePetButton implements IButton
public class RenamePetButton extends SingleButton
{
private PetPage _page;
@ -13,16 +15,12 @@ public class RenamePetButton implements IButton
{
_page = page;
}
@Override
public void ClickedLeft(Player player)
{
_page.renameCurrentPet(player);
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_page.renameCurrentPet(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

@ -3,9 +3,9 @@ package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.PetTagPage;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
public class SelectTagButton implements IButton
public class SelectTagButton extends SingleButton
{
private PetTagPage _page;
@ -13,15 +13,9 @@ public class SelectTagButton implements IButton
{
_page = page;
}
@Override
public void ClickedLeft(Player player)
{
_page.SelectTag();
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_page.SelectTag();
}

View File

@ -3,9 +3,9 @@ package mineplex.core.cosmetic.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.cosmetic.ui.page.Menu;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ComplexButton;
public class TreasureButton implements IButton
public class TreasureButton extends ComplexButton
{
private Menu _menu;
private boolean _hasEnoughChests;
@ -40,4 +40,16 @@ public class TreasureButton implements IButton
if (_canPurchaseKey)
_menu.attemptPurchaseKey(player);
}
@Override
public void ClickedShiftLeft(Player player)
{
ClickedLeft(player);
}
@Override
public void ClickedShiftRight(Player player)
{
ClickedRight(player);
}
}

View File

@ -201,31 +201,6 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
});
}
}
public void openParticles(Player player)
{
Shop.OpenPageForPlayer(player, new ParticlePage(Plugin, Shop, ClientManager, DonationManager, "Particles", player));
}
public void openGadgets(Player player)
{
Shop.OpenPageForPlayer(player, new GadgetPage(Plugin, Shop, ClientManager, DonationManager, "Gadgets", player));
}
public void openMorphs(Player player)
{
Shop.OpenPageForPlayer(player, new MorphPage(Plugin, Shop, ClientManager, DonationManager, "Morphs", player));
}
public void openMounts(Player player)
{
Shop.OpenPageForPlayer(player, new MountPage(Plugin, Shop, ClientManager, DonationManager, "Mounts", player));
}
public void openPets(Player player)
{
Shop.OpenPageForPlayer(player, new PetPage(Plugin, Shop, ClientManager, DonationManager, "Pets", player));
}
public void openCostumes(Player player)
{

View File

@ -17,6 +17,7 @@ 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.ShopItem;
import mineplex.core.shop.item.SingleButton;
import mineplex.core.shop.page.ConfirmationPage;
@ -85,23 +86,4 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
}
});
}
public void purchaseMount(final Player player, final Mount<?> mount)
{
Shop.OpenPageForPlayer(Player, new ConfirmationPage<CosmeticManager, CosmeticShop>(Plugin, Shop, ClientManager, DonationManager, new Runnable()
{
public void run()
{
Plugin.getInventoryManager().addItemToInventory(null, Player, "Mount", mount.GetName(), 1);
Refresh();
}
}, this, mount, CurrencyType.Coins, Player));
}
public void activateMount(Player player, Mount<?> _mount)
{
PlayAcceptSound(player);
_mount.Enable(player);
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}
}

View File

@ -137,13 +137,6 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
{
renamePet(player, pet, true);
}
public void renameCurrentPet(Player player)
{
PlayAcceptSound(player);
Creature currentPet = Plugin.getPetManager().getActivePet(player.getName());
renamePet(player, new Pet(currentPet.getCustomName(), currentPet.getType(), 1), false);
}
public void renamePet(Player player, Pet pet, boolean petPurchase)
{
@ -161,13 +154,6 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
Shop.SetCurrentPageForPlayer(Player, petTagPage);
}
public void activatePet(Player player, Pet pet)
{
PlayAcceptSound(player);
Plugin.getPetManager().AddPetOwner(player, pet.GetPetType(), player.getLocation());
Shop.OpenPageForPlayer(Player, new Menu(Plugin, Shop, ClientManager, DonationManager, player));
}
public void deactivatePet(Player player)
{
PlayAcceptSound(player);

View File

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

View File

@ -4,8 +4,9 @@ import org.bukkit.entity.Player;
import mineplex.core.punish.Category;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
public class PunishButton implements IButton
public class PunishButton extends SingleButton
{
private PunishPage _punishPage;
private Category _category;
@ -23,14 +24,8 @@ public class PunishButton implements IButton
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_punishPage.AddInfraction(_category, _severity, _ban, _time);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -416,13 +416,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
{
if (_buttonMap.containsKey(event.getRawSlot()))
{
if (event.getWhoClicked() instanceof Player)
{
if (event.isLeftClick())
_buttonMap.get(event.getRawSlot()).ClickedLeft((Player)event.getWhoClicked());
else if (event.isRightClick())
_buttonMap.get(event.getRawSlot()).ClickedRight((Player)event.getWhoClicked());
}
_buttonMap.get(event.getRawSlot()).Clicked(event);
}
event.setCancelled(true);

View File

@ -3,10 +3,10 @@ package mineplex.core.punish.UI;
import org.bukkit.entity.Player;
import mineplex.core.punish.Punishment;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ShopItem;
import mineplex.core.shop.item.SingleButton;
public class RemovePunishmentButton implements IButton
public class RemovePunishmentButton extends SingleButton
{
private PunishPage _punishPage;
private Punishment _punishment;
@ -18,15 +18,10 @@ public class RemovePunishmentButton implements IButton
_punishment = punishment;
_item = item;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_punishPage.RemovePunishment(_punishment, _item);
}
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

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

View File

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

View File

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

View File

@ -13,11 +13,13 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryClickEvent;
public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends ShopBase<PluginType>> extends ShopPageBase<PluginType, ShopType> implements Runnable
{
@ -59,30 +61,18 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
IButton okClicked = new IButton()
{
@Override
public void ClickedLeft(Player player)
public void Clicked(InventoryClickEvent event)
{
OkClicked(player);
}
@Override
public void ClickedRight(Player player)
{
OkClicked(player);
OkClicked((Player)event.getWhoClicked());
}
};
IButton cancelClicked = new IButton()
{
@Override
public void ClickedLeft(Player player)
public void Clicked(InventoryClickEvent event)
{
CancelClicked(player);
}
@Override
public void ClickedRight(Player player)
{
CancelClicked(player);
CancelClicked((Player)event.getWhoClicked());
}
};
@ -201,15 +191,9 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
IButton returnButton = new IButton()
{
@Override
public void ClickedLeft(Player player)
public void Clicked(InventoryClickEvent event)
{
CancelClicked(player);
}
@Override
public void ClickedRight(Player player)
{
CancelClicked(player);
CancelClicked((Player)event.getWhoClicked());
}
};
@ -227,15 +211,9 @@ public class ConfirmationPage<PluginType extends MiniPlugin, ShopType extends Sh
IButton returnButton = new IButton()
{
@Override
public void ClickedLeft(Player player)
public void Clicked(InventoryClickEvent event)
{
CancelClicked(player);
}
@Override
public void ClickedRight(Player player)
{
CancelClicked(player);
CancelClicked((Player)event.getWhoClicked());
}
};

View File

@ -7,6 +7,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClient;
@ -14,6 +15,7 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.CurrencyType;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilInv;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.item.IButton;
@ -114,10 +116,7 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
{
if (ButtonMap.containsKey(event.getRawSlot()))
{
if (event.isLeftClick())
ButtonMap.get(event.getRawSlot()).ClickedLeft(Player);
if (event.isRightClick())
ButtonMap.get(event.getRawSlot()).ClickedRight(Player);
ButtonMap.get(event.getRawSlot()).Clicked(event);
}
else if (event.getRawSlot() != -999)
{
@ -175,4 +174,24 @@ public abstract class ShopPageBase<PluginType extends MiniPlugin, ShopType exten
{
setItem(column + (row * 9), itemStack);
}
public ShopType getShop()
{
return Shop;
}
public PluginType getPlugin()
{
return Plugin;
}
public CoreClientManager getClientManager()
{
return ClientManager;
}
public DonationManager getDonationManager()
{
return DonationManager;
}
}

View File

@ -107,7 +107,9 @@ public class Clans extends JavaPlugin
new FriendManager(this, _clientManager, preferenceManager);
new InventoryManager(this, _clientManager);
new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, webServerAddress);
new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, webServerAddress);
new Recipes(this);
new Farming(this);
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);

View File

@ -0,0 +1,75 @@
package mineplex.game.clans;
import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Farming extends MiniPlugin
{
public Farming(JavaPlugin plugin)
{
super("Farming", plugin);
}
@EventHandler
public void BlockBreak(BlockPlaceEvent event)
{
if (event.isCancelled())
return;
if (event.getBlock().getType() != Material.LEAVES)
return;
if (event.getPlayer().getItemInHand() != null)
if (event.getPlayer().getItemInHand().getType() == Material.SHEARS)
return;
if (Math.random() > 0.9)
event.getBlock().getWorld().dropItemNaturally(
event.getBlock().getLocation().add(0.5, 0.5, 0.5),
ItemStackFactory.Instance.CreateStack(Material.APPLE));
if (Math.random() > 0.999)
event.getBlock().getWorld().dropItemNaturally(
event.getBlock().getLocation().add(0.5, 0.5, 0.5),
ItemStackFactory.Instance.CreateStack(Material.GOLDEN_APPLE));
}
@EventHandler
public void BlockPlace(BlockPlaceEvent event)
{
if (event.isCancelled())
return;
if (
event.getBlock().getTypeId() != 59 &&
event.getBlock().getTypeId() != 83 &&
event.getBlock().getTypeId() != 104 &&
event.getBlock().getTypeId() != 105 &&
event.getBlock().getTypeId() != 127 &&
event.getBlock().getTypeId() != 141 &&
event.getBlock().getTypeId() != 142
)
return;
if (event.getBlock().getLocation().getY() < event.getBlock().getWorld().getSeaLevel() - 12)
{
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot plant " +
F.item(ItemStackFactory.Instance.GetName(event.getPlayer().getItemInHand(), true)) + " this deep underground."));
event.setCancelled(true);
}
else if (event.getBlock().getLocation().getY() > event.getBlock().getWorld().getSeaLevel() + 24)
{
UtilPlayer.message(event.getPlayer(), F.main(getName(), "You cannot plant " +
F.item(ItemStackFactory.Instance.GetName(event.getPlayer().getItemInHand(), true)) + " at this altitude."));
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,220 @@
package mineplex.game.clans;
import mineplex.core.MiniPlugin;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilServer;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.inventory.PrepareItemCraftEvent;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.plugin.java.JavaPlugin;
public class Recipes extends MiniPlugin
{
public Recipes(JavaPlugin plugin)
{
super("Recipes", plugin);
ShapedRecipe goldAxe = new ShapedRecipe(new ItemStack(Material.GOLD_AXE, 1));
goldAxe.shape("#MM","#SM","#S#");
goldAxe.setIngredient('M', Material.GOLD_BLOCK);
goldAxe.setIngredient('S', Material.STICK);
UtilServer.getServer().addRecipe(goldAxe);
ShapedRecipe diamondAxe = new ShapedRecipe(new ItemStack(Material.DIAMOND_AXE, 1));
diamondAxe.shape("#MM","#SM","#S#");
diamondAxe.setIngredient('M', Material.DIAMOND_BLOCK);
diamondAxe.setIngredient('S', Material.STICK);
UtilServer.getServer().addRecipe(diamondAxe);
ShapedRecipe goldSword = new ShapedRecipe(new ItemStack(Material.GOLD_SWORD, 1));
goldSword.shape("M","M","S");
goldSword.setIngredient('M', Material.GOLD_BLOCK);
goldSword.setIngredient('S', Material.STICK);
UtilServer.getServer().addRecipe(goldSword);
ShapedRecipe diamondSword = new ShapedRecipe(new ItemStack(Material.DIAMOND_SWORD, 1));
diamondSword.shape("M","M","S");
diamondSword.setIngredient('M', Material.DIAMOND_BLOCK);
diamondSword.setIngredient('S', Material.STICK);
UtilServer.getServer().addRecipe(diamondSword);
//Iron Door
ShapedRecipe ironDoor = new ShapedRecipe(new ItemStack(Material.IRON_DOOR, 1));
ironDoor.shape("I","I");
ironDoor.setIngredient('I', Material.IRON_INGOT);
UtilServer.getServer().addRecipe(ironDoor);
//Chain Helm
ShapedRecipe chainHelm = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_HELMET, 1));
chainHelm.shape("SIS","I#I");
chainHelm.setIngredient('I', Material.IRON_INGOT);
chainHelm.setIngredient('S', Material.GOLD_INGOT);
UtilServer.getServer().addRecipe(chainHelm);
//Chain Chest
ShapedRecipe chainChest = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1));
chainChest.shape("I#I","SIS","ISI");
chainChest.setIngredient('I', Material.IRON_INGOT);
chainChest.setIngredient('S', Material.GOLD_INGOT);
UtilServer.getServer().addRecipe(chainChest);
//Chain Legs
ShapedRecipe chainLegs = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1));
chainLegs.shape("ISI","S#S","I#I");
chainLegs.setIngredient('I', Material.IRON_INGOT);
chainLegs.setIngredient('S', Material.GOLD_INGOT);
UtilServer.getServer().addRecipe(chainLegs);
//Chain Boots
ShapedRecipe chainBoots = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_BOOTS, 1));
chainBoots.shape("S#S","I#I");
chainBoots.setIngredient('I', Material.IRON_INGOT);
chainBoots.setIngredient('S', Material.GOLD_INGOT);
UtilServer.getServer().addRecipe(chainBoots);
//Chain Helm
ShapedRecipe chainHelm2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_HELMET, 1));
chainHelm2.shape("SIS","I#I");
chainHelm2.setIngredient('I', Material.GOLD_INGOT);
chainHelm2.setIngredient('S', Material.IRON_INGOT);
UtilServer.getServer().addRecipe(chainHelm2);
//Chain Chest
ShapedRecipe chainChest2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1));
chainChest2.shape("I#I","SIS","ISI");
chainChest2.setIngredient('I', Material.GOLD_INGOT);
chainChest2.setIngredient('S', Material.IRON_INGOT);
UtilServer.getServer().addRecipe(chainChest2);
//Chain Legs
ShapedRecipe chainLegs2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_LEGGINGS, 1));
chainLegs2.shape("ISI","S#S","I#I");
chainLegs2.setIngredient('I', Material.GOLD_INGOT);
chainLegs2.setIngredient('S', Material.IRON_INGOT);
UtilServer.getServer().addRecipe(chainLegs2);
//Chain Boots
ShapedRecipe chainBoots2 = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_BOOTS, 1));
chainBoots2.shape("S#S","I#I");
chainBoots2.setIngredient('I', Material.GOLD_INGOT);
chainBoots2.setIngredient('S', Material.IRON_INGOT);
UtilServer.getServer().addRecipe(chainBoots2);
}
@EventHandler(priority = EventPriority.HIGH)
public void ReplaceDoor(PrepareItemCraftEvent event)
{
if (event.getRecipe().getResult() == null)
return;
Material type = event.getRecipe().getResult().getType();
if (type != Material.WOOD_DOOR && type != Material.WOODEN_DOOR)
return;
if (!(event.getInventory() instanceof CraftingInventory))
return;
CraftingInventory inv = (CraftingInventory)event.getInventory();
//Feedback
ItemStack result = ItemStackFactory.Instance.CreateStack(Material.IRON_DOOR);
inv.setResult(result);
}
@EventHandler(priority = EventPriority.HIGH)
public void DenySword(PrepareItemCraftEvent event)
{
if (event.getRecipe().getResult() == null)
return;
Material type = event.getRecipe().getResult().getType();
if (type != Material.DIAMOND_SWORD && type != Material.GOLD_SWORD &&
type != Material.DIAMOND_AXE && type != Material.GOLD_AXE)
return;
if (!(event.getInventory() instanceof CraftingInventory))
return;
CraftingInventory inv = (CraftingInventory)event.getInventory();
for (ItemStack cur : inv.getMatrix())
if (cur != null)
if (cur.getType() == Material.GOLD_BLOCK || cur.getType() == Material.DIAMOND_BLOCK)
return;
String name = ItemStackFactory.Instance.GetName(event.getRecipe().getResult(), true);
String matName = "Gold";
if (type == Material.DIAMOND_AXE || type == Material.DIAMOND_SWORD)
matName = "Diamond";
//Feedback
ItemStack result = ItemStackFactory.Instance.CreateStack(36, (byte)0, 1, "§r" + C.cGray + "Recipe changed for " + F.item(name) + ".",
new String[] {C.cGray + "Use " + F.item(matName + " Blocks") + " instead of " + F.item(matName + " Ingots") + "."});
inv.setResult(result);
}
@EventHandler(priority = EventPriority.HIGH)
public void DenyGeneral(PrepareItemCraftEvent event)
{
if (event.getRecipe().getResult() == null)
return;
Material type = event.getRecipe().getResult().getType();
if (
type != Material.GOLDEN_APPLE &&
type != Material.GOLDEN_CARROT &&
type != Material.ENDER_CHEST &&
type != Material.ENCHANTMENT_TABLE &&
type != Material.BREWING_STAND &&
type != Material.TNT)
return;
if (!(event.getInventory() instanceof CraftingInventory))
return;
CraftingInventory inv = (CraftingInventory)event.getInventory();
String name = ItemStackFactory.Instance.GetName(event.getRecipe().getResult(), true);
//Feedback
ItemStack result = ItemStackFactory.Instance.CreateStack(36, (byte)0, 1,
"§r" + C.cGray + "Crafting of " + F.item(name) + " is disabled.", new String[] {});
inv.setResult(result);
}
}

View File

@ -1,7 +1,5 @@
package mineplex.game.clans.clans;
import java.util.ArrayList;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.block.Block;
@ -12,7 +10,6 @@ import mineplex.core.common.util.UtilWorld;
import mineplex.game.clans.clans.ClanInfo.Role;
import mineplex.game.clans.clans.repository.ClanRepository;
import mineplex.game.clans.clans.repository.ClanTerritory;
import mineplex.game.clans.clans.repository.tokens.ClanMemberToken;
import mineplex.game.clans.clans.repository.tokens.ClanToken;
public class ClansDataAccessLayer

View File

@ -36,6 +36,7 @@ import mineplex.game.clans.clans.repository.tokens.ClanMemberToken;
import mineplex.game.clans.clans.repository.tokens.ClanTerritoryToken;
import mineplex.game.clans.clans.repository.tokens.ClanToken;
import mineplex.game.clans.fields.Field;
import mineplex.game.clans.gameplay.Gameplay;
import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
@ -111,6 +112,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
DamageManager damageManager = new DamageManager(plugin, _combatManager, new NpcManager(plugin, creature), disguiseManager);
new Gameplay(plugin, this, blockRestore, damageManager);
ProjectileManager throwManager = new ProjectileManager(plugin);
Fire fire = new Fire(plugin, _condition, damageManager);
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, damageManager, energy, fire, throwManager, webServerAddress);
@ -177,6 +179,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
if (_classManager.Get(event.getPlayer()) != null && _classManager.Get(event.getPlayer()).GetGameClass() != null)
{
CustomBuildToken activeBuild = _classManager.Get(event.getPlayer()).GetActiveCustomBuild(_classManager.Get(event.getPlayer()).GetGameClass());
if (activeBuild == null)
return;
activeBuild.PlayerName = event.getPlayer().getName();
// 0 is set aside for active build so we just dupe build to this row whenever we update it.

View File

@ -0,0 +1,21 @@
package mineplex.game.clans.gameplay;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.command.CommandBase;
import mineplex.core.common.Rank;
public class DieCommand extends CommandBase<Gameplay>
{
public DieCommand(Gameplay plugin)
{
super(plugin, Rank.ALL, "die");
}
@Override
public void Execute(Player caller, String[] args)
{
Plugin.getDamageManager().NewDamageEvent(caller, null, null, DamageCause.SUICIDE, 5000, false, true, true, null, null);
}
}

View File

@ -0,0 +1,480 @@
package mineplex.game.clans.gameplay;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.MiniPlugin;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.game.clans.clans.ClansManager;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerBucketEmptyEvent;
import org.bukkit.event.player.PlayerBucketFillEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.plugin.java.JavaPlugin;
public class Gameplay extends MiniPlugin
{
private ClansManager _clansManager;
private BlockRestore _blockRestore;
private DamageManager _damageManager;
private HashMap<Block, Long> _bucketWater = new HashMap<Block, Long>();
public Gameplay(JavaPlugin plugin, ClansManager clansManager, BlockRestore blockRestore, DamageManager damageManager)
{
super("PvP Gameplay", plugin);
_clansManager = clansManager;
_blockRestore = blockRestore;
_damageManager = damageManager;
}
@EventHandler
public void BucketEmpty(PlayerBucketEmptyEvent event)
{
event.setCancelled(true);
Block block = event.getBlockClicked().getRelative(event.getBlockFace());
if (event.getBucket() == Material.WATER_BUCKET)
{
block.setTypeIdAndData(8, (byte)1, true);
_blockRestore.Add(event.getBlockClicked().getRelative(event.getBlockFace()), 8, (byte)0, 1000);
_bucketWater.put(block, System.currentTimeMillis());
}
if (event.getBucket() == Material.LAVA_BUCKET)
{
block.setTypeIdAndData(10, (byte)6, true);
_blockRestore.Add(event.getBlockClicked().getRelative(event.getBlockFace()), 10, (byte)0, 2000);
}
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.BUCKET));
UtilInv.Update(event.getPlayer());
}
@EventHandler
public void BucketFill(PlayerBucketFillEvent event)
{
event.setCancelled(true);
if (event.getItemStack().getType() == Material.WATER_BUCKET)
if (!_bucketWater.containsKey(event.getBlockClicked()))
event.getPlayer().setItemInHand(ItemStackFactory.Instance.CreateStack(Material.WATER_BUCKET));
UtilInv.Update(event.getPlayer());
}
@EventHandler
public void BucketWaterExpire(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
HashSet<Block> remove = new HashSet<Block>();
for (Block cur : _bucketWater.keySet())
if (UtilTime.elapsed(_bucketWater.get(cur), 2000))
remove.add(cur);
for (Block cur : remove)
_bucketWater.remove(cur);
}
@EventHandler(priority = EventPriority.LOWEST)
public void ObsidianCancel(BlockPlaceEvent event)
{
if (event.getBlock().getType() == Material.OBSIDIAN)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Obsidian") + "."));
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void CommandPlace(BlockPlaceEvent event)
{
if (event.getBlock().getType() == Material.COMMAND ||
event.getBlock().getType() == Material.NOTE_BLOCK ||
event.getBlock().getType() == Material.REDSTONE_LAMP_ON)
{
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot place " + F.item("Proximity Devices") + "."));
event.setCancelled(true);
}
}
@EventHandler
public void WebBreak(BlockDamageEvent event)
{
if (event.isCancelled())
return;
if (event.getBlock().getType() == Material.WEB)
event.setInstaBreak(true);
}
@EventHandler
public void LapisPlace(BlockPlaceEvent event)
{
if (event.isCancelled())
return;
if (event.getBlock().getType() != Material.LAPIS_BLOCK)
return;
event.setCancelled(true);
UtilInv.remove(event.getPlayer(), Material.LAPIS_BLOCK, (byte)0, 1);
final Block block = event.getBlock();
_plugin.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
{
public void run()
{
block.setTypeId(8);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 8);
block.getWorld().playSound(block.getLocation(), Sound.SPLASH, 2f, 1f);
}
}, 0);
}
@EventHandler
public void EnderChestBreak(BlockBreakEvent event)
{
if (event.isCancelled())
return;
if (event.getBlock().getType() != Material.ENDER_CHEST)
return;
event.setCancelled(true);
event.getBlock().setTypeId(0);
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST));
}
@EventHandler
public void IronDoor(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
if (event.getClickedBlock().getTypeId() != 71)
return;
Block block = event.getClickedBlock();
//Knock
if (event.isCancelled())
{
if (!Recharge.Instance.use(event.getPlayer(), "Door Knock", 500, false, false))
return;
block.getWorld().playEffect(block.getLocation(), Effect.ZOMBIE_CHEW_WOODEN_DOOR, 0);
}
//Open
else
{
if (block.getData() >= 8)
block = block.getRelative(BlockFace.DOWN);
if (block.getData() < 4) block.setData((byte)(block.getData()+4), true);
else block.setData((byte)(block.getData()-4), true);
//Effect
block.getWorld().playEffect(block.getLocation(), Effect.DOOR_TOGGLE, 0);
}
}
@EventHandler
public void BrewingDisable(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
if (event.getClickedBlock().getTypeId() != 117)
return;
event.setCancelled(true);
}
@EventHandler
public void BrewingBreak(BlockBreakEvent event)
{
if (event.isCancelled())
return;
if (event.getBlock().getType() != Material.BREWING_STAND)
return;
event.setCancelled(true);
event.getBlock().setTypeId(0);
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.BREWING_STAND));
}
@EventHandler
public void AnvilDisable(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
if (event.getClickedBlock().getType() != Material.ANVIL)
return;
event.setCancelled(true);
}
@EventHandler
public void BonemealCancel(PlayerInteractEvent event)
{
if (!UtilEvent.isAction(event, ActionType.R))
return;
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.INK_SACK)
return;
if (player.getItemInHand().getData() == null)
return;
if (player.getItemInHand().getData().getData() != 15)
return;
event.setCancelled(true);
}
@EventHandler
public void WildfireSpread(BlockBurnEvent event)
{
if (event.isCancelled())
return;
event.setCancelled(true);
for (int x=-1 ; x<=1 ; x++)
for (int y=-1 ; y<=1 ; y++)
for (int z=-1 ; z<=1 ; z++)
{
//Self
if (x == 0 && y == 0 && z == 0)
{
event.getBlock().setType(Material.FIRE);
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS)
event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
return;
}
Block block = event.getBlock().getRelative(x, y, z);
if (block.getRelative(BlockFace.DOWN).getType() == Material.GRASS)
block.getRelative(BlockFace.DOWN).setType(Material.DIRT);
//Surroundings
if (!(
(x == 0 && y == 0) ||
(x == 0 && z == 0) ||
(y == 0 && z == 0)
))
continue;
if (block.getTypeId() == 0)
block.setType(Material.FIRE);
}
}
@EventHandler
public void WildfireDirt(BlockIgniteEvent event)
{
if (event.isCancelled())
return;
if (event.getBlock().getRelative(BlockFace.DOWN).getType() == Material.GRASS)
event.getBlock().getRelative(BlockFace.DOWN).setType(Material.DIRT);
}
@EventHandler(priority = EventPriority.LOW)
public void WildfireCancel(BlockIgniteEvent event)
{
if (event.isCancelled())
return;
if (event.getBlock().getBiome() == Biome.JUNGLE || event.getBlock().getBiome() == Biome.JUNGLE_HILLS)
if (event.getCause() == IgniteCause.SPREAD)
event.setCancelled(true);
}
/*
@EventHandler (priority = EventPriority.HIGHEST)
public void MoneyLossSteal(CombatDeathEvent event)
{
if (!(event.GetEvent().getEntity() instanceof Player))
return;
Player player = (Player)event.GetEvent().getEntity();
int balance = Clients().Get(player).Game().GetEconomyBalance();
int lose = (int) (0.04 * balance);
//Balance
Clients().Get(player).Game().SetEconomyBalance(balance - lose);
CombatLog log = event.GetLog();
if (log.GetKiller() != null)
{
//Inform
UtilPlayer.message(UtilPlayer.searchExact(log.GetKiller().getName()), F.main("Death", "You stole " + F.count((lose) + " Coins") + " from " + F.name(player.getName()) + "."));
//Inform
UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " to " + F.name(log.GetKiller().getName()) + "."));
}
else
{
//Inform
UtilPlayer.message(player, F.main("Death", "You lost " + F.count((lose) + " Coins") + " for dying."));
}
}
*/
@EventHandler
public void SpawnDamage(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
if (event.GetCause() != DamageCause.FALL)
return;
if (!_clansManager.getClanUtility().isSpecial(event.GetDamageeEntity().getLocation(), "Spawn"))
return;
event.SetCancelled("Spawn Fall");
}
@EventHandler
public void Repair(PlayerInteractEvent event)
{
if (event.getClickedBlock() == null)
return;
if (event.getClickedBlock().getType() != Material.ANVIL)
return;
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
return;
Player player = event.getPlayer();
if (UtilMath.offset(player.getLocation(), event.getClickedBlock().getLocation()) > 2)
{
UtilPlayer.message(player, F.main("Repair", "You are too far from the " + F.item("Anvil") + "."));
return;
}
if (player.getItemInHand() == null)
return;
ItemStack item = player.getItemInHand();
if (item.getDurability() <= 0)
{
UtilPlayer.message(player, F.main("Repair", "Your " + F.item(item == null ? ChatColor.YELLOW + "Hand" : item.getItemMeta().getDisplayName()) + " does not need repairs."));
return;
}
if (!UtilGear.isRepairable(item))
{
UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + "."));
return;
}
String creator = ItemStackFactory.Instance.GetLoreVar(item, "Owner");
if (creator != null)
{
if (creator.length() > 2)
creator = creator.substring(2, creator.length());
if (!creator.equals(player.getName()))
{
UtilPlayer.message(player, F.main("Repair", "You cannot repair " + F.item(item.getItemMeta().getDisplayName()) + " by " + F.name(creator) + "."));
return;
}
}
//Repair!
UtilPlayer.message(player, F.main("Repair", "You repaired " + F.item(item.getItemMeta().getDisplayName()) + "."));
item.setDurability((short)0);
UtilInv.Update(player);
//Break
if (Math.random() > 0.85)
event.getClickedBlock().setData((byte) (event.getClickedBlock().getData() + 4));
if (event.getClickedBlock().getData() >= 12)
{
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, 145);
event.getClickedBlock().setTypeIdAndData(0, (byte)0, true);
}
//Record
int repairs = 1 + ItemStackFactory.Instance.GetLoreVar(item, "Repaired", 0);
ItemStackFactory.Instance.SetLoreVar(item, "Repaired", "" + repairs);
//Effect
player.playSound(player.getLocation(), Sound.ANVIL_USE, 1f, 1f);
}
public DamageManager getDamageManager()
{
return _damageManager;
}
}

View File

@ -0,0 +1,20 @@
package mineplex.game.clans.shop;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
public class BuildingPage extends ShopPageBase<ClansManager, BuildingShop>
{
public BuildingPage(ClansManager plugin, BuildingShop shop, CoreClientManager clientManager, DonationManager donationManager, org.bukkit.entity.Player player)
{
super(plugin, shop, clientManager, donationManager, "Building Supplies", player);
}
@Override
protected void BuildPage()
{
}
}

View File

@ -0,0 +1,22 @@
package mineplex.game.clans.shop;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
import mineplex.game.clans.clans.ClansManager;
public class BuildingShop extends ShopBase<ClansManager>
{
public BuildingShop(ClansManager plugin, CoreClientManager clientManager, mineplex.core.donation.DonationManager donationManager)
{
super(plugin, clientManager, donationManager, "Building Materials");
}
@Override
protected ShopPageBase<ClansManager, ? extends ShopBase<ClansManager>> BuildPagesFor(Player player)
{
return new BuildingPage(Plugin, this, ClientManager, DonationManager, player);
}
}

View File

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

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectBHButton implements IButton
public class SelectBHButton extends SingleButton
{
private ServerGameMenu _menu;
@ -13,15 +13,9 @@ public class SelectBHButton implements IButton
{
_menu = menu;
}
@Override
public void ClickedLeft(Player player)
{
_menu.OpenBH(player);
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_menu.OpenBH(player);
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectBRButton implements IButton
public class SelectBRButton extends SingleButton
{
private ServerGameMenu _menu;
@ -13,15 +13,9 @@ public class SelectBRButton implements IButton
{
_menu = menu;
}
@Override
public void ClickedLeft(Player player)
{
_menu.OpenBR(player);
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_menu.OpenBR(player);
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectCSButton implements IButton
public class SelectCSButton extends SingleButton
{
private ServerGameMenu _menu;
@ -15,14 +15,8 @@ public class SelectCSButton implements IButton
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_menu.openCS(player);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectDMTButton implements IButton
public class SelectDMTButton extends SingleButton
{
private ServerGameMenu _menu;
@ -13,16 +13,10 @@ public class SelectDMTButton implements IButton
{
_menu = menu;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_menu.openDMT(player);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectDOMButton implements IButton
public class SelectDOMButton extends SingleButton
{
private ServerGameMenu _menu;
@ -13,16 +13,10 @@ public class SelectDOMButton implements IButton
{
_menu = menu;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_menu.OpenDOM(player);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectMINButton implements IButton
public class SelectMINButton extends SingleButton
{
private ServerGameMenu _menu;
@ -13,16 +13,10 @@ public class SelectMINButton implements IButton
{
_menu = menu;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_menu.OpenMIN(player);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectMSButton implements IButton
public class SelectMSButton extends SingleButton
{
private ServerGameMenu _menu;
@ -13,16 +13,10 @@ public class SelectMSButton implements IButton
{
_menu = menu;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_menu.openMS(player);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectSGButton implements IButton
public class SelectSGButton extends SingleButton
{
private ServerGameMenu _menu;
@ -13,16 +13,10 @@ public class SelectSGButton implements IButton
{
_menu = menu;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_menu.OpenSG(player);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectSSMButton implements IButton
public class SelectSSMButton extends SingleButton
{
private ServerGameMenu _menu;
@ -13,16 +13,10 @@ public class SelectSSMButton implements IButton
{
_menu = menu;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_menu.OpenSSM(player);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,10 +2,10 @@ package mineplex.hub.server.ui.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.hub.server.ui.ServerGameMenu;
public class SelectTDMButton implements IButton
public class SelectTDMButton extends SingleButton
{
private ServerGameMenu _menu;
@ -15,14 +15,8 @@ public class SelectTDMButton implements IButton
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_menu.OpenTDM(player);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class DeleteCustomBuildButton implements IButton
public class DeleteCustomBuildButton extends SingleButton
{
private CustomBuildPage _page;
private CustomBuildToken _customBuild;
@ -18,14 +18,8 @@ public class DeleteCustomBuildButton implements IButton
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.DeleteCustomBuild(_customBuild);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
public class DeselectItemButton implements IButton
public class DeselectItemButton extends SingleButton
{
private SkillPage _page;
private Item _item;
@ -18,17 +18,10 @@ public class DeselectItemButton implements IButton
_item = item;
_index = index;
}
@Override
public void ClickedLeft(Player player)
{
_page.DeselectItem(player, _item, _index);
}
@Override
public void ClickedRight(Player player)
{
@Override
public void Clicked(Player player)
{
_page.DeselectItem(player, _item, _index);
}
}

View File

@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class EditAndSaveCustomBuildButton implements IButton
public class EditAndSaveCustomBuildButton extends SingleButton
{
private CustomBuildPage _page;
private CustomBuildToken _customBuild;
@ -18,14 +18,8 @@ public class EditAndSaveCustomBuildButton implements IButton
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.EditAndSaveCustomBuild(_customBuild);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -1,12 +1,12 @@
package mineplex.minecraft.game.classcombat.shop.button;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
import org.bukkit.entity.Player;
public class PurchaseItemButton implements IButton
public class PurchaseItemButton extends SingleButton
{
private SkillPage _page;
private Item _item;
@ -16,16 +16,10 @@ public class PurchaseItemButton implements IButton
_page = page;
_item = item;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.PurchaseItem(player, _item);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -1,12 +1,12 @@
package mineplex.minecraft.game.classcombat.shop.button;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.minecraft.game.classcombat.Skill.ISkill;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
import org.bukkit.entity.Player;
public class PurchaseSkillButton implements IButton
public class PurchaseSkillButton extends SingleButton
{
private SkillPage _page;
private ISkill _skill;
@ -16,16 +16,10 @@ public class PurchaseSkillButton implements IButton
_page = page;
_skill = skill;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.PurchaseSkill(player, _skill);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
import mineplex.minecraft.game.classcombat.shop.page.ArmorPage;
public class SelectClassButton implements IButton
public class SelectClassButton extends SingleButton
{
ArmorPage _page;
private IPvpClass _pvpClass;
@ -18,13 +18,7 @@ public class SelectClassButton implements IButton
}
@Override
public void ClickedLeft(Player player)
{
_page.SelectClass(player, _pvpClass);
}
@Override
public void ClickedRight(Player player)
public void Clicked(Player player)
{
_page.SelectClass(player, _pvpClass);
}

View File

@ -2,11 +2,11 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.SingleButton;
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
public class SelectCustomBuildButton implements IButton
public class SelectCustomBuildButton extends SingleButton
{
private CustomBuildPage _page;
private CustomBuildToken _customBuild;
@ -16,16 +16,10 @@ public class SelectCustomBuildButton implements IButton
_page = page;
_customBuild = customBuild;
}
@Override
public void ClickedLeft(Player player)
public void Clicked(Player player)
{
_page.SelectCustomBuild(_customBuild);
}
@Override
public void ClickedRight(Player player)
{
ClickedLeft(player);
}
}

View File

@ -3,11 +3,11 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.IButton;
import mineplex.core.shop.item.ComplexButton;
import mineplex.minecraft.game.classcombat.item.Item;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
public class SelectItemButton implements IButton
public class SelectItemButton extends ComplexButton
{
private SkillPage _page;
private Item _item;
@ -37,4 +37,16 @@ public class SelectItemButton implements IButton
{
_page.DeselectItem(player, _item);
}
@Override
public void ClickedShiftLeft(Player player)
{
ClickedLeft(player);
}
@Override
public void ClickedShiftRight(Player player)
{
ClickedRight(player);
}
}

View File

@ -3,11 +3,12 @@ package mineplex.minecraft.game.classcombat.shop.button;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import mineplex.core.shop.item.ComplexButton;
import mineplex.core.shop.item.IButton;
import mineplex.minecraft.game.classcombat.Skill.ISkill;
import mineplex.minecraft.game.classcombat.shop.page.SkillPage;
public class SelectSkillButton implements IButton
public class SelectSkillButton extends ComplexButton
{
private SkillPage _page;
private ISkill _skill;
@ -39,4 +40,16 @@ public class SelectSkillButton implements IButton
{
_page.DeselectSkill(player, _skill);
}
@Override
public void ClickedShiftLeft(Player player)
{
ClickedLeft(player);
}
@Override
public void ClickedShiftRight(Player player)
{
ClickedRight(player);
}
}