Refactored IRelation method names
Added support for negative amounts in Support server. Clans in core testing state.
This commit is contained in:
parent
1fd1e5cc34
commit
abaf9f4693
@ -156,7 +156,7 @@ public class Quit extends AModule
|
||||
boolean clear = false;
|
||||
for (Player other : event.getPlayer().getWorld().getPlayers())
|
||||
if (UtilMath.offset(event.getPlayer(), other) < 32)
|
||||
if (Clans().CanHurt(event.getPlayer(), other))
|
||||
if (Clans().canHurt(event.getPlayer(), other))
|
||||
clear = true;
|
||||
|
||||
if (!clear)
|
||||
@ -200,7 +200,7 @@ public class Quit extends AModule
|
||||
boolean clear = false;
|
||||
for (Player other : player.getWorld().getPlayers())
|
||||
if (UtilMath.offset(player, other) < 32)
|
||||
if (Clans().CanHurt(player, other))
|
||||
if (Clans().canHurt(player, other))
|
||||
clear = true;
|
||||
|
||||
if (!clear)
|
||||
|
@ -2,6 +2,7 @@ package mineplex.game.clans;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
@ -9,6 +10,7 @@ import mineplex.core.cosmetic.CosmeticManager;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.core.friend.FriendManager;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.inventory.InventoryManager;
|
||||
@ -18,6 +20,7 @@ import mineplex.core.memory.MemoryFix;
|
||||
import mineplex.core.message.MessageManager;
|
||||
import mineplex.core.monitor.LagMeter;
|
||||
import mineplex.core.mount.MountManager;
|
||||
import mineplex.core.movement.Movement;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.pet.PetManager;
|
||||
@ -28,14 +31,23 @@ import mineplex.core.punish.Punish;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.serverConfig.ServerConfiguration;
|
||||
import mineplex.core.spawn.Spawn;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.status.ServerStatusManager;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.updater.FileUpdater;
|
||||
import mineplex.core.updater.Updater;
|
||||
import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.fields.Field;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import mineplex.minecraft.game.core.fire.Fire;
|
||||
import net.minecraft.server.v1_7_R4.MinecraftServer;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -47,7 +59,6 @@ public class Clans extends JavaPlugin
|
||||
//Modules
|
||||
private CoreClientManager _clientManager;
|
||||
private DonationManager _donationManager;
|
||||
private DamageManager _damageManager;
|
||||
|
||||
private ServerConfiguration _serverConfiguration;
|
||||
|
||||
@ -78,18 +89,12 @@ public class Clans extends JavaPlugin
|
||||
PreferencesManager preferenceManager = new PreferencesManager(this, _clientManager, _donationManager);
|
||||
new MessageManager(this, _clientManager, preferenceManager);
|
||||
|
||||
Creature creature = new Creature(this);
|
||||
ServerStatusManager serverStatusManager = new ServerStatusManager(this, new LagMeter(this, _clientManager));
|
||||
new Spawn(this, serverStatusManager.getCurrentServerName());
|
||||
Teleport teleport = new Teleport(this);
|
||||
Portal portal = new Portal(this, serverStatusManager.getCurrentServerName());
|
||||
new FileUpdater(this, portal);
|
||||
PacketHandler packetHandler = new PacketHandler(this);
|
||||
|
||||
DisguiseManager disguiseManager = new DisguiseManager(this, packetHandler);
|
||||
|
||||
CombatManager combatManager = new CombatManager(this);
|
||||
_damageManager = new DamageManager(this, combatManager, new NpcManager(this, creature), disguiseManager);
|
||||
|
||||
Punish punish = new Punish(this, webServerAddress, _clientManager);
|
||||
AntiHack.Initialize(this, punish, portal, preferenceManager, _clientManager);
|
||||
@ -97,22 +102,13 @@ public class Clans extends JavaPlugin
|
||||
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
||||
ProjectileManager projectileManager = new ProjectileManager(this);
|
||||
|
||||
//Inventory
|
||||
InventoryManager inventoryManager = new InventoryManager(this, _clientManager);
|
||||
PetManager petManager = new PetManager(this, _clientManager, _donationManager, creature, webServerAddress);
|
||||
MountManager mountManager = new MountManager(this, _clientManager, _donationManager, blockRestore, disguiseManager);
|
||||
GadgetManager gadgetManager = new GadgetManager(this, _clientManager, _donationManager, inventoryManager, mountManager, petManager, preferenceManager, disguiseManager, blockRestore, projectileManager);
|
||||
CosmeticManager cosmeticManager = new CosmeticManager(this, _clientManager, _donationManager, inventoryManager, gadgetManager, mountManager, petManager, null);
|
||||
cosmeticManager.setInterfaceSlot(7);
|
||||
|
||||
new MemoryFix(this);
|
||||
new CustomTagFix(this, packetHandler);
|
||||
|
||||
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, combatManager, blockRestore, teleport, new ConditionManager(this));
|
||||
//Updates
|
||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1);
|
||||
|
||||
|
@ -182,32 +182,6 @@ public class ClanInfo
|
||||
|
||||
return getAllyMap().get(clan);
|
||||
}
|
||||
|
||||
public void chat(Player sender, String message)
|
||||
{
|
||||
for (String cur : getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
UtilPlayer.message(player, C.cAqua + sender.getName() + C.cDAqua + " " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public void allyChat(ClanInfo senderClan, Player sender, String message)
|
||||
{
|
||||
for (String cur : getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
UtilPlayer.message(player, C.cDGreen + sender.getName() + C.cGreen + " " + message);
|
||||
}
|
||||
}
|
||||
|
||||
public LinkedList<String> mDetails(String caller)
|
||||
{
|
||||
|
@ -453,9 +453,9 @@ public class ClansAdmin
|
||||
|
||||
public void trust(Player caller, String[] args)
|
||||
{
|
||||
ClanInfo cA = getMimic(caller, true);
|
||||
ClanInfo callerClan = getMimic(caller, true);
|
||||
|
||||
if (cA == null)
|
||||
if (callerClan == null)
|
||||
return;
|
||||
|
||||
if (args.length < 3)
|
||||
@ -464,31 +464,31 @@ public class ClansAdmin
|
||||
return;
|
||||
}
|
||||
|
||||
ClanInfo cB = Clans.getClanUtility().searchClanPlayer(caller, args[2], true);
|
||||
ClanInfo otherClan = Clans.getClanUtility().searchClanPlayer(caller, args[2], true);
|
||||
|
||||
if (cB == null)
|
||||
if (otherClan == null)
|
||||
return;
|
||||
|
||||
if (!cA.isAlly(cB.getName()))
|
||||
if (!callerClan.isAlly(otherClan.getName()))
|
||||
{
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot give trust to enemies."));
|
||||
return;
|
||||
}
|
||||
|
||||
//Task
|
||||
if (Clans.getClanDataAccess().trust(cA, cB, caller.getName()))
|
||||
if (Clans.getClanDataAccess().trust(callerClan, otherClan, caller.getName()))
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You gave trust to Clan " + cB.getName() + "."));
|
||||
cA.inform(caller.getName() + " has given trust to Clan " + cB.getName() + ".", caller.getName());
|
||||
cB.inform("Clan " + cA.getName() + " has given trust to you.", null);
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You gave trust to Clan " + otherClan.getName() + "."));
|
||||
callerClan.inform(caller.getName() + " has given trust to Clan " + otherClan.getName() + ".", caller.getName());
|
||||
otherClan.inform("Clan " + callerClan.getName() + " has given trust to you.", null);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You revoked trust to Clan " + cB.getName() + "."));
|
||||
cA.inform(caller.getName() + " has revoked trust to Clan " + cB.getName() + ".", caller.getName());
|
||||
cB.inform("Clan " + cA.getName() + " has revoked trust to you.", null);
|
||||
UtilPlayer.message(caller, F.main("Clans Admin", "You revoked trust to Clan " + otherClan.getName() + "."));
|
||||
callerClan.inform(caller.getName() + " has revoked trust to Clan " + otherClan.getName() + ".", caller.getName());
|
||||
otherClan.inform("Clan " + callerClan.getName() + " has revoked trust to you.", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class ClansDataAccessLayer
|
||||
}
|
||||
|
||||
//Save
|
||||
_repository.deleteClan(clan.getName());
|
||||
_repository.deleteClan(clan.getId());
|
||||
|
||||
//Log
|
||||
_manager.log("Deleted [" + clan.getName() + "].");
|
||||
@ -148,29 +148,28 @@ public class ClansDataAccessLayer
|
||||
cB.getAllyMap().put(cA.getName(), false);
|
||||
|
||||
//Save
|
||||
_repository.addClanRelationship(cA.getId(), cB.getId(), true);
|
||||
_repository.addClanRelationship(cB.getId(), cA.getId(), true);
|
||||
_repository.addClanRelationship(cA.getId(), cB.getId(), false);
|
||||
_repository.addClanRelationship(cB.getId(), cA.getId(), false);
|
||||
|
||||
//Log
|
||||
_manager.log("Added Ally for [" + cB.getName() + "] and [" + cA.getName() + "] by [" + player + "].");
|
||||
}
|
||||
|
||||
public boolean trust(ClanInfo cA, ClanInfo cB, String player)
|
||||
public boolean trust(ClanInfo ownerClan, ClanInfo otherClan, String player)
|
||||
{
|
||||
if (!cA.getAllyMap().containsKey(cB.getName()))
|
||||
if (!ownerClan.getAllyMap().containsKey(otherClan.getName()))
|
||||
return false;
|
||||
|
||||
boolean trust = !cA.getAllyMap().get(cB.getName());
|
||||
boolean trust = !ownerClan.getAllyMap().get(otherClan.getName());
|
||||
|
||||
//Memory
|
||||
cA.getAllyMap().put(cB.getName(), trust);
|
||||
ownerClan.getAllyMap().put(otherClan.getName(), trust);
|
||||
|
||||
//Save
|
||||
_repository.updateClanRelationship(cA.getId(), cB.getId(), true);
|
||||
_repository.updateClanRelationship(cB.getId(), cA.getId(), true);
|
||||
_repository.updateClanRelationship(ownerClan.getId(), otherClan.getId(), trust);
|
||||
|
||||
//Log
|
||||
_manager.log("Gave Trust [" + trust + "] to [" + cB.getName() + "] for [" + cA.getName() + "] by [" + player + "].");
|
||||
_manager.log((trust ? "Gave" : "Revoked") + " Trust [" + trust + "] to [" + otherClan.getName() + "] for [" + ownerClan.getName() + "] by [" + player + "].");
|
||||
|
||||
return trust;
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ import mineplex.core.blockrestore.BlockRestoreData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -84,6 +86,22 @@ public class ClansGame extends MiniPlugin
|
||||
event.SetCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void openClanShop(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
{
|
||||
if (event.getClickedBlock().getType() == Material.ENCHANTMENT_TABLE)
|
||||
{
|
||||
Clans.getClanShop().attemptShopOpen(event.getPlayer());
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void BlockBurn(BlockBurnEvent event)
|
||||
{
|
||||
@ -130,12 +148,22 @@ public class ClansGame extends MiniPlugin
|
||||
|
||||
}
|
||||
|
||||
//Block Break
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void BlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (event.getPlayer().getWorld().getEnvironment() != Environment.NORMAL)
|
||||
return;
|
||||
|
||||
String mimic = Clans.Get(event.getPlayer()).getMimic();
|
||||
|
||||
if (mimic.length() != 0)
|
||||
{
|
||||
if (Clans.getClanUtility().searchClanPlayer(event.getPlayer(), mimic, false) != null)
|
||||
mimic = C.cGray + " You are currently mimicing " + C.cGold + mimic;
|
||||
else
|
||||
mimic = "";
|
||||
}
|
||||
|
||||
//Borderlands
|
||||
if (Clans.getClanUtility().isBorderlands(event.getBlock().getLocation()) && event.getPlayer().getGameMode() != GameMode.CREATIVE)
|
||||
{
|
||||
@ -198,7 +226,8 @@ public class ClansGame extends MiniPlugin
|
||||
F.elem(ItemStackFactory.Instance.GetName(event.getBlock(), true)) +
|
||||
" in " +
|
||||
Clans.getClanUtility().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer().getName()) +
|
||||
"."));
|
||||
"." +
|
||||
mimic));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@ -348,7 +377,16 @@ public class ClansGame extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String mimic = Clans.Get(player).getMimic();
|
||||
|
||||
if (mimic.length() != 0)
|
||||
{
|
||||
if (Clans.getClanUtility().searchClanPlayer(player, mimic, false) != null)
|
||||
mimic = C.cGray + " You are currently mimicing " + C.cGold + mimic;
|
||||
else
|
||||
mimic = "";
|
||||
}
|
||||
|
||||
//Deny Interaction
|
||||
if (Clans.getClanBlocks().denyInteract(event.getClickedBlock().getTypeId()))
|
||||
{
|
||||
@ -362,15 +400,16 @@ public class ClansGame extends MiniPlugin
|
||||
|
||||
//Disallow
|
||||
event.setCancelled(true);
|
||||
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Clans", "You cannot use " +
|
||||
F.elem(ItemStackFactory.Instance.GetName(event.getClickedBlock(), true)) +
|
||||
" in " +
|
||||
Clans.getClanUtility().getOwnerStringRel(event.getClickedBlock().getLocation(),
|
||||
player.getName()) +
|
||||
"."));
|
||||
|
||||
"." +
|
||||
mimic));
|
||||
|
||||
return;
|
||||
}
|
||||
//Block is not Trust Allowed
|
||||
@ -385,7 +424,8 @@ public class ClansGame extends MiniPlugin
|
||||
" in " +
|
||||
Clans.getClanUtility().getOwnerStringRel(event.getClickedBlock().getLocation(),
|
||||
player.getName()) +
|
||||
"."));
|
||||
"." +
|
||||
mimic));
|
||||
|
||||
return;
|
||||
}
|
||||
@ -405,7 +445,8 @@ public class ClansGame extends MiniPlugin
|
||||
" in " +
|
||||
Clans.getClanUtility().getOwnerStringRel(event.getClickedBlock().getRelative(event.getBlockFace()).getLocation(),
|
||||
player.getName()) +
|
||||
"."));
|
||||
"." +
|
||||
mimic));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -3,25 +3,30 @@ package mineplex.game.clans.clans;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.creature.event.CreatureSpawnCustomEvent;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.core.movement.Movement;
|
||||
import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.projectile.ProjectileManager;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
import mineplex.core.teleport.Teleport;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
|
||||
import mineplex.game.clans.clans.commands.ClansAllyChatCommand;
|
||||
import mineplex.game.clans.clans.commands.ClansChatCommand;
|
||||
@ -30,12 +35,21 @@ import mineplex.game.clans.clans.repository.ClanTerritory;
|
||||
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.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||
import mineplex.game.clans.fields.Field;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClassManager;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.classcombat.item.ItemFactory;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||
import mineplex.minecraft.game.core.IRelation;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import mineplex.minecraft.game.core.fire.Fire;
|
||||
|
||||
public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelation
|
||||
{
|
||||
private String _serverName;
|
||||
|
||||
@ -50,6 +64,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
private BlockRestore _blockRestore;
|
||||
private Teleport _teleport;
|
||||
private ConditionManager _condition;
|
||||
private ClassCombatShop _classShop;
|
||||
private ClassManager _classManager;
|
||||
|
||||
private int _inviteExpire = 2;
|
||||
private int _nameMin = 3;
|
||||
@ -66,18 +82,17 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
public String[] denyClan = new String[] {
|
||||
"neut", "neutral", "sethome", "promote", "demote", "admin", "help", "create", "disband", "delete", "invite", "join", "kick", "ally", "trust", "claim", "unclaim", "territory", "home"};
|
||||
|
||||
public ClansManager(JavaPlugin plugin, String serverName, CoreClientManager clientManager, CombatManager combatManager, BlockRestore blockRestore, Teleport teleport, ConditionManager condition)
|
||||
public ClansManager(JavaPlugin plugin, String serverName, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, Teleport teleport, String webServerAddress)
|
||||
{
|
||||
super("Clans Manager", plugin);
|
||||
|
||||
_serverName = serverName;
|
||||
_clientManager = clientManager;
|
||||
_combatManager = combatManager;
|
||||
_combatManager = new CombatManager(plugin);
|
||||
|
||||
_blockRestore = blockRestore;
|
||||
_teleport = teleport;
|
||||
_condition = condition;
|
||||
|
||||
|
||||
_clanAdmin = new ClansAdmin(this);
|
||||
_clanBlocks = new ClansBlocks();
|
||||
_clanDataAccess = new ClansDataAccessLayer(this);
|
||||
@ -85,23 +100,38 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
_clanGame = new ClansGame(plugin, this);
|
||||
_clanUtility = new ClansUtility(this);
|
||||
|
||||
Energy energy = new Energy(plugin);
|
||||
PacketHandler packetHandler = new PacketHandler(plugin);
|
||||
new CustomTagFix(plugin, packetHandler);
|
||||
DisguiseManager disguiseManager = new DisguiseManager(plugin, packetHandler);
|
||||
_condition = new SkillConditionManager(plugin);
|
||||
Creature creature = new Creature(plugin);
|
||||
|
||||
new Field(plugin, creature, _condition, energy, serverName);
|
||||
|
||||
DamageManager damageManager = new DamageManager(plugin, _combatManager, new NpcManager(plugin, creature), disguiseManager);
|
||||
|
||||
ProjectileManager throwManager = new ProjectileManager(plugin);
|
||||
Fire fire = new Fire(plugin, _condition, damageManager);
|
||||
ItemFactory itemFactory = new ItemFactory(plugin, blockRestore, _condition, damageManager, energy, fire, throwManager, webServerAddress);
|
||||
SkillFactory skillManager = new SkillFactory(plugin, damageManager, this, _combatManager, _condition, throwManager, disguiseManager, blockRestore, fire, new Movement(plugin), teleport, energy, webServerAddress);
|
||||
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
||||
|
||||
StatsManager statsManager = new StatsManager(plugin, _clientManager);
|
||||
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
|
||||
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
|
||||
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
|
||||
|
||||
for (ClanToken token : _clanDataAccess.getRepository().retrieveClans())
|
||||
{
|
||||
ClanInfo clan = new ClanInfo(this, token);
|
||||
System.out.println("Found clan : " + token.Name);
|
||||
_clanMap.put(token.Name, clan);
|
||||
|
||||
for (ClanMemberToken memberToken : token.Members)
|
||||
{
|
||||
System.out.println("Found member : " + memberToken.Name);
|
||||
_clanMemberMap.put(memberToken.Name, clan);
|
||||
}
|
||||
|
||||
for (ClanTerritoryToken territoryToken : token.Territories)
|
||||
{
|
||||
System.out.println("Found territory : " + territoryToken.Chunk + " owned by " + territoryToken.ClanName);
|
||||
_claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,6 +170,21 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
|
||||
public long lastPower = System.currentTimeMillis();
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void savePlayerActiveBuild(PlayerQuitEvent event)
|
||||
{
|
||||
if (_classManager.Get(event.getPlayer()) != null && _classManager.Get(event.getPlayer()).GetGameClass() != null)
|
||||
{
|
||||
CustomBuildToken activeBuild = _classManager.Get(event.getPlayer()).GetActiveCustomBuild(_classManager.Get(event.getPlayer()).GetGameClass());
|
||||
activeBuild.PlayerName = event.getPlayer().getName();
|
||||
|
||||
// 0 is set aside for active build so we just dupe build to this row whenever we update it.
|
||||
activeBuild.CustomBuildNumber = 0;
|
||||
_classManager.GetRepository().SaveCustomBuild(activeBuild);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void BlockCreatureSpawn(CreatureSpawnCustomEvent event)
|
||||
{
|
||||
@ -158,7 +203,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HandleClanChat(AsyncPlayerChatEvent event)
|
||||
public void handlePlayerChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
@ -168,46 +213,119 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
if (client == null)
|
||||
return;
|
||||
|
||||
if (!client.isClanChat())
|
||||
return;
|
||||
|
||||
ClanInfo clan = _clanUtility.getClanByPlayer(event.getPlayer());
|
||||
if (clan == null)
|
||||
|
||||
if (client.isClanChat())
|
||||
{
|
||||
Get(event.getPlayer()).setClanChat(false);
|
||||
return;
|
||||
}
|
||||
|
||||
clan.chat(event.getPlayer(), event.getMessage());
|
||||
}
|
||||
if (clan == null)
|
||||
{
|
||||
Get(event.getPlayer()).setClanChat(false);
|
||||
return;
|
||||
}
|
||||
|
||||
public boolean HandleAllyChat(AsyncPlayerChatEvent event)
|
||||
{
|
||||
if (!Get(event.getPlayer()).isAllyChat())
|
||||
return false;
|
||||
|
||||
ClanInfo clan = _clanUtility.getClanByPlayer(event.getPlayer());
|
||||
if (clan == null)
|
||||
{
|
||||
Get(event.getPlayer()).setAllyChat(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
ChatAlly(clan, event.getPlayer(), event.getMessage());
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ChatAlly(ClanInfo clan, Player sender, String message)
|
||||
{
|
||||
for (String cur : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(cur);
|
||||
if (ally == null) continue;
|
||||
event.setFormat(C.cAqua + "%1$s " + C.cDAqua + "%2$s");
|
||||
event.getRecipients().clear();
|
||||
|
||||
ally.allyChat(clan, sender, message);
|
||||
for (String cur : clan.getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
event.getRecipients().add(player);
|
||||
}
|
||||
}
|
||||
else if (client.isAllyChat())
|
||||
{
|
||||
if (clan == null)
|
||||
{
|
||||
Get(event.getPlayer()).setAllyChat(false);
|
||||
return;
|
||||
}
|
||||
|
||||
event.setFormat(C.cDGreen + clan.getName() + " " + C.cDGreen + "%1$s " + C.cGreen + "%2$s");
|
||||
event.getRecipients().clear();
|
||||
|
||||
for (String cur : clan.getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
event.getRecipients().add(player);
|
||||
}
|
||||
|
||||
for (String allyName : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||
if (ally == null) continue;
|
||||
|
||||
for (String playerName : ally.getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, playerName, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
event.getRecipients().add(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clan == null)
|
||||
{
|
||||
event.setFormat(C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||
return;
|
||||
}
|
||||
|
||||
event.setFormat(C.cGold + clan.getName() + " " + C.cYellow + "%1$s " + C.cWhite + "%2$s");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void chatClan(ClanInfo clan, Player caller, String message)
|
||||
{
|
||||
for (String cur : clan.getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
UtilPlayer.message(player, C.cAqua + caller.getName() + " " + C.cDAqua + message);
|
||||
}
|
||||
}
|
||||
|
||||
public void chatAlly(ClanInfo clan, Player caller, String message)
|
||||
{
|
||||
for (String cur : clan.getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, cur, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
UtilPlayer.message(player, C.cDGreen + clan.getName() + " " + C.cDGreen + caller.getName() + " " + C.cGreen + message);
|
||||
}
|
||||
|
||||
clan.allyChat(clan, sender, message);
|
||||
for (String allyName : clan.getAllyMap().keySet())
|
||||
{
|
||||
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
|
||||
if (ally == null) continue;
|
||||
|
||||
for (String playerName : ally.getMembers().keySet())
|
||||
{
|
||||
Player player = UtilPlayer.searchOnline(null, playerName, false);
|
||||
|
||||
if (player == null)
|
||||
continue;
|
||||
|
||||
UtilPlayer.message(player, C.cDGreen + clan.getName() + " " + C.cDGreen + caller.getName() + " " + C.cGreen + message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getNameMin()
|
||||
@ -326,4 +444,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
|
||||
{
|
||||
return _condition;
|
||||
}
|
||||
|
||||
public ClassCombatShop getClanShop()
|
||||
{
|
||||
return _classShop;
|
||||
}
|
||||
}
|
||||
|
@ -301,9 +301,14 @@ public class ClansUtility
|
||||
|
||||
public ClanRelation getAccess(Player player, Location loc)
|
||||
{
|
||||
ClanInfo owner = this.getOwner(loc);
|
||||
ClanInfo owner = getOwner(loc);
|
||||
ClanInfo clan = getClanByPlayer(player);
|
||||
|
||||
String mimic = Clans.Get(player).getMimic();
|
||||
|
||||
if (mimic.length() != 0)
|
||||
clan = Clans.getClanUtility().searchClanPlayer(player, mimic, false);
|
||||
|
||||
if (owner == null)
|
||||
return ClanRelation.SELF;
|
||||
|
||||
|
@ -19,7 +19,7 @@ public class ClansAllyChatCommand extends CommandBase<ClansManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Get(caller).setAllyChat(!Plugin.Get(caller).isAllyChat());
|
||||
UtilPlayer.message(caller, F.main("Clans", "Ally Chat: " + F.oo(Plugin.Get(caller).isAllyChat())));
|
||||
@ -31,7 +31,7 @@ public class ClansAllyChatCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
if (clan == null) UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
else Plugin.ChatAlly(clan, caller, F.combine(args, 0, null, false));
|
||||
else Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class ClansChatCommand extends CommandBase<ClansManager>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.Get(caller).setClanChat(!Plugin.Get(caller).isClanChat());
|
||||
UtilPlayer.message(caller, F.main("Clans", "Clan Chat: " + F.oo(Plugin.Get(caller).isClanChat())));
|
||||
@ -33,7 +33,7 @@ public class ClansChatCommand extends CommandBase<ClansManager>
|
||||
if (clan == null)
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
else
|
||||
clan.chat(caller, F.combine(args, 0, null, false));
|
||||
Plugin.chatClan(clan, caller, F.combine(args, 0, null, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
if (clan == null)
|
||||
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
else
|
||||
clan.chat(caller, F.combine(args, 0, null, false));
|
||||
Plugin.chatClan(clan, caller, F.combine(args, 0, null, false));
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
||||
{
|
||||
ClanInfo clan = Plugin.getClanUtility().getClanByPlayer(caller);
|
||||
if (clan == null) UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
|
||||
else Plugin.ChatAlly(clan, caller, F.combine(args, 0, null, false));
|
||||
else Plugin.chatAlly(clan, caller, F.combine(args, 0, null, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,24 +27,24 @@ public class ClanRepository extends RepositoryBase
|
||||
private static String CREATE_CLAN_ALLIANCE_TABLE = "CREATE TABLE IF NOT EXISTS clanAlliances (id INT NOT NULL AUTO_INCREMENT, clanId INT, otherClanId INT, trusted BOOL, PRIMARY KEY (id), FOREIGN KEY (otherClanId) REFERENCES clans(id), FOREIGN KEY (clanId) REFERENCES clans(id), INDEX clanIdIndex (clanId));";
|
||||
|
||||
private static String RETRIEVE_START_CLAN_INFO = "SELECT c.id, c.name, c.description, c.home, c.admin, c.dateCreated, c.lastOnline, ct.chunk, ct.safe FROM clans AS c LEFT JOIN clanTerritory AS ct ON ct.clanId = c.id WHERE c.serverName = ?;";
|
||||
private static String RETRIEVE_CLAN_MEMBER_INFO = "SELECT c.name, a.name, clanRole FROM accountClan AS ac INNER JOIN accounts AS a ON a.id = ac.accountId INNER JOIN clans AS c on c.id = ac.clanId;";
|
||||
private static String RETRIEVE_CLAN_MEMBER_INFO = "SELECT c.name, a.name, clanRole FROM accountClan AS ac INNER JOIN accounts AS a ON a.id = ac.accountId INNER JOIN clans AS c on c.id = ac.clanId WHERE c.serverName = ?;";
|
||||
private static String RETRIEVE_CLAN_ALLIANCE_INFO = "SELECT c.name, cOther.name, ca.trusted FROM clanAlliances AS ca INNER JOIN clans AS c ON c.id = ca.clanId INNER JOIN clans as cOther ON cOther.id = ca.otherClanId WHERE c.serverName = ?;";
|
||||
|
||||
private static String DELETE_CLAN_MEMBER = "DELETE FROM accountClan INNER JOIN accounts ON accounts.id = accountClan.accountId WHERE clans.id = ? AND accounts.name = ?;";
|
||||
private static String DELETE_CLAN_MEMBERS = "DELETE FROM accountClan INNER JOIN clans ON clans.id = accountClan.clanId WHERE clans.name = ?;";
|
||||
private static String DELETE_CLAN_MEMBER = "DELETE aC FROM accountClan AS aC INNER JOIN accounts ON accounts.id = aC.accountId WHERE aC.clanId = ? AND accounts.name = ?;";
|
||||
private static String DELETE_CLAN_MEMBERS = "DELETE FROM accountClan WHERE clanId = ?;";
|
||||
private static String DELETE_CLAN_TERRITORY = "DELETE FROM clanTerritory WHERE clanId = ? AND serverName = ? AND chunk = ?;";
|
||||
private static String DELETE_CLAN_TERRITORIES = "DELETE FROM clanTerritory INNER JOIN clans ON clans.id = clanTerritory.clanId WHERE clans.name = ?;";
|
||||
private static String DELETE_CLAN_TERRITORIES = "DELETE FROM clanTerritory WHERE clanId = ?;";
|
||||
private static String DELETE_CLAN_ALLIANCE = "DELETE FROM clanAlliances WHERE clanId = ? AND otherClanId = ?;";
|
||||
private static String DELETE_CLAN_ALLIANCES = "DELETE FROM clanAlliances INNER JOIN clans ON clans.id = clanAlliances.clanId WHERE clans.name = ?;";
|
||||
private static String DELETE_CLAN = "DELETE FROM clans WHERE name = ?;";
|
||||
private static String DELETE_CLAN_ALLIANCES = "DELETE FROM clanAlliances WHERE clanId = ? OR otherClanId = ?;";
|
||||
private static String DELETE_CLAN = "DELETE FROM clans WHERE id = ?;";
|
||||
|
||||
private static String ADD_CLAN = "INSERT INTO clans (serverName, name, description, home, admin, dateCreated, lastOnline) VALUES (?, ?, ?, ?, ?, now(), now());";
|
||||
private static String ADD_CLAN_MEMBER = "INSERT INTO accountClan (accountId, clanId, clanRole) SELECT accounts.id, ?, ? FROM accounts WHERE accounts.name = ?;";
|
||||
private static String ADD_CLAN_ALLIANCE = "INSERT INTO clanAlliances (clandId, otherClanId, trusted) VALUES (?, ?, ?);";
|
||||
private static String ADD_CLAN_ALLIANCE = "INSERT INTO clanAlliances (clanId, otherClanId, trusted) VALUES (?, ?, ?);";
|
||||
private static String ADD_CLAN_TERRITORY = "INSERT INTO clanTerritory (clanId, serverName, chunk, safe) VALUES (?, ?, ?, ?);";
|
||||
|
||||
private static String UPDATE_CLAN = "UPDATE clans SET name = ?, description = ?, home = ?, admin = ?, lastOnline = ? WHERE id = ?;";
|
||||
private static String UPDATE_CLAN_MEMBER = "UPDATE AC SET clanRole = ? FROM accountClan AS AC INNER JOIN accounts ON accounts.id = accountClan.accountId WHERE clans.id = ? AND accounts.name = ?;";
|
||||
private static String UPDATE_CLAN_MEMBER = "UPDATE accountClan AS AC INNER JOIN accounts ON accounts.id = AC.accountId SET AC.clanRole = ? WHERE AC.clanId = ? AND accounts.name = ?;";
|
||||
private static String UPDATE_CLAN_ALLIANCE = "UPDATE clanAlliances SET trusted = ? WHERE clanId = ? AND otherClanId = ?;";
|
||||
private static String UPDATE_CLAN_TERRITORY = "UPDATE clanTerritory SET safe = ? WHERE serverName = ? AND chunk = ?;";
|
||||
|
||||
@ -100,8 +100,6 @@ public class ClanRepository extends RepositoryBase
|
||||
|
||||
if (territoryToken.Chunk != null)
|
||||
clans.get(token.Name).Territories.add(territoryToken);
|
||||
|
||||
System.out.println("DB clan : "+ token.Name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +125,7 @@ public class ClanRepository extends RepositoryBase
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}, new ColumnVarChar("serverName", 100, _serverName));
|
||||
|
||||
executeQuery(RETRIEVE_CLAN_ALLIANCE_INFO, new ResultSetCallable()
|
||||
{
|
||||
@ -159,12 +157,12 @@ public class ClanRepository extends RepositoryBase
|
||||
{
|
||||
}
|
||||
|
||||
public void deleteClan(String name)
|
||||
public void deleteClan(int clanId)
|
||||
{
|
||||
executeUpdate(DELETE_CLAN_MEMBERS, new ColumnVarChar("name", 100, name));
|
||||
executeUpdate(DELETE_CLAN_TERRITORIES, new ColumnVarChar("name", 100, name));
|
||||
executeUpdate(DELETE_CLAN_ALLIANCES, new ColumnVarChar("name", 100, name));
|
||||
executeUpdate(DELETE_CLAN, new ColumnVarChar("name", 100, name));
|
||||
executeUpdate(DELETE_CLAN_MEMBERS, new ColumnInt("clanid", clanId));
|
||||
executeUpdate(DELETE_CLAN_TERRITORIES, new ColumnInt("clanid", clanId));
|
||||
executeUpdate(DELETE_CLAN_ALLIANCES, new ColumnInt("clanid", clanId), new ColumnInt("clanid", clanId));
|
||||
executeUpdate(DELETE_CLAN, new ColumnInt("clanid", clanId));
|
||||
}
|
||||
|
||||
public void addClan(final ClanInfo clan, final ClanToken token)
|
||||
@ -196,7 +194,7 @@ public class ClanRepository extends RepositoryBase
|
||||
|
||||
public void updateMember(int clanId, String playerName, String role)
|
||||
{
|
||||
executeUpdate(UPDATE_CLAN_MEMBER, new ColumnInt("clanid", clanId), new ColumnVarChar("clanRole", 100, role), new ColumnVarChar("name", 100, playerName));
|
||||
executeUpdate(UPDATE_CLAN_MEMBER, new ColumnVarChar("clanRole", 100, role) , new ColumnInt("clanid", clanId), new ColumnVarChar("name", 100, playerName));
|
||||
}
|
||||
|
||||
public void addClanRelationship(int clanId, int otherClanId, boolean trusted)
|
||||
@ -206,7 +204,7 @@ public class ClanRepository extends RepositoryBase
|
||||
|
||||
public void updateClanRelationship(int clanId, int otherClanId, boolean trusted)
|
||||
{
|
||||
executeUpdate(UPDATE_CLAN_ALLIANCE, new ColumnInt("clanid", clanId), new ColumnInt("otherClanId", otherClanId), new ColumnBoolean("trusted", trusted));
|
||||
executeUpdate(UPDATE_CLAN_ALLIANCE, new ColumnBoolean("trusted", trusted), new ColumnInt("clanid", clanId), new ColumnInt("otherClanId", otherClanId));
|
||||
}
|
||||
|
||||
public void removeClanRelationship(int clanId, int otherClanId)
|
||||
|
@ -7,6 +7,7 @@ import mineplex.core.creature.Creature;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.game.clans.fields.repository.FieldRepository;
|
||||
import mineplex.minecraft.game.core.condition.ConditionFactory;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
|
||||
public class Field extends MiniPlugin
|
||||
{
|
||||
@ -14,7 +15,7 @@ public class Field extends MiniPlugin
|
||||
private FieldOre _ore;
|
||||
private FieldMonster _mob;
|
||||
|
||||
public Field(JavaPlugin plugin, Creature creature, ConditionFactory condition, Energy energy, String serverName)
|
||||
public Field(JavaPlugin plugin, Creature creature, ConditionManager condition, Energy energy, String serverName)
|
||||
{
|
||||
super("Field Factory", plugin);
|
||||
|
||||
|
@ -26,9 +26,12 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.energy.Energy;
|
||||
import mineplex.game.clans.fields.commands.FieldBlockCommand;
|
||||
import mineplex.game.clans.fields.commands.FieldOreCommand;
|
||||
import mineplex.game.clans.fields.repository.FieldBlockToken;
|
||||
import mineplex.game.clans.fields.repository.FieldRepository;
|
||||
import mineplex.minecraft.game.core.condition.ConditionFactory;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
|
||||
public class FieldBlock extends MiniPlugin
|
||||
{
|
||||
@ -49,11 +52,11 @@ public class FieldBlock extends MiniPlugin
|
||||
|
||||
private String _serverName;
|
||||
|
||||
public FieldBlock(JavaPlugin plugin, ConditionFactory conditionFactory, Energy energy, FieldRepository repository, String serverName)
|
||||
public FieldBlock(JavaPlugin plugin, ConditionManager condition, Energy energy, FieldRepository repository, String serverName)
|
||||
{
|
||||
super("Field Block", plugin);
|
||||
|
||||
_conditionFactory = conditionFactory;
|
||||
_conditionFactory = condition.Factory();
|
||||
_energy = energy;
|
||||
_repository = repository;
|
||||
_blocks = new HashMap<String, FieldBlockData>();
|
||||
@ -63,6 +66,12 @@ public class FieldBlock extends MiniPlugin
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
addCommand(new FieldBlockCommand(this));
|
||||
}
|
||||
|
||||
public void showSettings(Player caller)
|
||||
{
|
||||
populateSettings(caller);
|
||||
|
@ -17,6 +17,8 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.game.clans.fields.commands.FieldMonsterCommand;
|
||||
import mineplex.game.clans.fields.commands.FieldOreCommand;
|
||||
import mineplex.game.clans.fields.monsters.FieldMonsterBase;
|
||||
import mineplex.game.clans.fields.repository.FieldMonsterToken;
|
||||
import mineplex.game.clans.fields.repository.FieldRepository;
|
||||
@ -41,6 +43,12 @@ public class FieldMonster extends MiniPlugin
|
||||
|
||||
Load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
addCommand(new FieldMonsterCommand(this));
|
||||
}
|
||||
|
||||
public void Help(Player caller)
|
||||
{
|
||||
@ -140,11 +148,14 @@ public class FieldMonster extends MiniPlugin
|
||||
|
||||
for (FieldMonsterToken token : _repository.getFieldMonsters(_serverName))
|
||||
{
|
||||
System.out.println("Found FM token : " + token.Type + " " + token.Centre);
|
||||
EntityType type = UtilEnt.searchEntity(null, token.Type, false);
|
||||
if (type == null) continue;
|
||||
if (type == null)
|
||||
continue;
|
||||
|
||||
Location loc = UtilWorld.strToLoc(token.Centre);
|
||||
if (loc == null) continue;
|
||||
if (loc == null)
|
||||
continue;
|
||||
|
||||
FieldMonsterBase pit = new FieldMonsterBase(this, token.Name, _serverName, type, token.MobMax, token.MobRate, loc, token.Radius, token.Height);
|
||||
Add(pit, false);
|
||||
|
@ -26,6 +26,7 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.game.clans.fields.commands.FieldOreCommand;
|
||||
import mineplex.game.clans.fields.repository.FieldOreToken;
|
||||
import mineplex.game.clans.fields.repository.FieldRepository;
|
||||
|
||||
@ -54,6 +55,12 @@ public class FieldOre extends MiniPlugin
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void AddCommands()
|
||||
{
|
||||
addCommand(new FieldOreCommand(this));
|
||||
}
|
||||
|
||||
public void help(Player caller)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(_moduleName, "Commands List;"));
|
||||
|
@ -19,41 +19,35 @@ public class FieldBlockCommand extends CommandBase<FieldBlock>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("toggle"))
|
||||
if (args == null || args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
Plugin.help(caller);
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("toggle"))
|
||||
{
|
||||
if (!Plugin.getActive().remove(caller.getName()))
|
||||
Plugin.getActive().add(caller.getName());
|
||||
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Interact Active: " + F.tf(Plugin.getActive().contains(caller.getName()))));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("load"))
|
||||
{
|
||||
Plugin.load();
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Reloaded Field Blocks from Database."));
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("wipe"))
|
||||
{
|
||||
Plugin.wipe(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("help"))
|
||||
{
|
||||
Plugin.help(caller);
|
||||
}
|
||||
|
||||
else if (args.length <= 1)
|
||||
{
|
||||
Plugin.help(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("title"))
|
||||
{
|
||||
Plugin.getTitle().put(caller, args[1]);
|
||||
Plugin.showSettings(caller);
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("stock"))
|
||||
{
|
||||
try
|
||||
@ -68,7 +62,6 @@ public class FieldBlockCommand extends CommandBase<FieldBlock>
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Stock Max."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("regen"))
|
||||
{
|
||||
try
|
||||
@ -83,7 +76,6 @@ public class FieldBlockCommand extends CommandBase<FieldBlock>
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Stock Regeneration Time."));
|
||||
}
|
||||
}
|
||||
|
||||
else if (args[0].equalsIgnoreCase("empty"))
|
||||
{
|
||||
try
|
||||
@ -102,8 +94,6 @@ public class FieldBlockCommand extends CommandBase<FieldBlock>
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Invalid Empty Block."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (args[0].equalsIgnoreCase("loot"))
|
||||
{
|
||||
boolean error = false;
|
||||
|
@ -26,7 +26,7 @@ public class FieldMonsterCommand extends CommandBase<FieldMonster>
|
||||
|
||||
FieldMonsterInput input = Plugin.getInput().get(caller);
|
||||
|
||||
if (args.length == 0)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.getInput().get(caller).Display(caller);
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "Type " + F.elem("/fm help") + " for commands."));
|
||||
|
@ -18,7 +18,7 @@ public class FieldOreCommand extends CommandBase<FieldOre>
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args.length == 0)
|
||||
if (args == null || args.length == 0)
|
||||
{
|
||||
Plugin.help(caller);
|
||||
return;
|
||||
|
@ -19,15 +19,15 @@ public class FieldRepository extends RepositoryBase
|
||||
private static String CREATE_FIELD_BLOCK_TABLE = "CREATE TABLE IF NOT EXISTS fieldBlock (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), location VARCHAR(100), blockId INT, blockData TINYINT, emptyId INT, emptyData TINYINT, stockMax INT, stockRegenTime DOUBLE, loot VARCHAR(100), PRIMARY KEY (id), INDEX serverLocation (server, location));";
|
||||
private static String CREATE_FIELD_ORE_TABLE = "CREATE TABLE IF NOT EXISTS fieldOre (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), location VARCHAR(100), PRIMARY KEY (id), INDEX serverLocation (server, location));";
|
||||
private static String CREATE_FIELD_MONSTER_TABLE = "CREATE TABLE IF NOT EXISTS fieldMonster (id INT NOT NULL AUTO_INCREMENT, server VARCHAR(100), name VARCHAR(100), type VARCHAR(100), mobMax INT, mobRate DOUBLE, center VARCHAR(100), radius INT, height INT, PRIMARY KEY (id), INDEX serverName (server, name));";
|
||||
private static String RETRIEVE_FIELD_BLOCKS = "SELECT server, location, blockId, blockData, emptyId, emptyData, stockMax, stockRegen, loot FROM fieldBlock WHERE server = ?;";
|
||||
private static String ADD_FIELD_BLOCK = "INSERT INTO fieldBlock (server, location, blockId, blockData, emptyId, emptyData, stockMax, stockRegen, loot) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
|
||||
private static String RETRIEVE_FIELD_BLOCKS = "SELECT server, location, blockId, blockData, emptyId, emptyData, stockMax, stockRegenTime, loot FROM fieldBlock WHERE server = ?;";
|
||||
private static String ADD_FIELD_BLOCK = "INSERT INTO fieldBlock (server, location, blockId, blockData, emptyId, emptyData, stockMax, stockRegenTime, loot) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
|
||||
private static String DEL_FIELD_BLOCK = "DELETE FROM fieldBlock WHERE server = ? AND location = ?;";
|
||||
private static String RETRIEVE_FIELD_ORES = "SELECT server, location FROM fieldOre WHERE server = ?;";
|
||||
private static String ADD_FIELD_ORE = "INSERT INTO fieldBlock (server, location) VALUES (?, ?);";
|
||||
private static String ADD_FIELD_ORE = "INSERT INTO fieldOre (server, location) VALUES (?, ?);";
|
||||
private static String DEL_FIELD_ORE = "DELETE FROM fieldOre WHERE server = ? AND location = ?;";
|
||||
private static String RETRIEVE_FIELD_MONSTERS = "SELECT server, name, type, mobMax, mobRate, center, radius, height FROM fieldMonster WHERE server = ?;";
|
||||
private static String ADD_FIELD_MONSTER = "INSERT INTO fieldBlock (server, name, type, mobMax, mobRate, center, radius, height) VALUES (?, ?, ?, ?, ?, ?, ?, ?);";
|
||||
private static String DEL_FIELD_MONSTER = "DELETE FROM fieldBlock WHERE server = ? AND name = ?;";
|
||||
private static String ADD_FIELD_MONSTER = "INSERT INTO fieldMonster (server, name, type, mobMax, mobRate, center, radius, height) VALUES (?, ?, ?, ?, ?, ?, ?, ?);";
|
||||
private static String DEL_FIELD_MONSTER = "DELETE FROM fieldMonster WHERE server = ? AND name = ?;";
|
||||
|
||||
public FieldRepository(JavaPlugin plugin)
|
||||
{
|
||||
@ -38,7 +38,7 @@ public class FieldRepository extends RepositoryBase
|
||||
{
|
||||
final List<FieldBlockToken> fieldBlocks = new ArrayList<FieldBlockToken>();
|
||||
|
||||
this.executeQuery(RETRIEVE_FIELD_BLOCKS, new ResultSetCallable()
|
||||
executeQuery(RETRIEVE_FIELD_BLOCKS, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
@ -122,9 +122,9 @@ public class FieldRepository extends RepositoryBase
|
||||
|
||||
public List<FieldMonsterToken> getFieldMonsters(String server)
|
||||
{
|
||||
List<FieldMonsterToken> fieldMonsters = new ArrayList<FieldMonsterToken>();
|
||||
final List<FieldMonsterToken> fieldMonsters = new ArrayList<FieldMonsterToken>();
|
||||
|
||||
this.executeQuery(RETRIEVE_FIELD_MONSTERS, new ResultSetCallable()
|
||||
executeQuery(RETRIEVE_FIELD_MONSTERS, new ResultSetCallable()
|
||||
{
|
||||
@Override
|
||||
public void processResultSet(ResultSet resultSet) throws SQLException
|
||||
@ -140,9 +140,11 @@ public class FieldRepository extends RepositoryBase
|
||||
token.Centre = resultSet.getString(6);
|
||||
token.Radius = resultSet.getInt(7);
|
||||
token.Height = resultSet.getInt(8);
|
||||
|
||||
fieldMonsters.add(token);
|
||||
}
|
||||
}
|
||||
}, new ColumnVarChar("server", 100, server));
|
||||
}, new ColumnVarChar("serverName", 100, server));
|
||||
|
||||
return fieldMonsters;
|
||||
}
|
||||
|
@ -130,11 +130,11 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
|
||||
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory, achievementManager, clientManager);
|
||||
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, "Brute", classManager.GetClass("Brute"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, "Mage", classManager.GetClass("Mage"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, "Ranger", classManager.GetClass("Ranger"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, "Knight", classManager.GetClass("Knight"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, "Assassin", classManager.GetClass("Assassin"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Brute", classManager.GetClass("Brute"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Mage", classManager.GetClass("Mage"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Ranger", classManager.GetClass("Ranger"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Knight", classManager.GetClass("Knight"));
|
||||
new ClassCombatShop(shopManager, clientManager, donationManager, false, "Assassin", classManager.GetClass("Assassin"));
|
||||
|
||||
new FriendManager(this, clientManager, preferenceManager);
|
||||
|
||||
@ -149,19 +149,19 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanHurt(Player a, Player b)
|
||||
public boolean canHurt(Player a, Player b)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanHurt(String a, String b)
|
||||
public boolean canHurt(String a, String b)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean IsSafe(Player a)
|
||||
public boolean isSafe(Player a)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="Arcade,Hub,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="Arcade,Hub,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="Hub,Arcade,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AFTER_CLEAN_TARGETS" value="Arcade,Hub,Clans,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_AUTO_TARGETS" value="Arcade,Hub,Clans,"/>
|
||||
<stringAttribute key="org.eclipse.ant.ui.ATTR_ANT_MANUAL_TARGETS" value="Hub,Arcade,Clans,"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
||||
<stringAttribute key="org.eclipse.debug.core.ATTR_REFRESH_SCOPE" value="${project}"/>
|
||||
|
@ -271,7 +271,9 @@ public class ClassManager extends MiniClientPlugin<ClientClass> implements IClas
|
||||
return;
|
||||
|
||||
for (IPvpClass cur : _classes.values())
|
||||
{
|
||||
cur.checkEquip();
|
||||
}
|
||||
}
|
||||
|
||||
public SkillFactory GetSkillFactory()
|
||||
|
@ -76,9 +76,6 @@ public class ClientClass
|
||||
|
||||
for (CustomBuildToken buildToken : token.CustomBuilds)
|
||||
{
|
||||
if (buildToken.CustomBuildNumber == 0)
|
||||
continue;
|
||||
|
||||
IPvpClass pvpClass = _classFactory.GetClass(buildToken.PvpClass);
|
||||
|
||||
ISkill swordSkill = _skillFactory.GetSkill(buildToken.SwordSkill);
|
||||
@ -188,7 +185,14 @@ public class ClientClass
|
||||
}
|
||||
*/
|
||||
|
||||
_customBuilds.get(pvpClass).put(buildToken.CustomBuildNumber, buildToken);
|
||||
if (buildToken.CustomBuildNumber == 0)
|
||||
{
|
||||
_activeCustomBuilds.put(pvpClass, buildToken);
|
||||
}
|
||||
else
|
||||
{
|
||||
_customBuilds.get(pvpClass).put(buildToken.CustomBuildNumber, buildToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,6 +269,11 @@ public class ClientClass
|
||||
}
|
||||
|
||||
public void EquipCustomBuild(CustomBuildToken customBuild, boolean notify)
|
||||
{
|
||||
EquipCustomBuild(customBuild, true, false);
|
||||
}
|
||||
|
||||
public void EquipCustomBuild(CustomBuildToken customBuild, boolean notify, boolean skillsOnly)
|
||||
{
|
||||
_lastClass = _classFactory.GetClass(customBuild.PvpClass);
|
||||
|
||||
@ -326,7 +335,7 @@ public class ClientClass
|
||||
_lastItems.put(i, itemStack);
|
||||
}
|
||||
|
||||
ResetToDefaults(true, true);
|
||||
ResetToDefaults(!skillsOnly, !skillsOnly);
|
||||
|
||||
if (notify)
|
||||
{
|
||||
|
@ -2,7 +2,9 @@ package mineplex.minecraft.game.classcombat.Class;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||
import mineplex.minecraft.game.classcombat.Skill.ISkill;
|
||||
@ -199,18 +201,19 @@ public class PvpClass implements IPvpClass
|
||||
}
|
||||
|
||||
public void Equip(Player player)
|
||||
{
|
||||
{
|
||||
ClientClass client = _classes.Get(player);
|
||||
|
||||
CustomBuildToken customBuild = client.GetActiveCustomBuild(this);
|
||||
|
||||
if (customBuild != null)
|
||||
{
|
||||
client.EquipCustomBuild(customBuild);
|
||||
client.EquipCustomBuild(customBuild, true, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.SetGameClass(this);
|
||||
client.EquipCustomBuild(client.GetCustomBuilds(this).get(0), true, true);
|
||||
}
|
||||
|
||||
//Ensure Sneak Removed
|
||||
@ -221,7 +224,7 @@ public class PvpClass implements IPvpClass
|
||||
{
|
||||
_classes.Get(player).SetGameClass(null);
|
||||
|
||||
// UtilPlayer.message(player, F.main("Class", "Armor Class: " + F.oo("None", false)));
|
||||
UtilPlayer.message(player, F.main("Class", "Armor Class: " + F.oo("None", false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,7 +152,7 @@ public class Stealth extends Skill
|
||||
if (UtilMath.offset(cur, other) > 8 - 2*level)
|
||||
continue;
|
||||
|
||||
if (!Factory.Relation().CanHurt(cur, other))
|
||||
if (!Factory.Relation().canHurt(cur, other))
|
||||
continue;
|
||||
|
||||
Remove(cur, other);
|
||||
|
@ -53,7 +53,7 @@ public class Bloodlust extends Skill
|
||||
if (Expire(cur))
|
||||
continue;
|
||||
|
||||
if (!Factory.Relation().CanHurt(cur, (Player)event.GetEvent().getEntity()))
|
||||
if (!Factory.Relation().canHurt(cur, (Player)event.GetEvent().getEntity()))
|
||||
continue;
|
||||
|
||||
if (cur.equals(event.GetEvent().getEntity()))
|
||||
|
@ -39,7 +39,7 @@ public class Intimidation extends Skill
|
||||
HashMap<Player, Double> targets = UtilPlayer.getInRadius(cur.getLocation(), 3 + (level * 3));
|
||||
for (Player other : targets.keySet())
|
||||
if (!other.equals(cur))
|
||||
if (Factory.Relation().CanHurt(cur, other))
|
||||
if (Factory.Relation().canHurt(cur, other))
|
||||
if (getLevel(other) < level)
|
||||
{
|
||||
double dist = targets.get(other);
|
||||
|
@ -118,7 +118,7 @@ public class Takedown extends SkillActive
|
||||
for (Player other : player.getWorld().getPlayers())
|
||||
if (other.getGameMode() == GameMode.SURVIVAL)
|
||||
if (!other.equals(player))
|
||||
if (Factory.Relation().CanHurt(player, other))
|
||||
if (Factory.Relation().canHurt(player, other))
|
||||
if (UtilMath.offset(player, other) < 2)
|
||||
{
|
||||
DoTakeDown(player, other);
|
||||
|
@ -105,7 +105,7 @@ public class Taunt extends SkillActive
|
||||
for (Player other : player.getWorld().getPlayers())
|
||||
if (other.getGameMode() == GameMode.SURVIVAL)
|
||||
if (!other.equals(player))
|
||||
if (Factory.Relation().CanHurt(player, other))
|
||||
if (Factory.Relation().canHurt(player, other))
|
||||
if (UtilMath.offset(player, other) < 7 && UtilMath.offset(player, other) > 2)
|
||||
{
|
||||
UtilAction.velocity(other, UtilAlg.getTrajectory(other, player), 0.4, false, 0, 0, 0.4, false);
|
||||
|
@ -62,7 +62,7 @@ public class Cleave extends Skill
|
||||
for (Player other : UtilPlayer.getNearby(damagee.getLocation(), 1.5 + (0.5 * level)))
|
||||
{
|
||||
if (!other.equals(damagee) && !other.equals(damager))
|
||||
if (Factory.Relation().CanHurt(damager, other))
|
||||
if (Factory.Relation().canHurt(damager, other))
|
||||
{
|
||||
//Damage Event
|
||||
Factory.Damage().NewDamageEvent(other, damager, null,
|
||||
|
@ -68,7 +68,7 @@ public class LevelField extends Skill
|
||||
if (cur.equals(damagee))
|
||||
alt += 1;
|
||||
|
||||
else if (Factory.Relation().CanHurt(damagee, cur))
|
||||
else if (Factory.Relation().canHurt(damagee, cur))
|
||||
alt -= 1;
|
||||
|
||||
else
|
||||
@ -114,7 +114,7 @@ public class LevelField extends Skill
|
||||
if (cur.equals(damager))
|
||||
alt -= 1;
|
||||
|
||||
else if (Factory.Relation().CanHurt(damager, cur))
|
||||
else if (Factory.Relation().canHurt(damager, cur))
|
||||
alt += 1;
|
||||
|
||||
else
|
||||
|
@ -174,7 +174,7 @@ public class ArcticArmor extends Skill
|
||||
{
|
||||
//Protection
|
||||
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 3 + getLevel(cur)))
|
||||
if (!Factory.Relation().CanHurt(cur, other) || other.equals(cur))
|
||||
if (!Factory.Relation().canHurt(cur, other) || other.equals(cur))
|
||||
Factory.Condition().Factory().Protection(GetName(), other, cur, 1.9, 1, false, true, true);
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public class GlacialBlade extends SkillActive implements IThrown
|
||||
for (Player cur : UtilPlayer.getNearby(player.getLocation(), 4))
|
||||
if (cur.equals(player))
|
||||
continue;
|
||||
else if (Factory.Relation().CanHurt(cur, player))
|
||||
else if (Factory.Relation().canHurt(cur, player))
|
||||
return false;
|
||||
|
||||
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
|
||||
|
@ -158,7 +158,7 @@ public class LifeBonds extends Skill
|
||||
|
||||
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 8))
|
||||
{
|
||||
if (Factory.Relation().CanHurt(cur, other) && !other.equals(cur))
|
||||
if (Factory.Relation().canHurt(cur, other) && !other.equals(cur))
|
||||
continue;
|
||||
|
||||
//Plants
|
||||
@ -203,7 +203,7 @@ public class LifeBonds extends Skill
|
||||
|
||||
for (Player other : UtilPlayer.getNearby(cur.getLocation(), 6 + (2 * level)))
|
||||
{
|
||||
if (Factory.Relation().CanHurt(cur, other) && !other.equals(cur))
|
||||
if (Factory.Relation().canHurt(cur, other) && !other.equals(cur))
|
||||
continue;
|
||||
|
||||
if (highest == null || other.getHealth() > highestHp)
|
||||
|
@ -111,7 +111,7 @@ public class Magnetize extends SkillActive
|
||||
if (player.equals(other))
|
||||
continue;
|
||||
|
||||
if (!Factory.Relation().CanHurt(player, other))
|
||||
if (!Factory.Relation().canHurt(player, other))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(player, other) < 2)
|
||||
|
@ -124,7 +124,7 @@ public class Rupture extends SkillActiveCharge
|
||||
for (Player other : cur.getWorld().getPlayers())
|
||||
if (!other.equals(cur))
|
||||
if (UtilMath.offset(loc, other.getLocation()) < 2)
|
||||
if (Factory.Relation().CanHurt(cur, other))
|
||||
if (Factory.Relation().canHurt(cur, other))
|
||||
Factory.Condition().Factory().Slow(GetName(), other, cur, 1.9, 1, false, true, false, true);
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ public class WolfsPounce extends SkillChargeSword
|
||||
if (other.equals(player))
|
||||
continue;
|
||||
|
||||
if (!Factory.Relation().CanHurt(player, other))
|
||||
if (!Factory.Relation().canHurt(player, other))
|
||||
continue;
|
||||
|
||||
if (UtilMath.offset(player, other) > 2)
|
||||
|
@ -1,7 +1,8 @@
|
||||
package mineplex.minecraft.game.classcombat.shop;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
@ -12,11 +13,13 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.PvpClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildToken;
|
||||
import mineplex.minecraft.game.classcombat.shop.page.ArmorPage;
|
||||
import mineplex.minecraft.game.classcombat.shop.page.CustomBuildPage;
|
||||
|
||||
public class ClassCombatShop extends ShopBase<ClassShopManager>
|
||||
@ -25,17 +28,21 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
|
||||
private NautHashMap<String, ItemStack[]> _playerArmorMap = new NautHashMap<String, ItemStack[]>();
|
||||
private IPvpClass _gameClass;
|
||||
private boolean _takeAwayStuff;
|
||||
private boolean _skillsOnly;
|
||||
|
||||
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name)
|
||||
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, name, CurrencyType.Gems);
|
||||
|
||||
_skillsOnly = skillsOnly;
|
||||
}
|
||||
|
||||
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, String name, IPvpClass iPvpClass)
|
||||
public ClassCombatShop(ClassShopManager plugin, CoreClientManager clientManager, DonationManager donationManager, boolean skillsOnly, String name, IPvpClass iPvpClass)
|
||||
{
|
||||
super(plugin, clientManager, donationManager, name, CurrencyType.Gems);
|
||||
_gameClass = iPvpClass;
|
||||
_takeAwayStuff = true;
|
||||
_skillsOnly = skillsOnly;
|
||||
}
|
||||
|
||||
protected void OpenShopForPlayer(Player player)
|
||||
@ -57,18 +64,27 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
|
||||
if (!CanOpenShop(player))
|
||||
return false;
|
||||
|
||||
ShopPageBase<ClassShopManager, ClassCombatShop> page = null;
|
||||
|
||||
if (Plugin.GetClassManager().Get(player).GetGameClass() == null)
|
||||
{
|
||||
// page = new ArmorPage(Plugin, this, ClientManager, DonationManager, player);
|
||||
UtilPlayer.message(player, F.main(Plugin.getName(), ChatColor.RED + "You need to have an armor set on to modify class builds."));
|
||||
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, .6f);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
page = new CustomBuildPage(Plugin, this, ClientManager, DonationManager, player);
|
||||
|
||||
OpenedShop.add(player.getName());
|
||||
|
||||
OpenShopForPlayer(player);
|
||||
|
||||
CustomBuildPage buildPage = new CustomBuildPage(Plugin, this, ClientManager, DonationManager, player);
|
||||
|
||||
|
||||
if (!PlayerPageMap.containsKey(player.getName()))
|
||||
{
|
||||
PlayerPageMap.put(player.getName(), buildPage);
|
||||
PlayerPageMap.put(player.getName(), page);
|
||||
}
|
||||
|
||||
OpenPageForPlayer(player, buildPage);
|
||||
OpenPageForPlayer(player, page);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -86,7 +102,7 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
|
||||
CustomBuildToken customBuild = clientClass.GetSavingCustomBuild();
|
||||
clientClass.SaveActiveCustomBuild();
|
||||
clientClass.SetActiveCustomBuild(clientClass.GetGameClass(), customBuild);
|
||||
clientClass.EquipCustomBuild(customBuild, false);
|
||||
clientClass.EquipCustomBuild(customBuild, false, _skillsOnly);
|
||||
}
|
||||
|
||||
if (_takeAwayStuff)
|
||||
@ -112,4 +128,9 @@ public class ClassCombatShop extends ShopBase<ClassShopManager>
|
||||
_playerInventoryMap.remove(event.getPlayer().getName());
|
||||
_playerArmorMap.remove(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
public boolean skillOnly()
|
||||
{
|
||||
return _skillsOnly;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
package mineplex.minecraft.game.classcombat.shop.button;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
||||
import mineplex.minecraft.game.classcombat.shop.page.ArmorPage;
|
||||
|
||||
public class SelectClassButton implements IButton
|
||||
{
|
||||
ArmorPage _page;
|
||||
private IPvpClass _pvpClass;
|
||||
|
||||
public SelectClassButton(ArmorPage page, IPvpClass pvpClass)
|
||||
{
|
||||
_page = page;
|
||||
_pvpClass = pvpClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedLeft(Player player)
|
||||
{
|
||||
_page.SelectClass(player, _pvpClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ClickedRight(Player player)
|
||||
{
|
||||
_page.SelectClass(player, _pvpClass);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package mineplex.minecraft.game.classcombat.shop.page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.ClientClass;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassCombatShop;
|
||||
import mineplex.minecraft.game.classcombat.shop.ClassShopManager;
|
||||
import mineplex.minecraft.game.classcombat.shop.button.SelectClassButton;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import mineplex.core.common.util.C;
|
||||
|
||||
public class ArmorPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
{
|
||||
public ArmorPage(ClassShopManager shopManager, ClassCombatShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||
{
|
||||
super(shopManager, shop, clientManager, donationManager, " Armor", player);
|
||||
|
||||
BuildPage();
|
||||
}
|
||||
|
||||
public void SelectClass(Player player, IPvpClass pvpClass)
|
||||
{
|
||||
ClientClass clientClass = Plugin.GetClassManager().Get(player);
|
||||
|
||||
player.getInventory().clear();
|
||||
|
||||
clientClass.SetGameClass(pvpClass);
|
||||
clientClass.ClearDefaults();
|
||||
|
||||
Shop.OpenPageForPlayer(Player, new CustomBuildPage(Plugin, Shop, ClientManager, DonationManager, player));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void BuildPage()
|
||||
{
|
||||
int slot = 9;
|
||||
|
||||
for (IPvpClass gameClass : Plugin.GetClassManager().GetGameClasses())
|
||||
{
|
||||
BuildArmorSelectPackage(gameClass, slot);
|
||||
|
||||
slot += 2;
|
||||
}
|
||||
}
|
||||
|
||||
private void BuildArmorSelectPackage(IPvpClass gameClass, int slot)
|
||||
{
|
||||
List<String> lockedClassDesc = new ArrayList<String>();
|
||||
List<String> unlockedClassDesc = new ArrayList<String>();
|
||||
|
||||
lockedClassDesc.add(C.cBlack);
|
||||
unlockedClassDesc.add(C.cBlack);
|
||||
|
||||
lockedClassDesc.addAll(Arrays.asList(gameClass.GetDesc()));
|
||||
unlockedClassDesc.addAll(Arrays.asList(gameClass.GetDesc()));
|
||||
|
||||
for (int i = 1; i < lockedClassDesc.size(); i++)
|
||||
{
|
||||
lockedClassDesc.set(i, C.cGray + lockedClassDesc.get(i));
|
||||
}
|
||||
|
||||
for (int i = 1; i < unlockedClassDesc.size(); i++)
|
||||
{
|
||||
unlockedClassDesc.set(i, C.cGray + unlockedClassDesc.get(i));
|
||||
}
|
||||
|
||||
AddButton(slot, new ShopItem(gameClass.GetHead(), gameClass.GetName(), 1, false), new SelectClassButton(this, gameClass));
|
||||
AddButton(slot + 9, new ShopItem(gameClass.GetChestplate(), gameClass.GetName(), 1, false), new SelectClassButton(this, gameClass));
|
||||
AddButton(slot + 18, new ShopItem(gameClass.GetLeggings(), gameClass.GetName(), 1, false), new SelectClassButton(this, gameClass));
|
||||
AddButton(slot + 27, new ShopItem(gameClass.GetBoots(), gameClass.GetName(), 1, false), new SelectClassButton(this, gameClass));
|
||||
}
|
||||
}
|
@ -161,7 +161,7 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
clientClass.EquipCustomBuild(customBuild, false);
|
||||
clientClass.EquipCustomBuild(customBuild, false, Shop.skillOnly());
|
||||
clientClass.SetSavingCustomBuild(_pvpClass, customBuild);
|
||||
|
||||
Shop.OpenPageForPlayer(Player, new SkillPage(Plugin, Shop, ClientManager, DonationManager, Player, _pvpClass));
|
||||
@ -178,10 +178,9 @@ public class CustomBuildPage extends ShopPageBase<ClassShopManager, ClassCombatS
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
clientClass.EquipCustomBuild(customBuild);
|
||||
clientClass.EquipCustomBuild(customBuild, true, Shop.skillOnly());
|
||||
|
||||
Player.closeInventory();
|
||||
System.out.println(this.getClass().getName() + " 152");
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -70,7 +70,9 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
|
||||
BuildClassSkills(_pvpClass, clientClass);
|
||||
BuildGlobalSkills(clientClass);
|
||||
BuildItems(_pvpClass, clientClass);
|
||||
|
||||
if (!Shop.skillOnly())
|
||||
BuildItems(_pvpClass, clientClass);
|
||||
}
|
||||
|
||||
private void BuildItems(IPvpClass gameClass, ClientClass clientClass)
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
public interface IRelation
|
||||
{
|
||||
public boolean CanHurt(Player a, Player b);
|
||||
public boolean CanHurt(String a, String b);
|
||||
public boolean IsSafe(Player a);
|
||||
public boolean canHurt(Player a, Player b);
|
||||
public boolean canHurt(String a, String b);
|
||||
public boolean isSafe(Player a);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ public class TreasureChestCommand extends CommandBase<SalesPackageManager>
|
||||
if (uuid == null)
|
||||
UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
if (amountSpecified != 10)
|
||||
if (Math.abs(amountSpecified) != 10)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You have specified an invalid amount of chests."));
|
||||
amountSpecified = 0;
|
||||
@ -51,10 +51,10 @@ public class TreasureChestCommand extends CommandBase<SalesPackageManager>
|
||||
public void run(Boolean success)
|
||||
{
|
||||
if (success)
|
||||
F.main(Plugin.getName(), playerName + " received " + amount + " Treasure Chests" + ".");
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), playerName + " received " + amount + " Treasure Chests" + "."));
|
||||
else
|
||||
{
|
||||
F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " Treasure Chests.");
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "ERROR processing " + playerName + " " + amount + " Treasure Chests."));
|
||||
}
|
||||
}
|
||||
}, uuid.toString(), "Utility", "Treasure Chest", amount);
|
||||
|
@ -34,7 +34,7 @@ public class TreasureKeyCommand extends CommandBase<SalesPackageManager>
|
||||
if (uuid == null)
|
||||
UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
if (amountSpecified != 5)
|
||||
if (Math.abs(amountSpecified) != 5)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "You have specified an invalid amount of keys."));
|
||||
amountSpecified = 0;
|
||||
|
@ -263,7 +263,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
webAddress);
|
||||
|
||||
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, itemFactory, _achievementManager, clientManager);
|
||||
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, webAddress);
|
||||
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, false, "Class Shop");
|
||||
|
||||
_eloManager = new EloManager(_plugin, clientManager);
|
||||
}
|
||||
@ -455,12 +455,12 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanHurt(String a, String b)
|
||||
public boolean canHurt(String a, String b)
|
||||
{
|
||||
return CanHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
|
||||
return canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
|
||||
}
|
||||
|
||||
public boolean CanHurt(Player pA, Player pB)
|
||||
public boolean canHurt(Player pA, Player pB)
|
||||
{
|
||||
if (pA == null || pB == null)
|
||||
return false;
|
||||
@ -493,7 +493,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean IsSafe(Player player)
|
||||
public boolean isSafe(Player player)
|
||||
{
|
||||
if (_game == null)
|
||||
return true;
|
||||
|
@ -1256,7 +1256,7 @@ public class MineStrike extends TeamGame
|
||||
event.GetCancellers().clear();
|
||||
event.GetDamageMod().clear();
|
||||
|
||||
if (!Manager.CanHurt(event.GetDamageePlayer(), event.GetDamagerPlayer(true)))
|
||||
if (!Manager.canHurt(event.GetDamageePlayer(), event.GetDamagerPlayer(true)))
|
||||
event.SetCancelled("Team Damage");
|
||||
|
||||
event.AddMod(GetName(), "Negate Default", -event.GetDamageInitial(), false);
|
||||
|
@ -57,7 +57,7 @@ public class PerkCleave extends Perk
|
||||
if (other.equals(damagee))
|
||||
continue;
|
||||
|
||||
if (!Manager.CanHurt(damager, other))
|
||||
if (!Manager.canHurt(damager, other))
|
||||
continue;
|
||||
|
||||
//Damage Event
|
||||
|
@ -123,7 +123,7 @@ public class GameFlagManager implements Listener
|
||||
//PvP
|
||||
if (damagee instanceof Player && damager instanceof Player)
|
||||
{
|
||||
if (!Manager.CanHurt((Player)damagee, (Player)damager))
|
||||
if (!Manager.canHurt((Player)damagee, (Player)damager))
|
||||
{
|
||||
event.SetCancelled("PvP Disabled");
|
||||
return;
|
||||
@ -165,7 +165,7 @@ public class GameFlagManager implements Listener
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null) return;
|
||||
|
||||
if (Manager.CanHurt(damagee, damager))
|
||||
if (Manager.canHurt(damagee, damager))
|
||||
return;
|
||||
|
||||
event.SetCancelled("Allied Explosion");
|
||||
|
Loading…
Reference in New Issue
Block a user