Fix soup consumption bug that didn't allow left clicking for use. Fix bug with item frames being destroyed inside spawn zones. Fix bug with bow deficient classes not properly receiving damage reductions on their bow attacks. Fix bug with Whirlwind Axe skill being enabled in Clans settings. Fix bug where bank related shop buttons functioned as gold token purchasables for error-displaying icons. Increasing duration on potion application from custom gear to prevent shaking inventory screen. Fix bug with gold balance changes (add/remove) weren't taking place synchronously, leading to the ability for duplication of gold and items. Fix bug where enemy'd Clans could be allied or neutral'd, as well as signaling that at-war clans were neutral. Fix bug where clans could unclaim admin chunks and ally chunks. Decrease the rate at which hunger decreases to be more accordance with 1.6 food systems. Disable Flint & Steel, Enderpearls, and Witch spawning.
This commit is contained in:
parent
13f47ad903
commit
6c9a99fa1b
@ -16,7 +16,8 @@ public class UtilEvent
|
|||||||
L_BLOCK,
|
L_BLOCK,
|
||||||
R,
|
R,
|
||||||
R_AIR,
|
R_AIR,
|
||||||
R_BLOCK
|
R_BLOCK,
|
||||||
|
ANY
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAction(PlayerInteractEvent event, ActionType action)
|
public static boolean isAction(PlayerInteractEvent event, ActionType action)
|
||||||
@ -39,6 +40,9 @@ public class UtilEvent
|
|||||||
if (action == ActionType.R_BLOCK)
|
if (action == ActionType.R_BLOCK)
|
||||||
return (event.getAction() == Action.RIGHT_CLICK_BLOCK);
|
return (event.getAction() == Action.RIGHT_CLICK_BLOCK);
|
||||||
|
|
||||||
|
if (action == ActionType.ANY)
|
||||||
|
return event.getAction() != Action.PHYSICAL;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Database"/>
|
||||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/jooq-3.5.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 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"/>
|
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
|
||||||
|
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -295,6 +295,11 @@ public class DonationManager extends MiniDbClientPlugin<Donor>
|
|||||||
_coinQueue.clear();
|
_coinQueue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void rewardGold(Callback<Boolean> callback, String caller, Player player, int amount)
|
||||||
|
{
|
||||||
|
rewardGold(callback, caller, player.getName(), ClientManager.Get(player).getAccountId(), amount);
|
||||||
|
}
|
||||||
|
|
||||||
public void rewardGold(Callback<Boolean> callback, String caller, String name, int accountId, int amount)
|
public void rewardGold(Callback<Boolean> callback, String caller, String name, int accountId, int amount)
|
||||||
{
|
{
|
||||||
rewardGold(callback, caller, name, accountId, amount, true);
|
rewardGold(callback, caller, name, accountId, amount, true);
|
||||||
|
@ -162,6 +162,11 @@ public class ClanInfo
|
|||||||
return getAllyMap().containsKey(other);
|
return getAllyMap().containsKey(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAlly(ClanInfo other)
|
||||||
|
{
|
||||||
|
return isAlly(other.getName());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSelf(String other)
|
public boolean isSelf(String other)
|
||||||
{
|
{
|
||||||
return this.getName().equals(other);
|
return this.getName().equals(other);
|
||||||
@ -169,7 +174,7 @@ public class ClanInfo
|
|||||||
|
|
||||||
public boolean isNeutral(String other)
|
public boolean isNeutral(String other)
|
||||||
{
|
{
|
||||||
return (!isAlly(other) && !isSelf(other));
|
return (!isAlly(other) && !isSelf(other) && !isEnemy(other));
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimer()
|
public long getTimer()
|
||||||
@ -451,6 +456,11 @@ public class ClanInfo
|
|||||||
return _enemyData != null;
|
return _enemyData != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnemy(String clanName)
|
||||||
|
{
|
||||||
|
return hasEnemy() && clanName != null && clanName.equals(_enemyData.getEnemyName());
|
||||||
|
}
|
||||||
|
|
||||||
public void adjustEnergy(int energy)
|
public void adjustEnergy(int energy)
|
||||||
{
|
{
|
||||||
_energy += energy;
|
_energy += energy;
|
||||||
|
@ -174,6 +174,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, damageManager, energy, fire, _projectileManager, webServerAddress, itemIgnore);
|
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, damageManager, energy, fire, _projectileManager, webServerAddress, itemIgnore);
|
||||||
SkillFactory skillManager = new SkillFactory(plugin, damageManager, this, _combatManager, _condition, _projectileManager, disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy, webServerAddress);
|
SkillFactory skillManager = new SkillFactory(plugin, damageManager, this, _combatManager, _condition, _projectileManager, disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy, webServerAddress);
|
||||||
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
|
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
|
||||||
|
skillManager.removeSkill("Whirlwind Axe");
|
||||||
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
||||||
|
|
||||||
StatsManager statsManager = new StatsManager(plugin, _clientManager);
|
StatsManager statsManager = new StatsManager(plugin, _clientManager);
|
||||||
@ -249,6 +250,12 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
|||||||
return x <= FIELD_RADIUS && z <= FIELD_RADIUS;
|
return x <= FIELD_RADIUS && z <= FIELD_RADIUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canUnclaimChunk(ClanInfo stealer, ClanInfo owner)
|
||||||
|
{
|
||||||
|
return owner.getClaims() > owner.getClaimsMax()
|
||||||
|
&& !owner.isAdmin() && !owner.isAlly(stealer);
|
||||||
|
}
|
||||||
|
|
||||||
public ClanInfo getClan(Player player)
|
public ClanInfo getClan(Player player)
|
||||||
{
|
{
|
||||||
return _clanMemberMap.get(player.getName());
|
return _clanMemberMap.get(player.getName());
|
||||||
|
@ -704,6 +704,12 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cA.isEnemy(cB.getName()))
|
||||||
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "You cannot form an alliance with an enemy clan."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (cB.isRequested(cA.getName()))
|
if (cB.isRequested(cA.getName()))
|
||||||
{
|
{
|
||||||
//Task
|
//Task
|
||||||
@ -806,16 +812,16 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
if (cB.isSelf(cA.getName()))
|
if (cB.isSelf(cA.getName()))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
|
UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (cB.isEnemy(cA.getName()))
|
||||||
if (cB.isNeutral(cA.getName()))
|
{
|
||||||
|
UtilPlayer.message(caller, F.main("Clans", "You are currently enemies with " + F.elem("Clan " + cB.getName()) + "."));
|
||||||
|
}
|
||||||
|
else if (cB.isNeutral(cA.getName()))
|
||||||
{
|
{
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
|
UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (cB.isAlly(cA.getName()))
|
||||||
if (cB.isAlly(cA.getName()))
|
|
||||||
{
|
{
|
||||||
//Task
|
//Task
|
||||||
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
|
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
|
||||||
@ -824,8 +830,6 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
|
||||||
cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
|
||||||
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
|
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1043,11 +1047,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
|
|
||||||
public boolean unclaimSteal(Player caller, ClanInfo clientClan, ClanInfo ownerClan)
|
public boolean unclaimSteal(Player caller, ClanInfo clientClan, ClanInfo ownerClan)
|
||||||
{
|
{
|
||||||
if (ownerClan.getClaims() > ownerClan.getClaimsMax())
|
if (!_manager.canUnclaimChunk(clientClan, ownerClan))
|
||||||
{
|
|
||||||
//Nothing Extra
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -180,8 +180,7 @@ public class GoldManager extends MiniPlugin
|
|||||||
|
|
||||||
public void deductGold(Callback<Boolean> resultCallback, Player player, int amount)
|
public void deductGold(Callback<Boolean> resultCallback, Player player, int amount)
|
||||||
{
|
{
|
||||||
_donationManager.RewardGoldLater("GoldManager", player, -amount);
|
_donationManager.rewardGold(resultCallback, "GoldManager", player, -amount);
|
||||||
_donationManager.updateGoldQueue(resultCallback, player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cashIn(Player player, GoldToken token)
|
public void cashIn(Player player, GoldToken token)
|
||||||
|
@ -20,6 +20,8 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
|
import mineplex.game.clans.items.generation.Weight;
|
||||||
|
import mineplex.game.clans.items.generation.WeightSet;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
@ -28,9 +30,11 @@ import org.bukkit.Sound;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockBurnEvent;
|
import org.bukkit.event.block.BlockBurnEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
@ -39,6 +43,8 @@ import org.bukkit.event.block.BlockIgniteEvent;
|
|||||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
|
import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
@ -50,6 +56,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
private ClansManager _clansManager;
|
private ClansManager _clansManager;
|
||||||
private BlockRestore _blockRestore;
|
private BlockRestore _blockRestore;
|
||||||
private DamageManager _damageManager;
|
private DamageManager _damageManager;
|
||||||
|
private WeightSet<Boolean> _foodDecrease; // Weighted probability sets for food decrease event outcomes
|
||||||
|
|
||||||
private HashMap<Block, Long> _bucketWater = new HashMap<Block, Long>();
|
private HashMap<Block, Long> _bucketWater = new HashMap<Block, Long>();
|
||||||
|
|
||||||
@ -60,6 +67,7 @@ public class Gameplay extends MiniPlugin
|
|||||||
_clansManager = clansManager;
|
_clansManager = clansManager;
|
||||||
_blockRestore = blockRestore;
|
_blockRestore = blockRestore;
|
||||||
_damageManager = damageManager;
|
_damageManager = damageManager;
|
||||||
|
_foodDecrease = new WeightSet<Boolean>(new Weight<Boolean>(50, true), new Weight<Boolean>(50, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -87,6 +95,21 @@ public class Gameplay extends MiniPlugin
|
|||||||
UtilInv.Update(event.getPlayer());
|
UtilInv.Update(event.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decreases the hunger rate decrease speed by arbitrarily canceling a portion of decrease events.
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler(ignoreCancelled=true)
|
||||||
|
public void foodChangeLevel(FoodLevelChangeEvent event)
|
||||||
|
{
|
||||||
|
Player player = (Player) event.getEntity();
|
||||||
|
|
||||||
|
if (event.getFoodLevel() < player.getFoodLevel()) // Hunger is decreasing for player
|
||||||
|
{
|
||||||
|
event.setCancelled(_foodDecrease.generateRandom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void BucketFill(PlayerBucketFillEvent event)
|
public void BucketFill(PlayerBucketFillEvent event)
|
||||||
{
|
{
|
||||||
@ -211,6 +234,37 @@ public class Gameplay extends MiniPlugin
|
|||||||
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST));
|
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation().add(0.5, 0.5, 0.5), ItemStackFactory.Instance.CreateStack(Material.ENDER_CHEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void disableEnderPearls(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (!isRightClick(event.getAction()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.hasItem() && event.getItem().getType() == Material.ENDER_PEARL)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot use ender pearls!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void disableFlintNSteel(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (!isRightClick(event.getAction()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (event.hasItem() && event.getItem().getType() == Material.FLINT_AND_STEEL)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot use flint & steel!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isRightClick(Action action)
|
||||||
|
{
|
||||||
|
return action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void IronDoor(PlayerInteractEvent event)
|
public void IronDoor(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
@ -417,6 +471,19 @@ public class Gameplay extends MiniPlugin
|
|||||||
event.SetCancelled("Spawn Fall");
|
event.SetCancelled("Spawn Fall");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel the spawning of all Witches.
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void cancelWitchSpawns(EntitySpawnEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntityType() == EntityType.WITCH)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void Repair(PlayerInteractEvent event)
|
public void Repair(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ public class AlligatorsTooth extends LegendaryItem
|
|||||||
if (isInWater(wielder))
|
if (isInWater(wielder))
|
||||||
{
|
{
|
||||||
// Player gain water breathing while under water with legendary equipped
|
// Player gain water breathing while under water with legendary equipped
|
||||||
grantPotionEffect(wielder, PotionEffectType.WATER_BREATHING, 0, 20);
|
grantPotionEffect(wielder, PotionEffectType.WATER_BREATHING, 0, 50);
|
||||||
|
|
||||||
if (isHoldingRightClick())
|
if (isHoldingRightClick())
|
||||||
{
|
{
|
||||||
|
@ -87,7 +87,7 @@ public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
|||||||
|
|
||||||
private void buildTransferGemsCooldown()
|
private void buildTransferGemsCooldown()
|
||||||
{
|
{
|
||||||
StoreGoldButton button = new StoreGoldButton(this);
|
DisplayButton button = new DisplayButton();
|
||||||
String title = ChatColor.RED + C.Bold + "Conversion Cooldown!";
|
String title = ChatColor.RED + C.Bold + "Conversion Cooldown!";
|
||||||
String purchaseString = ChatColor.RESET + C.cWhite + "You have already converted gems into coins today";
|
String purchaseString = ChatColor.RESET + C.cWhite + "You have already converted gems into coins today";
|
||||||
ShopItem shopItem = new ShopItem(Material.REDSTONE_BLOCK, title, new String[] {" ", purchaseString, " "}, 0, true, true);
|
ShopItem shopItem = new ShopItem(Material.REDSTONE_BLOCK, title, new String[] {" ", purchaseString, " "}, 0, true, true);
|
||||||
@ -112,7 +112,7 @@ public class BankPage extends ShopPageBase<ClansManager, BankShop>
|
|||||||
int playerGold = getPlayerGold();
|
int playerGold = getPlayerGold();
|
||||||
int goldCost = TOKEN_VALUE;
|
int goldCost = TOKEN_VALUE;
|
||||||
|
|
||||||
StoreGoldButton button = new StoreGoldButton(this);
|
DisplayButton button = new DisplayButton();
|
||||||
String title = ChatColor.RED + C.Bold + "Missing Gold!";
|
String title = ChatColor.RED + C.Bold + "Missing Gold!";
|
||||||
String playerGoldString = ChatColor.RESET + F.value("Your Gold", playerGold + "g");
|
String playerGoldString = ChatColor.RESET + F.value("Your Gold", playerGold + "g");
|
||||||
String purchaseString = ChatColor.RESET + C.cWhite + "You don't have enough gold";
|
String purchaseString = ChatColor.RESET + C.cWhite + "You don't have enough gold";
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package mineplex.game.clans.shop.bank;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
|
import mineplex.core.shop.item.IButton;
|
||||||
|
import mineplex.game.clans.economy.GoldManager;
|
||||||
|
|
||||||
|
public class DisplayButton implements IButton
|
||||||
|
{
|
||||||
|
|
||||||
|
public DisplayButton()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClick(Player player, ClickType clickType)
|
||||||
|
{
|
||||||
|
// Display button doesn't activate any on click events
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,6 +6,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.ItemFrame;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
@ -14,6 +15,7 @@ import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
|||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntitySpawnEvent;
|
import org.bukkit.event.entity.EntitySpawnEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@ -51,6 +53,22 @@ public class Spawn extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prevent {@link ItemFrame}s from being broken inside Spawn.
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onItemFrameDestroyed(HangingBreakByEntityEvent event)
|
||||||
|
{
|
||||||
|
if (event.getEntity() instanceof ItemFrame)
|
||||||
|
{
|
||||||
|
if (isInSpawn(event.getEntity().getLocation()))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onRespawn(PlayerRespawnEvent event)
|
public void onRespawn(PlayerRespawnEvent event)
|
||||||
{
|
{
|
||||||
@ -78,7 +96,7 @@ public class Spawn extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityTarget(EntityTargetEvent event)
|
public void onEntityTarget(EntityTargetEvent event)
|
||||||
{
|
{
|
||||||
if (isInSpawn(event.getTarget().getLocation()))
|
if (event.getTarget() != null && isInSpawn(event.getTarget().getLocation()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,9 @@ import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
|||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.Global.BowDeficiencySkill;
|
||||||
|
|
||||||
public class Brute extends Skill
|
public class Brute extends BowDeficiencySkill
|
||||||
{
|
{
|
||||||
public Brute(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
public Brute(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||||
{
|
{
|
||||||
@ -43,25 +44,10 @@ public class Brute extends Skill
|
|||||||
event.SetBrute();
|
event.SetBrute();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void BowShoot(EntityShootBowEvent event)
|
|
||||||
{
|
|
||||||
if (getLevel(event.getEntity()) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.75));
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void CancelEnergy(EnergyEvent event)
|
public void CancelEnergy(EnergyEvent event)
|
||||||
{
|
{
|
||||||
if (getLevel(event.GetPlayer()) > 0)
|
if (getLevel(event.GetPlayer()) > 0)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Reset(Player player)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
package mineplex.minecraft.game.classcombat.Skill.Global;
|
||||||
|
|
||||||
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The BowDeficiencySkill provides a reduction in overall arrow velocity and damage to owners.
|
||||||
|
* @author MrTwiggy
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BowDeficiencySkill extends Skill
|
||||||
|
{
|
||||||
|
|
||||||
|
public BowDeficiencySkill(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int maxLevel)
|
||||||
|
{
|
||||||
|
super(skills, name, classType, skillType, cost, maxLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reduce outgoing arrow velocity by bow deficiency owners.
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void BowShoot(EntityShootBowEvent event)
|
||||||
|
{
|
||||||
|
if (getLevel(event.getEntity()) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.75));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reduce damage output of arrows shot by bow deficiency owners.
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onArrowDamage(CustomDamageEvent event)
|
||||||
|
{
|
||||||
|
// Check to see if arrow was shot by owner of this Skill.
|
||||||
|
if (event.GetProjectile() == null || getLevel(event.GetDamagerEntity(true)) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.AddMod("BowDeficiencySkill", -2.0d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Reset(Player player)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -8,8 +8,9 @@ import mineplex.core.energy.event.EnergyEvent;
|
|||||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.Global.BowDeficiencySkill;
|
||||||
|
|
||||||
public class Knight extends Skill
|
public class Knight extends BowDeficiencySkill
|
||||||
{
|
{
|
||||||
public Knight(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
public Knight(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||||
{
|
{
|
||||||
@ -21,25 +22,10 @@ public class Knight extends Skill
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void BowShoot(EntityShootBowEvent event)
|
|
||||||
{
|
|
||||||
if (getLevel(event.getEntity()) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.75));
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void CancelEnergy(EnergyEvent event)
|
public void CancelEnergy(EnergyEvent event)
|
||||||
{
|
{
|
||||||
if (getLevel(event.GetPlayer()) > 0)
|
if (getLevel(event.GetPlayer()) > 0)
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Reset(Player player)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,20 @@
|
|||||||
package mineplex.minecraft.game.classcombat.Skill.Mage;
|
package mineplex.minecraft.game.classcombat.Skill.Mage;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||||
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
|
||||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||||
|
import mineplex.minecraft.game.classcombat.Skill.Global.BowDeficiencySkill;
|
||||||
|
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||||
|
|
||||||
public class Mage extends Skill
|
public class Mage extends BowDeficiencySkill
|
||||||
{
|
{
|
||||||
public Mage(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
public Mage(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||||
{
|
{
|
||||||
@ -20,18 +26,5 @@ public class Mage extends Skill
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void BowShoot(EntityShootBowEvent event)
|
|
||||||
{
|
|
||||||
if (getLevel(event.getEntity()) == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.getProjectile().setVelocity(event.getProjectile().getVelocity().multiply(0.75));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Reset(Player player)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
public class SkillFactory extends MiniPlugin implements ISkillFactory
|
public class SkillFactory extends MiniPlugin implements ISkillFactory
|
||||||
{
|
{
|
||||||
|
|
||||||
private DamageManager _damageManager;
|
private DamageManager _damageManager;
|
||||||
private IRelation _relation;
|
private IRelation _relation;
|
||||||
private CombatManager _combatManager;
|
private CombatManager _combatManager;
|
||||||
@ -582,6 +583,11 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
|
|||||||
System.out.println("Skill Factory: Removed " + remove.GetName() + " from SkillMap.");
|
System.out.println("Skill Factory: Removed " + remove.GetName() + " from SkillMap.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeSkill(String skillName)
|
||||||
|
{
|
||||||
|
RemoveSkill(skillName, null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ISkill> GetGlobalSkillsFor(IPvpClass gameClass)
|
public List<ISkill> GetGlobalSkillsFor(IPvpClass gameClass)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user