Bugs and thugs

This commit is contained in:
Shaun Bennett 2015-11-25 16:45:04 -05:00
parent 1306137cb2
commit cc75bafb4c
18 changed files with 179 additions and 61 deletions

View File

@ -134,8 +134,8 @@ public class Clans extends JavaPlugin
((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0; ((CraftWorld) world).getHandle().spigotConfig.itemMerge = 0;
} }
// Updates //Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Updater(this), 1, 1); new Updater(this);
MinecraftServer.getServer().getPropertyManager().setProperty("debug", true); MinecraftServer.getServer().getPropertyManager().setProperty("debug", true);

View File

@ -38,7 +38,7 @@ public class ClanInfo
private String _name = ""; private String _name = "";
private String _desc = ""; private String _desc = "";
private Location _home = null; private Location _home = null;
private int _energy = 1440; private int _energy = 4320;
// Stats // Stats
private int _kills; private int _kills;
@ -545,14 +545,17 @@ public class ClanInfo
{ {
int warPoints = 0; int warPoints = 0;
ClanWarData data = _warIn.get(against); if (against != null)
if (data != null)
{ {
warPoints = data.getClanBPoints(); ClanWarData data = _warIn.get(against.getName());
} if (data != null)
else if ((data = _warOut.get(against)) != null) {
{ warPoints = data.getClanBPoints();
warPoints = data.getClanAPoints(); }
else if ((data = _warOut.get(against.getName())) != null)
{
warPoints = data.getClanAPoints();
}
} }
return warPoints; return warPoints;
@ -630,7 +633,7 @@ public class ClanInfo
public int getEnergyMax() public int getEnergyMax()
{ {
// 10080 = 7 days of minutes // 10080 = 7 days of minutes
return Math.max(1440, getEnergyCostPerMinute() * 60 * 24 * 3); return Math.max(4320, getEnergyCostPerMinute() * 60 * 24 * 3);
} }
public int getEnergyCostPerMinute() public int getEnergyCostPerMinute()

View File

@ -144,7 +144,7 @@ public class ClansDataAccessLayer
token.Description = "No Description"; token.Description = "No Description";
token.Home = ""; token.Home = "";
token.Admin = admin; token.Admin = admin;
token.Energy = 1440; token.Energy = 4320;
ClanCreatedEvent event = new ClanCreatedEvent(token, Bukkit.getPlayer(creator)); ClanCreatedEvent event = new ClanCreatedEvent(token, Bukkit.getPlayer(creator));
UtilServer.getServer().getPluginManager().callEvent(event); UtilServer.getServer().getPluginManager().callEvent(event);

View File

@ -833,6 +833,11 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
return _chat; return _chat;
} }
public ClansScoreboardManager getScoreboard()
{
return _scoreboard;
}
/** /**
* Get the timezone for this server. This may be used in the future if we * Get the timezone for this server. This may be used in the future if we
* have clans servers with varying timezones. * have clans servers with varying timezones.

View File

@ -12,7 +12,7 @@ public class ClansPlayerComparator implements Comparator<ClansPlayer>
if (o1.isOnline() != o2.isOnline()) if (o1.isOnline() != o2.isOnline())
{ {
return o1.isOnline() ? 1 : -1; return o1.isOnline() ? -1 : 1;
} }
if (o1.getRole() != o2.getRole()) if (o1.getRole() != o2.getRole())

View File

@ -242,6 +242,9 @@ public class ClanMainPage extends ClanPageBase
for (int i = 0; i < 4 && descIterator.hasNext(); i++) for (int i = 0; i < 4 && descIterator.hasNext(); i++)
{ {
ClanWarData data = descIterator.next(); ClanWarData data = descIterator.next();
if (data.getPoints(clanInfo.getName()) <= 0)
break;
int slot = 45 + i; int slot = 45 + i;
addWarButton(slot, clanInfo, data); addWarButton(slot, clanInfo, data);
} }
@ -249,6 +252,9 @@ public class ClanMainPage extends ClanPageBase
for (int i = 0; i < 4 && ascIterator.hasNext(); i++) for (int i = 0; i < 4 && ascIterator.hasNext(); i++)
{ {
ClanWarData data = ascIterator.next(); ClanWarData data = ascIterator.next();
if (data.getPoints(clanInfo.getName()) >= 0)
break;
int slot = 53 - i; int slot = 53 - i;
addWarButton(slot, clanInfo, data); addWarButton(slot, clanInfo, data);
} }

View File

@ -10,6 +10,7 @@ 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.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
@ -67,11 +68,17 @@ public class ObserverManager extends MiniPlugin
private void restore(Player player, ObserverData data) private void restore(Player player, ObserverData data)
{ {
data.getSnapshot().applySnapshot(player); data.getSnapshot().applySnapshot(player);
// _conditionManager.Clean(player); _conditionManager.Clean(player);
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
((CraftPlayer) player).getHandle().spectating = false; ((CraftPlayer) player).getHandle().spectating = false;
} }
@EventHandler
public void onDamage(EntityDamageByEntityEvent event)
{
if (_observerMap.containsKey(event.getDamager()) || _observerMap.containsKey(event.getEntity()))
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void onInteract(PlayerInteractEvent event) public void onInteract(PlayerInteractEvent event)

View File

@ -3,6 +3,7 @@ package mineplex.game.clans.clans.supplyDrop;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Random; import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.Material; import org.bukkit.Material;
@ -27,7 +28,7 @@ import mineplex.game.clans.clans.ClansManager;
public class SupplyDrop implements Listener public class SupplyDrop implements Listener
{ {
private static int DROP_TICKS = 20 * 50; private static int DROP_TICKS = 20 * 10;
private static int REMOVE_TICKS = DROP_TICKS + (20 * 120); // 2 Minutes private static int REMOVE_TICKS = DROP_TICKS + (20 * 120); // 2 Minutes
public static Material SUPPLY_DROP_MATERIAL = Material.BEACON; public static Material SUPPLY_DROP_MATERIAL = Material.BEACON;
@ -71,6 +72,7 @@ public class SupplyDrop implements Listener
{ {
if (getTicks() == 10) if (getTicks() == 10)
{ {
/*
try try
{ {
TileEntity tileEntity = ((CraftWorld) _block.getWorld()).getHandle().getTileEntity(new BlockPosition(_block.getX(), _block.getY(), _block.getZ())); TileEntity tileEntity = ((CraftWorld) _block.getWorld()).getHandle().getTileEntity(new BlockPosition(_block.getX(), _block.getY(), _block.getZ()));
@ -91,6 +93,7 @@ public class SupplyDrop implements Listener
{ {
e.printStackTrace(); e.printStackTrace();
} }
*/
} }
if (getTicks() > 15 && getTicks() % 10 == 0) if (getTicks() > 15 && getTicks() % 10 == 0)
@ -130,19 +133,27 @@ public class SupplyDrop implements Listener
private void placeChest() private void placeChest()
{ {
getBlock().setType(Material.TRAPPED_CHEST); getBlock().setType(Material.CHEST);
Chest chest = (Chest) getBlock().getState();
Inventory inventory = chest.getBlockInventory(); _clansManager.runSyncLater(new Runnable()
int slots = inventory.getSize();
int drops = 5 + _random.nextInt(11); // 5 -> 15
for (int i = 0; i < drops; i++)
{ {
int slot = _random.nextInt(slots); @Override
ItemStack item = _clansManager.getLootManager().getRareItemStack(); public void run()
inventory.setItem(slot, item); {
} Chest chest = (Chest) getBlock().getState();
Inventory inventory = chest.getBlockInventory();
int slots = inventory.getSize();
int drops = 5 + _random.nextInt(11); // 5 -> 15
for (int i = 0; i < drops; i++)
{
int slot = _random.nextInt(slots);
ItemStack item = _clansManager.getLootManager().getRareItemStack();
inventory.setItem(slot, item);
}
}
}, 5);
} }
private void finish() private void finish()

