Hub fixes

This commit is contained in:
Mini-Chiss 2015-08-08 08:19:07 +02:00
parent 33c96f51ae
commit 47cb98066d
4 changed files with 89 additions and 24 deletions

View File

@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets;
import java.util.HashMap;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
@ -18,7 +19,10 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.types.OutfitGadget;
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
import mineplex.core.itemstack.ItemStackFactory;
public class OutfitTeam extends OutfitGadget
{
@ -30,6 +34,43 @@ public class OutfitTeam extends OutfitGadget
super(manager, name, new String[] {ChatColor.RESET + "Team up with other players!", ChatColor.RESET + "Equip by typing;", ChatColor.RESET + C.cGreen + "/team <red/yellow/green/blue>"}, cost, slot, mat, data);
}
@Override
public void Enable(Player player)
{
GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this);
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
if (gadgetEvent.isCancelled())
{
return;
}
EnableCustom(player);
Manager.setActive(player, this);
}
@Override
public void ApplyArmor(Player player)
{
Manager.RemoveMorph(player);
Manager.RemoveOutfit(player, _slot);
_active.add(player);
if (_slot == ArmorSlot.Helmet) player.getInventory().setHelmet(
ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName()));
else if (_slot == ArmorSlot.Chest) player.getInventory().setChestplate(
ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName()));
else if (_slot == ArmorSlot.Legs) player.getInventory().setLeggings(
ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName()));
else if (_slot == ArmorSlot.Boots) player.getInventory().setBoots(
ItemStackFactory.Instance.CreateStack(GetDisplayMaterial().getId(), GetDisplayData(), 1, GetName()));
}
@Override
public void EnableCustom(Player player)
{
@ -44,7 +85,7 @@ public class OutfitTeam extends OutfitGadget
}
@EventHandler(priority=EventPriority.LOWEST)
public void updateColor(PlayerCommandPreprocessEvent event)
public void setColor(PlayerCommandPreprocessEvent event)
{
Player player = event.getPlayer();
@ -63,22 +104,29 @@ public class OutfitTeam extends OutfitGadget
{
_colorSetting.put(player.getName(), Color.RED);
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cRed + "Red Team Outfit") + "!"));
if (GetSlot() == ArmorSlot.Legs) //Only Display Once
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cRed + "Red Team Outfit") + "!"));
}
else if (args[1].equals("yellow"))
{
_colorSetting.put(player.getName(), Color.YELLOW);
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cRed + "Yellow Team Outfit") + "!"));
if (GetSlot() == ArmorSlot.Legs) //Only Display Once
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cYellow + "Yellow Team Outfit") + "!"));
}
else if (args[1].equals("green"))
{
_colorSetting.put(player.getName(), Color.LIME);
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cGreen + "Green Team Outfit") + "!"));
if (GetSlot() == ArmorSlot.Legs) //Only Display Once
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cGreen + "Green Team Outfit") + "!"));
}
else if (args[1].equals("blue"))
{
_colorSetting.put(player.getName(), Color.AQUA);
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cRed + "Blue Team Outfit") + "!"));
if (GetSlot() == ArmorSlot.Legs) //Only Display Once
UtilPlayer.message(player, F.main("Gadget", "You equipped " + F.elem(C.cAqua + "Blue Team Outfit") + "!"));
}
colorArmor(player);

View File

@ -18,7 +18,7 @@ public abstract class OutfitGadget extends Gadget
Boots
}
private ArmorSlot _slot;
protected ArmorSlot _slot;
public OutfitGadget(GadgetManager manager, String name, String[] desc, int cost, ArmorSlot slot, Material mat, byte data)
{

View File

@ -2,29 +2,19 @@ package mineplex.hub.modules;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.WeakHashMap;
import org.bukkit.Bukkit;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.entity.Slime;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin;
@ -47,7 +37,6 @@ import mineplex.core.gadget.event.GadgetActivateEvent;
import mineplex.core.gadget.gadgets.OutfitTeam;
import mineplex.core.gadget.types.Gadget;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.gadget.types.MusicGadget;
import mineplex.core.mount.event.MountActivateEvent;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
@ -87,6 +76,7 @@ public class SoccerManager extends MiniPlugin
private long _ballDeadTime = -1;
private String _lastKicker = "";
private Color _lastKick = null;
//Item Rebound
protected Vector _vel;
@ -178,7 +168,18 @@ public class SoccerManager extends MiniPlugin
if (_ball == null)
return;
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, _ball.getLocation().add(0, 0.5, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
if (_lastKick == Color.AQUA)
{
for (int i = 0 ; i < 3 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, _ball.getLocation().add(0.0, 0.5, 0.0), -1, 1, 1, 1, 0,
ViewDist.NORMAL, UtilServer.getPlayers());
}
else
{
for (int i = 0 ; i < 3 ; i++)
UtilParticle.PlayParticle(ParticleType.RED_DUST, _ball.getLocation().add(0.0, 0.5, 0.0), 0, 0, 0, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
}
//Kick
for (Player player : _active)
@ -204,11 +205,12 @@ public class SoccerManager extends MiniPlugin
UtilAction.zeroVelocity(player);
if (getTeamColor(player) == null)
_lastKick = getTeamColor(player);
if (_lastKick == null)
_lastKicker = player.getName();
else if (getTeamColor(player) == Color.RED)
else if (_lastKick == Color.RED)
_lastKicker = C.cRed + player.getName();
else if (getTeamColor(player) == Color.AQUA)
else if (_lastKick == Color.AQUA)
_lastKicker = C.cAqua + player.getName();
}
}
@ -274,7 +276,7 @@ public class SoccerManager extends MiniPlugin
if (UtilEnt.isGrounded(_ball))
_ballVel = _ballVel.multiply(0.98);
//Rebound Y XXX
//Rebound Y
if (UtilEnt.isGrounded(_ball))
{
if (_ballVel.getY() < -0.1)

View File

@ -37,7 +37,10 @@ import org.bukkit.entity.Snowman;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
@ -148,6 +151,18 @@ public class WorldManager extends MiniPlugin
event.setCancelled(true);
}
@EventHandler
public void BlockBurn(BlockBurnEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void BlockIgnite(BlockIgniteEvent event)
{
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void Explosion(EntityExplodeEvent event)
{