Sprint work
This commit is contained in:
parent
94f8419187
commit
a1dc9135c8
@ -2,7 +2,6 @@ package mineplex.gemhunters;
|
||||
|
||||
import static mineplex.core.Managers.require;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -13,7 +12,6 @@ import mineplex.core.FoodDupeFix;
|
||||
import mineplex.core.TimingsFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.chatsnap.SnapshotManager;
|
||||
@ -150,9 +148,10 @@ public class GemHunters extends JavaPlugin
|
||||
new DamageManager(this, new CombatManager(this), new NpcManager(this, creature), disguiseManager, new ConditionManager(this));
|
||||
|
||||
// GWEN
|
||||
AntiHack antiHack = require(AntiHack.class);
|
||||
antiHack.setKick(false);
|
||||
Bukkit.getScheduler().runTask(this, antiHack::enableNewAnticheat);
|
||||
//TODO enable GWEN, gives some annoying errors
|
||||
// AntiHack antiHack = require(AntiHack.class);
|
||||
// antiHack.setKick(false);
|
||||
// Bukkit.getScheduler().runTask(this, antiHack::enableNewAnticheat);
|
||||
|
||||
// Block Restore
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
@ -2,6 +2,7 @@ package mineplex.gemhunters;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.gemhunters.death.DeathModule;
|
||||
import mineplex.gemhunters.economy.CashOutModule;
|
||||
import mineplex.gemhunters.loot.LootModule;
|
||||
import mineplex.gemhunters.safezone.SafezoneModule;
|
||||
@ -17,6 +18,7 @@ public class GemHuntersModule extends MiniPlugin
|
||||
super("Gem Hunters");
|
||||
|
||||
require(CashOutModule.class);
|
||||
require(DeathModule.class);
|
||||
require(LootModule.class);
|
||||
require(SafezoneModule.class);
|
||||
require(ScoreboardModule.class);
|
||||
|
@ -0,0 +1,56 @@
|
||||
package mineplex.gemhunters.death;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.gemhunters.world.WorldDataModule;
|
||||
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class DeathModule extends MiniPlugin
|
||||
{
|
||||
|
||||
private static final Set<Material> DISALLOWED_DROPS = Sets.newHashSet(Material.EMERALD, Material.BONE);
|
||||
|
||||
private final WorldDataModule _worldData;
|
||||
|
||||
private DeathModule()
|
||||
{
|
||||
super("Death");
|
||||
|
||||
_worldData = require(WorldDataModule.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void death(PlayerDeathEvent event)
|
||||
{
|
||||
Player player = event.getEntity();
|
||||
|
||||
player.setHealth(20);
|
||||
UtilAction.zeroVelocity(player);
|
||||
player.teleport(_worldData.getSpawnLocation("Yellow").get(0));
|
||||
|
||||
Iterator<ItemStack> iterator = event.getDrops().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ItemStack itemStack = iterator.next();
|
||||
|
||||
if (DISALLOWED_DROPS.contains(itemStack.getType()))
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -25,6 +25,7 @@ import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
@ -41,7 +42,7 @@ public class CashOutModule extends MiniPlugin
|
||||
private static final ItemStack CASH_OUT_ITEM = new ItemBuilder(Material.EMERALD).setTitle(C.cGreen + "Cash Out").addLore("", C.cGray + "Click to begin the process to cash out.", C.cGray + "Cashing out saves your current loot.").build();
|
||||
|
||||
private static final int CASH_OUT_COOLDOWN = 10000;
|
||||
private static final int CASH_OUT_MAX_MOVE_DISTANCE_SQUARED = 4;
|
||||
private static final int CASH_OUT_MAX_MOVE_DISTANCE = 2;
|
||||
|
||||
private final Map<UUID, CashOutSession> _sessions;
|
||||
|
||||
@ -81,7 +82,7 @@ public class CashOutModule extends MiniPlugin
|
||||
{
|
||||
if (event.getItemDrop().getItemStack().isSimilar(CASH_OUT_ITEM))
|
||||
{
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannnot drop the" + F.item("Cash Out Item") + "."));
|
||||
event.getPlayer().sendMessage(F.main("Game", "You cannnot drop the " + F.item("Cash Out Item") + "."));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
@ -172,7 +173,7 @@ public class CashOutModule extends MiniPlugin
|
||||
Player player = UtilPlayer.searchExact(key);
|
||||
CashOutSession session = _sessions.get(key);
|
||||
|
||||
if (session.getLocation().distanceSquared(player.getLocation()) > CASH_OUT_MAX_MOVE_DISTANCE_SQUARED)
|
||||
if (UtilMath.offset(session.getLocation(), player.getLocation()) > CASH_OUT_MAX_MOVE_DISTANCE)
|
||||
{
|
||||
cancelCashOut(player, "You moved!");
|
||||
}
|
||||
@ -198,7 +199,7 @@ public class CashOutModule extends MiniPlugin
|
||||
@EventHandler
|
||||
public void entityAttack(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (!(event.getDamager() instanceof Player))
|
||||
if (!(event.getDamager() instanceof Player) || event.getEntity() instanceof ArmorStand)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -54,8 +54,10 @@ public class LootModule extends MiniPlugin
|
||||
_worldData = require(WorldDataModule.class);
|
||||
_chestLoot = new HashMap<>();
|
||||
_opened = new ArrayList<>(200);
|
||||
|
||||
|
||||
updateChestLoot();
|
||||
|
||||
runSyncLater(() -> _worldData.getDataLocation("PINK").forEach(location -> location.getBlock().setType(Material.CHEST)), 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -65,7 +67,7 @@ public class LootModule extends MiniPlugin
|
||||
}
|
||||
|
||||
public void updateChestLoot()
|
||||
{
|
||||
{
|
||||
try
|
||||
{
|
||||
Map<String, List<List<Object>>> map = _sheets.getCellValues(CHEST_LOOT_SHEET);
|
||||
@ -140,12 +142,7 @@ public class LootModule extends MiniPlugin
|
||||
}
|
||||
|
||||
double probability = Double.parseDouble(String.valueOf(values.get(6)));
|
||||
String metadata = null;
|
||||
|
||||
if (values.size() < 7)
|
||||
{
|
||||
metadata = String.valueOf(values.get(7));
|
||||
}
|
||||
String metadata = String.valueOf(values.get(7));
|
||||
|
||||
items.add(new LootItem(builder.build(), minAmount, maxAmount, probability, metadata));
|
||||
}
|
||||
@ -167,16 +164,8 @@ public class LootModule extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public void fillChest(Player player, Block block)
|
||||
public void fillChest(Player player, Block block, String key)
|
||||
{
|
||||
if (block.getType() != Material.CHEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO implement data points
|
||||
String key = "Example";
|
||||
|
||||
Set<Integer> used = new HashSet<>();
|
||||
Set<LootItem> items = _chestLoot.get(key);
|
||||
|
||||
@ -239,7 +228,7 @@ public class LootModule extends MiniPlugin
|
||||
return index;
|
||||
}
|
||||
|
||||
private LootItem isLootItem(ItemStack itemStack)
|
||||
public LootItem isLootItem(ItemStack itemStack)
|
||||
{
|
||||
for (Set<LootItem> items : _chestLoot.values())
|
||||
{
|
||||
@ -255,7 +244,6 @@ public class LootModule extends MiniPlugin
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void chestOpen(PlayerInteractEvent event)
|
||||
{
|
||||
@ -267,7 +255,7 @@ public class LootModule extends MiniPlugin
|
||||
Player player = event.getPlayer();
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
if (block == null)
|
||||
if (block == null || block.getType() != Material.CHEST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -276,9 +264,28 @@ public class LootModule extends MiniPlugin
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String key = null;
|
||||
|
||||
colourLoop: for (String colour : _worldData.getAllDataLocations().keySet())
|
||||
{
|
||||
for (Location location : _worldData.getDataLocation(colour))
|
||||
{
|
||||
if (UtilMath.offset(block.getLocation(), location) < 1)
|
||||
{
|
||||
key = colour;
|
||||
break colourLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (key == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_opened.add(block.getLocation());
|
||||
fillChest(player, block);
|
||||
fillChest(player, block, key);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.Managers;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
@ -15,11 +16,11 @@ public class LootRankReward extends LootItemReward
|
||||
|
||||
private final CoreClientManager _clientManager;
|
||||
|
||||
public LootRankReward(CoreClientManager clientManager)
|
||||
public LootRankReward()
|
||||
{
|
||||
super(CASH_OUT_DELAY);
|
||||
|
||||
_clientManager = clientManager;
|
||||
_clientManager = Managers.require(CoreClientManager.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -18,6 +17,7 @@ import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -50,19 +50,14 @@ public class SafezoneModule extends MiniPlugin
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
UUID key = player.getUniqueId();
|
||||
String oldSafezone = _currentSafezone.get(key);
|
||||
boolean isInOldSafezone = isInSafeZone(player.getLocation(), oldSafezone);
|
||||
boolean isInOldSafezone = oldSafezone != null;
|
||||
String newSafezone = getSafezone(player.getLocation());
|
||||
boolean isInNewSafezone = newSafezone != null;
|
||||
|
||||
// null -> not null
|
||||
// not null -> null
|
||||
// null -> null
|
||||
// not null -> not null
|
||||
|
||||
|
||||
if (!isInOldSafezone && isInNewSafezone)
|
||||
{
|
||||
UtilTextMiddle.display("", C.cYellow + "Entering " + newSafezone, 10, 40, 10, player);
|
||||
@ -70,7 +65,7 @@ public class SafezoneModule extends MiniPlugin
|
||||
}
|
||||
else if (isInOldSafezone && !isInNewSafezone)
|
||||
{
|
||||
UtilTextMiddle.display("", C.cYellow + "Leaving " + newSafezone, 10, 40, 10, player);
|
||||
UtilTextMiddle.display("", C.cYellow + "Leaving " + oldSafezone, 10, 40, 10, player);
|
||||
_currentSafezone.put(key, null);
|
||||
}
|
||||
}
|
||||
@ -82,7 +77,7 @@ public class SafezoneModule extends MiniPlugin
|
||||
Player player = event.getPlayer();
|
||||
|
||||
// Temporary
|
||||
player.teleport(UtilAlg.Random(_worldData.getDataLocation("LIME")));
|
||||
player.teleport(UtilAlg.Random(_worldData.getSpawnLocation("Lime")));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -132,7 +127,7 @@ public class SafezoneModule extends MiniPlugin
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Location> bounds = _worldData.getCustomLocation(safezone);
|
||||
List<Location> bounds = _worldData.getCustomLocation(SAFEZONE_DATA_PREFIX + " " + safezone);
|
||||
|
||||
if (bounds == null || bounds.size() != 2)
|
||||
{
|
||||
|
@ -5,22 +5,26 @@ import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import mineplex.core.common.block.schematic.Schematic;
|
||||
import mineplex.core.common.block.schematic.SchematicData;
|
||||
import mineplex.core.common.block.schematic.UtilSchematic;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
|
||||
/**
|
||||
* Represents an instance of a Supply Drop. <br>
|
||||
* A supply drop consists of a helicopter flying through the map from a one
|
||||
* location to another. Upon reaching it's destination it will drop a loot chest
|
||||
* which players can then fight over. <br>
|
||||
* which players can then fight over. <br>
|
||||
* The helicopter will then fly away towards a despawning location. <br>
|
||||
* <br>
|
||||
* The helicopter will be made up of a collection of blocks that are moved along
|
||||
@ -39,14 +43,11 @@ public class SupplyDrop
|
||||
|
||||
private static final String SCHEMATIC_PATH = "../../update/files/Helicopter.schematic";
|
||||
private static final int BLADE_LENGTH = 7;
|
||||
|
||||
private Location _spawn;
|
||||
|
||||
private Location _destination;
|
||||
private Location _despawn;
|
||||
private Location _current;
|
||||
private Location _blade;
|
||||
|
||||
private SupplyDropState _state;
|
||||
|
||||
private Schematic _schematic;
|
||||
private Set<Block> _lastHelicopter;
|
||||
@ -55,12 +56,10 @@ public class SupplyDrop
|
||||
|
||||
public SupplyDrop(Location spawn, Location destination, Location despawn)
|
||||
{
|
||||
_spawn = spawn;
|
||||
_destination = destination;
|
||||
_despawn = despawn;
|
||||
_current = spawn;
|
||||
_state = SupplyDropState.MOVING_TO_DESTINATION;
|
||||
|
||||
_destination = destination.clone();
|
||||
_despawn = despawn.clone();
|
||||
_current = spawn.clone().add(-2, 0, 0);
|
||||
|
||||
try
|
||||
{
|
||||
_schematic = UtilSchematic.loadSchematic(new File(SCHEMATIC_PATH));
|
||||
@ -70,45 +69,66 @@ public class SupplyDrop
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_lastHelicopter = new HashSet<>(100);
|
||||
_bladeBlocks = new HashSet<>(20);
|
||||
_diagonal = false;
|
||||
}
|
||||
|
||||
public void advancePath()
|
||||
public boolean advancePath()
|
||||
{
|
||||
if (!isStopped())
|
||||
boolean done = moveHelicopter();
|
||||
|
||||
if (!done)
|
||||
{
|
||||
moveHelicopter();
|
||||
rotateBlades();
|
||||
}
|
||||
|
||||
rotateBlades();
|
||||
|
||||
|
||||
_current.add(0, 0, 1);
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
public void moveHelicopter()
|
||||
|
||||
public boolean moveHelicopter()
|
||||
{
|
||||
for (Block block : _lastHelicopter)
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
|
||||
_lastHelicopter.clear();
|
||||
|
||||
SchematicData data = _schematic.paste(_current, true, true);
|
||||
|
||||
|
||||
if (_blade != null)
|
||||
{
|
||||
if (UtilMath.offset2d(_blade, _destination) < 1)
|
||||
{
|
||||
spawnLootChest();
|
||||
}
|
||||
else if (UtilMath.offset2d(_blade, _despawn) < 1)
|
||||
{
|
||||
for (Block block : _bladeBlocks)
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
SchematicData data = _schematic.paste(_current, true);
|
||||
|
||||
_blade = data.getDataLocationMap().getIronLocations(DyeColor.RED).get(0);
|
||||
|
||||
|
||||
for (BlockVector vector : data.getBlocks())
|
||||
{
|
||||
Location location = _current.add(vector);
|
||||
|
||||
|
||||
_lastHelicopter.add(location.getBlock());
|
||||
|
||||
_current.subtract(vector);
|
||||
|
||||
_current.subtract(vector);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void rotateBlades()
|
||||
@ -119,11 +139,11 @@ public class SupplyDrop
|
||||
{
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
|
||||
|
||||
_bladeBlocks.clear();
|
||||
|
||||
|
||||
if (_diagonal)
|
||||
{
|
||||
{
|
||||
for (int x = -1; x <= 1; x += 2)
|
||||
{
|
||||
for (int z = -1; z <= 1; z += 2)
|
||||
@ -139,7 +159,7 @@ public class SupplyDrop
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
for (int x = -1; x <= 1; x += 2)
|
||||
{
|
||||
for (Location location : UtilShapes.getLinesLimitedPoints(_blade, _blade.clone().add(x * BLADE_LENGTH, 0, 0), BLADE_LENGTH))
|
||||
@ -164,9 +184,14 @@ public class SupplyDrop
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isStopped()
|
||||
public void spawnLootChest()
|
||||
{
|
||||
return _state == SupplyDropState.STOPPED;
|
||||
FallingBlock fallingBlock = _blade.getWorld().spawnFallingBlock(_blade.clone().subtract(0, 10, 0), Material.WOOD, (byte) 0);
|
||||
|
||||
fallingBlock.setHurtEntities(false);
|
||||
fallingBlock.setDropItem(false);
|
||||
|
||||
UtilFirework.playFreedomFirework(fallingBlock.getLocation());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,14 @@
|
||||
package mineplex.gemhunters.supplydrop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -10,35 +16,44 @@ import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.gemhunters.supplydrop.commands.CommandSupplyDropTest;
|
||||
import mineplex.gemhunters.world.WorldDataModule;
|
||||
|
||||
@ReflectivelyCreateMiniPlugin
|
||||
public class SupplyDropModule extends MiniPlugin
|
||||
{
|
||||
|
||||
|
||||
private final WorldDataModule _worldData;
|
||||
|
||||
private SupplyDrop _current;
|
||||
|
||||
|
||||
private SupplyDropModule()
|
||||
{
|
||||
super("Supply Drop");
|
||||
|
||||
_worldData = require(WorldDataModule.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCommands()
|
||||
{
|
||||
addCommand(new CommandSupplyDropTest(this));
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC || _current == null)
|
||||
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_current.advancePath();
|
||||
|
||||
if (_current.advancePath())
|
||||
{
|
||||
_current = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void itemSpawn(ItemSpawnEvent event)
|
||||
{
|
||||
@ -48,8 +63,39 @@ public class SupplyDropModule extends MiniPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public void startHelicopter(Player player)
|
||||
@EventHandler
|
||||
public void fallingBlockChange(EntityChangeBlockEvent event)
|
||||
{
|
||||
_current = new SupplyDrop(player.getLocation(), player.getLocation(), player.getLocation());
|
||||
if (event.getEntity() instanceof FallingBlock && event.getTo() == Material.WOOD)
|
||||
{
|
||||
Block block = event.getBlock();
|
||||
|
||||
block.setType(Material.CHEST);
|
||||
|
||||
List<Location> chests = _worldData.getAllDataLocations().get("RED");
|
||||
|
||||
if (chests == null)
|
||||
{
|
||||
chests = new ArrayList<>();
|
||||
}
|
||||
|
||||
if (!chests.contains(block.getLocation()))
|
||||
{
|
||||
chests.add(block.getLocation());
|
||||
}
|
||||
|
||||
_worldData.getAllDataLocations().put("RED", chests);
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void startHelicopter()
|
||||
{
|
||||
Location spawn = _worldData.getCustomLocation("SUPPLY_DROP Fountain Spawn").get(0);
|
||||
Location destination = _worldData.getCustomLocation("SUPPLY_DROP Fountain Chest").get(0);
|
||||
Location despawn = _worldData.getCustomLocation("SUPPLY_DROP Fountain End").get(0);
|
||||
|
||||
_current = new SupplyDrop(spawn, destination, despawn);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +0,0 @@
|
||||
package mineplex.gemhunters.supplydrop;
|
||||
|
||||
public enum SupplyDropState
|
||||
{
|
||||
|
||||
MOVING_TO_DESTINATION, STOPPED, MOVING_TO_DESPAWN
|
||||
|
||||
}
|
@ -18,7 +18,7 @@ public class CommandSupplyDropTest extends CommandBase<SupplyDropModule>
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
caller.sendMessage("Running!");
|
||||
Plugin.startHelicopter(caller);
|
||||
Plugin.startHelicopter();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -293,14 +293,24 @@ public class WorldDataModule extends MiniPlugin
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Location> getDataLocation(String data)
|
||||
public List<Location> getSpawnLocation(String colour)
|
||||
{
|
||||
if (!DATA_LOCATIONS.containsKey(data))
|
||||
if (!SPAWN_LOCATIONS.containsKey(colour))
|
||||
{
|
||||
return new ArrayList<Location>();
|
||||
}
|
||||
|
||||
return DATA_LOCATIONS.get(data);
|
||||
return SPAWN_LOCATIONS.get(colour);
|
||||
}
|
||||
|
||||
public List<Location> getDataLocation(String colour)
|
||||
{
|
||||
if (!DATA_LOCATIONS.containsKey(colour))
|
||||
{
|
||||
return new ArrayList<Location>();
|
||||
}
|
||||
|
||||
return DATA_LOCATIONS.get(colour);
|
||||
}
|
||||
|
||||
public List<Location> getCustomLocation(String id)
|
||||
@ -313,6 +323,11 @@ public class WorldDataModule extends MiniPlugin
|
||||
return CUSTOM_LOCAITONS.get(id);
|
||||
}
|
||||
|
||||
public Map<String, List<Location>> getAllSpawnLocations()
|
||||
{
|
||||
return SPAWN_LOCATIONS;
|
||||
}
|
||||
|
||||
public Map<String, List<Location>> getAllCustomLocations()
|
||||
{
|
||||
return CUSTOM_LOCAITONS;
|
||||
|
Loading…
Reference in New Issue
Block a user