View File

@ -115,7 +115,7 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
// } // }
@EventHandler @EventHandler
public void handleDeath(ClansPlayerDeathEvent event) public void handleDeath(final ClansPlayerDeathEvent event)
{ {
if (event.getPlayer() != null && event.getPlayer().getClan() != null) if (event.getPlayer() != null && event.getPlayer().getClan() != null)
{ {
@ -140,6 +140,9 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
ClanInfo clanB = clan.equals(clanA) ? killerClan : clan; ClanInfo clanB = clan.equals(clanA) ? killerClan : clan;
_clansManager.getClanDataAccess().updateWar(clanA, clanB, war, null); _clansManager.getClanDataAccess().updateWar(clanA, clanB, war, null);
_clansManager.getScoreboard().refresh(killerClan);
_clansManager.getScoreboard().refresh(clan);
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer()); _clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer()); _clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
} }
@ -154,6 +157,12 @@ public class WarManager extends MiniPlugin implements ScoreboardElement
ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan); ClansUtility.ClanRelation rel = _clansManager.getClanUtility().rel(clan, killerClan);
_clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) + clan.getName())); _clansManager.messageClan(killerClan, F.main("Clans", "Your clan gained 1 War Point against " + rel.getColor(false) + clan.getName()));
_clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) + killerClan.getName())); _clansManager.messageClan(clan, F.main("Clans", "Your clan lost 1 War Point against " + rel.getColor(false) + killerClan.getName()));
_clansManager.getScoreboard().refresh(killerClan);
_clansManager.getScoreboard().refresh(clan);
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_RIP, event.getPlayer().getPlayer());
_clansManager.ClanTips.displayTip(TipType.DOMINANCE_NOOICE, event.getKiller().getPlayer());
} }
}); });
} }

