siege weapon picking up

This commit is contained in:
Ben 2016-03-09 23:56:25 +00:00
parent 4955abb519
commit 9b40496a1e
6 changed files with 65 additions and 16 deletions

View File

@ -54,7 +54,7 @@ import net.minecraft.server.v1_8_R3.MinecraftServer;
public class Clans extends JavaPlugin
{
public static final String VERSION = "Beta 1.1_02";
public static final String VERSION = "Beta 1.0_01";
private String WEB_CONFIG = "webServer";
// Modules

View File

@ -369,6 +369,22 @@ public class Cannon extends SiegeWeapon
}
}
protected void handleLeftClick(Player player)
{
if (_rider == null)
{
UtilPlayer.message(player, F.main("Clans", "You picked up your Cannon."));
player.getInventory().addItem(CANNON_ITEM);
kill();
return;
}
super.handleLeftClick(player);
}
@Override
protected double[] GetProjectileVelocity()
{

View File

@ -417,7 +417,7 @@ public abstract class SiegeWeapon implements Listener
player.teleport(player.getLocation().add(0, 1, 0));
}
private void handleLeftClick(Player player)
protected void handleLeftClick(Player player)
{
if (_lastLeft == -1)
{

View File

@ -42,7 +42,7 @@ public class MeridianScepter extends LegendaryItem
C.cWhite + "Legend says "
+ " ",
"#" + C.cYellow + "Right-Click" + C.cWhite + " to use Scepter."
}, LineFormat.LORE), Material.RECORD_7);
}, LineFormat.LORE), Material.RECORD_6);
}
@Override

View File

@ -3,25 +3,23 @@ package mineplex.game.clans.items.rares;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.LineFormat;
import mineplex.core.common.util.RGBData;
import mineplex.core.common.util.UtilColor;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.core.repository.ClanTerritory;
import mineplex.game.clans.items.PlayerGear;
@ -33,6 +31,33 @@ public class RunedPickaxe extends RareItem
static
{
UtilServer.RegisterEvents(new Listener() {
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
UtilServer.getPlayersCollection().forEach(player -> {
PlayerGear gear = ClansManager.getInstance().getGearManager().getPlayerGear(player);
if (!(gear.getWeapon() instanceof RunedPickaxe))
{
return;
}
RunedPickaxe pick = (RunedPickaxe) gear.getWeapon();
if ((System.currentTimeMillis() - pick._instamineEnabled) >= 12000
&& Recharge.Instance.usable(player, "Instant Mine"))
{
Recharge.Instance.use(player, "Instant Mine", 15 * 1000, true, true);
}
});
}
@EventHandler(priority = EventPriority.LOWEST)
public void blockDamage(BlockDamageEvent event)
{
@ -42,9 +67,7 @@ public class RunedPickaxe extends RareItem
{
return;
}
System.out.println(event.getBlock());
RunedPickaxe pick = (RunedPickaxe) gear.getWeapon();
String playerClan = ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()) == null ? null : ClansManager.getInstance().getClanUtility().getClanByPlayer(event.getPlayer()).getName();
@ -73,7 +96,7 @@ public class RunedPickaxe extends RareItem
{
super("Runed Pickaxe", UtilText.splitLinesToArray(new String[] {
"#" + C.cYellow + "Right-Click" + C.cWhite + " to use " + F.elem("Instant mine") + "."
}, LineFormat.LORE), Material.RECORD_8);
}, LineFormat.LORE), Material.RECORD_7);
}
public void onInteract(PlayerInteractEvent event)
@ -83,7 +106,7 @@ public class RunedPickaxe extends RareItem
return;
}
if (Recharge.Instance.use(event.getPlayer(), "Instant Mine", 30000, true, true))
if (Recharge.Instance.usable(event.getPlayer(), "Instant Mine", true) && (UtilTime.elapsed(_instamineEnabled, 12000)))
{
_instamineEnabled = System.currentTimeMillis();
}

View File

@ -223,7 +223,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
{
String stageTitle;
int[] indices = UtilUI.getIndicesFor(4, 1, 1);
int[] indices = UtilUI.getIndicesFor(5, 1, 1);
stageTitle = "1. Select Item Type";
addButton(indices[0], Material.GOLD_RECORD, 0, C.cGold + "Legendary", new IButton()
@ -246,7 +246,17 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
}
}, _factory != null && ItemType.RARE.equals(_factory.getItemType()), new String[] { _factory != null && ItemType.RARE.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
addButton(indices[2], Material.DIAMOND_CHESTPLATE, 0, C.cDGreen + "Armor", new IButton()
addButton(indices[2], Material.DIAMOND_SWORD, 0, C.cDGreen + "Weapon", new IButton()
{
public void onClick(Player player, ClickType clickType)
{
_factory = RareItemFactory.begin(ItemType.WEAPON);
performNext();
buildPage();
}
}, _factory != null && ItemType.RARE.equals(_factory.getItemType()), new String[] { _factory != null && ItemType.RARE.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
addButton(indices[3], Material.DIAMOND_CHESTPLATE, 0, C.cDGreen + "Armor", new IButton()
{
public void onClick(Player player, ClickType clickType)
{
@ -256,7 +266,7 @@ public class GearPage extends ShopPageBase<GearManager, GearShop>
}
}, _factory != null && ItemType.ARMOR.equals(_factory.getItemType()), new String[] { _factory != null && ItemType.ARMOR.equals(_factory.getItemType()) ? C.cGreen + "Selected" : C.cRed + "Not Selected" });
addButton(indices[3], Material.BOW, 0, C.cDGreen + "Bow", new IButton()
addButton(indices[4], Material.BOW, 0, C.cDGreen + "Bow", new IButton()
{
public void onClick(Player player, ClickType clickType)
{