View File

@ -272,16 +272,22 @@ public class GearManager extends MiniPlugin implements IPacketHandler, Runnable
AttributeContainer attributes = new AttributeContainer(); AttributeContainer attributes = new AttributeContainer();
generateAttributes(attributes, itemType, attributeCount); generateAttributes(attributes, itemType, attributeCount);
System.out.println("Generating attributes...");
System.out.println("Remaining size: " + attributes.getRemainingTypes().size());
if (attributes.getSuperPrefix() != null) if (attributes.getSuperPrefix() != null)
{ {
System.out.println("Set super prefix: " + attributes.getSuperPrefix().getClass());
factory.setSuperPrefix(attributes.getSuperPrefix().getClass()); factory.setSuperPrefix(attributes.getSuperPrefix().getClass());
} }
if (attributes.getPrefix() != null) if (attributes.getPrefix() != null)
{ {
System.out.println("Set prefix: " + attributes.getPrefix().getClass());
factory.setPrefix(attributes.getPrefix().getClass()); factory.setPrefix(attributes.getPrefix().getClass());
} }
if (attributes.getSuffix() != null) if (attributes.getSuffix() != null)
{ {
System.out.println("Set suffix: " + attributes.getSuffix().getClass());
factory.setSuffix(attributes.getSuffix().getClass()); factory.setSuffix(attributes.getSuffix().getClass());
} }
} }

View File

@ -95,6 +95,15 @@ public class RareItemFactory
} }
public ItemStack fabricate() public ItemStack fabricate()
{
applyAttributes();
ItemStack item = _item.toItemStack();
return item;
}
private void applyAttributes()
{ {
try try
{ {
@ -117,10 +126,6 @@ public class RareItemFactory
{ {
e.printStackTrace(); e.printStackTrace();
} }
ItemStack item = _item.toItemStack();
return item;
} }
public ItemType getItemType() public ItemType getItemType()
@ -135,6 +140,7 @@ public class RareItemFactory
public CustomItem getWrapper() public CustomItem getWrapper()
{ {
applyAttributes();
return _item; return _item;
} }
} }

View File

@ -53,7 +53,7 @@ public class GiantsBroadsword extends LegendaryItem
private void buffPlayer(Player player) private void buffPlayer(Player player)
{ {
grantPotionEffect(player, PotionEffectType.SLOW, 4, 10); grantPotionEffect(player, PotionEffectType.SLOW, 10, 10);
grantPotionEffect(player, PotionEffectType.REGENERATION, 1, 10); grantPotionEffect(player, PotionEffectType.REGENERATION, 1, 10);
} }
} }

View File

@ -55,7 +55,7 @@ public class TutorialGettingStarted extends Tutorial
_doScoreboard = true; _doScoreboard = true;
_ghostMode = true; _ghostMode = true;
_startOnJoin = true; _startOnJoin = false;
_uniqueId = "GettingStartedTutorial"; _uniqueId = "GettingStartedTutorial";
_friendlyName = "Getting Started"; _friendlyName = "Getting Started";

View File

@ -462,12 +462,20 @@ public class ClientClass
return _gameClass; return _gameClass;
} }
public boolean IsGameClass(ClassType type) public boolean IsGameClass(ClassType... types)
{ {
if (GetGameClass() == null) if (GetGameClass() == null)
return false; return false;
return GetGameClass().GetType() == type; for (ClassType type : types)
{
if (type == GetGameClass().GetType())
{
return true;
}
}
return false;
} }
public Collection<ISkill> GetSkills() public Collection<ISkill> GetSkills()

View File

@ -196,11 +196,12 @@ public class PvpClass implements IPvpClass
continue; continue;
} }
if (_classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null) if (_classes.getGadgetManager() != null && _classes.getGadgetManager().getActive(cur, GadgetType.Costume) != null)
continue; continue;
Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null); Equip(cur, _classes.getMessageSuppressedCallback(cur.getName()) == null);
_classes.getMessageSuppressedCallback(cur.getName()).run(cur.getName()); Callback<String> callback = _classes.getMessageSuppressedCallback(cur.getName());
if (callback != null) callback.run(cur.getName());
} }
} }
} }

View File

@ -37,6 +37,8 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.classcombat.Skill.SkillCharge; import mineplex.minecraft.game.classcombat.Skill.SkillCharge;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossExpireEvent;
import mineplex.minecraft.game.classcombat.Skill.event.BlockTossLandEvent;
import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillEvent;
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent; import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -46,6 +48,22 @@ public class BlockToss extends SkillCharge implements IThrown
private HashMap<Player, FallingBlock> _holding = new HashMap<Player, FallingBlock>(); private HashMap<Player, FallingBlock> _holding = new HashMap<Player, FallingBlock>();
private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>(); private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>();
private Material[] _blacklist = new Material[]
{
Material.TNT,
Material.IRON_DOOR,
Material.IRON_DOOR_BLOCK,
Material.WOOD_DOOR,
Material.WOODEN_DOOR,
Material.ENCHANTMENT_TABLE,
Material.CHEST,
Material.FURNACE,
Material.BURNING_FURNACE,
Material.WORKBENCH,
Material.WATER,
Material.LAVA
};
public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels) public BlockToss(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
{ {
super(skills, name, classType, skillType, cost, levels, super(skills, name, classType, skillType, cost, levels,
@ -105,6 +123,15 @@ public class BlockToss extends SkillCharge implements IThrown
Block grab = event.getClickedBlock(); Block grab = event.getClickedBlock();
//Blacklist
for (Material mat : _blacklist)
if (mat == grab.getType())
return;
//Usable
if (UtilBlock.usable(grab))
return;
//Door and Banner //Door and Banner
if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71 || grab.getRelative(BlockFace.UP).getType() == Material.STANDING_BANNER) if (grab.getRelative(BlockFace.UP).getTypeId() == 64 || grab.getRelative(BlockFace.UP).getTypeId() == 71 || grab.getRelative(BlockFace.UP).getType() == Material.STANDING_BANNER)
{ {
@ -137,7 +164,7 @@ public class BlockToss extends SkillCharge implements IThrown
} }
} }
if (Factory.BlockRestore().Contains(grab)) if (Factory.BlockRestore().contains(grab))
{ {
UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block.")); UtilPlayer.message(player, F.main(GetName(), "You cannot grab this block."));
return; return;
@ -306,7 +333,13 @@ public class BlockToss extends SkillCharge implements IThrown
fallIter.remove(); fallIter.remove();
createBlock(fall, fall.getLocation().getBlock()); Block block = fall.getLocation().getBlock();
// Call and trigger block expiry event
BlockTossExpireEvent expireEvent = new BlockTossExpireEvent(block);
Bukkit.getServer().getPluginManager().callEvent(expireEvent);
if (!expireEvent.isCancelled()) createBlock(fall, block);
} }
} }
@ -321,12 +354,30 @@ public class BlockToss extends SkillCharge implements IThrown
if (id == 13) id = Material.STONE.getId(); if (id == 13) id = Material.STONE.getId();
//Block Replace //Block Replace
Factory.BlockRestore().Add(block, id, (byte)0, 10000); Factory.BlockRestore().add(block, id, (byte)0, 10000);
//Effect //Effect
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId()); block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
} }
@EventHandler
public void onBlockLand(EntityChangeBlockEvent event)
{
if (event.getEntity() instanceof FallingBlock)
{
if (!event.getBlock().getType().isSolid()) // Falling block is landing and turning block from air to type
{
BlockTossLandEvent landEvent = new BlockTossLandEvent(event.getBlock());
Bukkit.getServer().getPluginManager().callEvent(landEvent);
if (landEvent.isCancelled())
{
event.setCancelled(true);
}
}
}
}
@EventHandler @EventHandler
public void ItemSpawn(ItemSpawnEvent event) public void ItemSpawn(ItemSpawnEvent event)
{ {

View File

@ -654,6 +654,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)
{ {

View File

@ -275,7 +275,7 @@ public class Flag
loc.add(0, 1, 0); loc.add(0, 1, 0);
_flagBlock = loc.getBlock(); _flagBlock = loc.getBlock();
_host.getArcadeManager().getClassManager().GetSkillFactory().BlockRestore().Restore(_flagBlock); _host.getArcadeManager().getClassManager().GetSkillFactory().BlockRestore().restore(_flagBlock);
_priorBlock = loc.getBlock().getType(); _priorBlock = loc.getBlock().getType();