fixed & inv see?
This commit is contained in:
parent
ae42aaaab1
commit
48cfe4d91c
@ -4,8 +4,12 @@ import java.util.Arrays;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
@ -62,17 +66,6 @@ public class UtilCollections
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <E> void forEachFilter(E[] elements, Function<E, Boolean> filter, Consumer<E> consumer)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < elements.length; i++)
|
|
||||||
{
|
|
||||||
if (filter.apply(elements[i]).booleanValue())
|
|
||||||
{
|
|
||||||
consumer.accept(elements[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <E> void forEach(E[] elements, Consumer<E> consumer)
|
public static <E> void forEach(E[] elements, Consumer<E> consumer)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < elements.length; i++)
|
for (int i = 0; i < elements.length; i++)
|
||||||
@ -80,17 +73,20 @@ public class UtilCollections
|
|||||||
consumer.accept(elements[i]);
|
consumer.accept(elements[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <E> void forEach(E[] elements, BiConsumer<Integer, E> consumer)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < elements.length; i++)
|
||||||
|
{
|
||||||
|
consumer.accept(Integer.valueOf(i), elements[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static <E> void addAll(E[] elements, Collection<E> collection)
|
public static <E> void addAll(E[] elements, Collection<E> collection)
|
||||||
{
|
{
|
||||||
forEach(elements, collection::add);
|
forEach(elements, collection::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <E> void addAll(E[] elements, Function<E, Boolean> filter, Collection<E> collection)
|
|
||||||
{
|
|
||||||
forEachFilter(elements, filter, collection::add);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void loop(int min, int max, Consumer<Integer> consumer)
|
public static void loop(int min, int max, Consumer<Integer> consumer)
|
||||||
{
|
{
|
||||||
for (int i = min; i < max; i++)
|
for (int i = min; i < max; i++)
|
||||||
@ -233,9 +229,15 @@ public class UtilCollections
|
|||||||
{
|
{
|
||||||
return array[Random.nextInt(array.length)];
|
return array[Random.nextInt(array.length)];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> Collection<? extends T> toList(T[] array)
|
public static <T> Collection<? extends T> toList(T[] array)
|
||||||
{
|
{
|
||||||
return Lists.newArrayList(array);
|
return Lists.newArrayList(array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T1, T2> boolean equal(T1[] array1, T2[] array2)
|
||||||
|
{
|
||||||
|
return Arrays.equals(array1, array2);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,14 +8,15 @@ import java.util.LinkedList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
public class UtilServer
|
public class UtilServer
|
||||||
@ -92,11 +93,16 @@ public class UtilServer
|
|||||||
return (double)getPlayers().length / (double)UtilServer.getServer().getMaxPlayers();
|
return (double)getPlayers().length / (double)UtilServer.getServer().getMaxPlayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerEvents(Listener listener)
|
public static void RegisterEvents(Listener listener)
|
||||||
{
|
{
|
||||||
getPluginManager().registerEvents(listener, getPlugin());
|
getPluginManager().registerEvents(listener, getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Unregister(Listener listener)
|
||||||
|
{
|
||||||
|
HandlerList.unregisterAll(listener);
|
||||||
|
}
|
||||||
|
|
||||||
public static Plugin getPlugin()
|
public static Plugin getPlugin()
|
||||||
{
|
{
|
||||||
return getPluginManager().getPlugins()[0];
|
return getPluginManager().getPlugins()[0];
|
||||||
@ -116,4 +122,19 @@ public class UtilServer
|
|||||||
{
|
{
|
||||||
runnable.runTaskTimer(getPlugin(), time, time);
|
runnable.runTaskTimer(getPlugin(), time, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean IsOnline(String name)
|
||||||
|
{
|
||||||
|
return !UtilStreams.IsEmpty(getPlayersCollection().stream().filter(player -> player.getName().equals(name)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Player GetPlayer(String name)
|
||||||
|
{
|
||||||
|
return UtilStreams.GetFirst(getPlayersCollection().stream().filter(player -> player.getName().equals(name)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OfflinePlayer GetOffline(String player)
|
||||||
|
{
|
||||||
|
return getServer().getOfflinePlayer(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,9 +82,9 @@ import mineplex.game.clans.clans.commands.RegionsCommand;
|
|||||||
import mineplex.game.clans.clans.data.PlayerClan;
|
import mineplex.game.clans.clans.data.PlayerClan;
|
||||||
import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
|
import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
|
||||||
import mineplex.game.clans.clans.gui.ClanShop;
|
import mineplex.game.clans.clans.gui.ClanShop;
|
||||||
|
import mineplex.game.clans.clans.invsee.Invsee;
|
||||||
import mineplex.game.clans.clans.loot.LootManager;
|
import mineplex.game.clans.clans.loot.LootManager;
|
||||||
import mineplex.game.clans.clans.map.ItemMapManager;
|
import mineplex.game.clans.clans.map.ItemMapManager;
|
||||||
import mineplex.game.clans.clans.nether.NetherManager;
|
|
||||||
import mineplex.game.clans.clans.observer.ObserverManager;
|
import mineplex.game.clans.clans.observer.ObserverManager;
|
||||||
import mineplex.game.clans.clans.playtime.Playtime;
|
import mineplex.game.clans.clans.playtime.Playtime;
|
||||||
import mineplex.game.clans.clans.potato.PotatoManager;
|
import mineplex.game.clans.clans.potato.PotatoManager;
|
||||||
@ -260,6 +260,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
|
|||||||
new TntGeneratorManager(plugin, this);
|
new TntGeneratorManager(plugin, this);
|
||||||
new SupplyDropManager(plugin, this);
|
new SupplyDropManager(plugin, this);
|
||||||
|
|
||||||
|
new Invsee(this);
|
||||||
|
|
||||||
_explosion = new Explosion(plugin, blockRestore);
|
_explosion = new Explosion(plugin, blockRestore);
|
||||||
_warPointEvasion = new WarPointEvasion(plugin);
|
_warPointEvasion = new WarPointEvasion(plugin);
|
||||||
|
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
package mineplex.game.clans.clans;
|
package mineplex.game.clans.clans;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import mineplex.core.common.util.UtilOfflinePlayer;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilWorld;
|
|
||||||
|
|
||||||
public class Test
|
public class Test
|
||||||
{
|
{
|
||||||
public static void main(String[] args) throws IOException
|
public static void main(String[] args) throws IOException
|
||||||
{
|
{
|
||||||
System.out.println(UtilWorld.locToStr(new Location(null, 30, 30, 30)));
|
System.out.println("wtf");
|
||||||
|
UtilOfflinePlayer.loadOfflineInventory(new File("M:/Clans/a797d3ef-dd25-4e18-a002-6537b19b3603.dat"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -927,7 +927,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
DelayedTask.Instance.doDelay(caller, "Home Teleport", new Callback<DelayedTaskClient>() {
|
DelayedTask.Instance.doDelay(caller, "Home Teleport", new Callback<DelayedTaskClient>() {
|
||||||
public void run(DelayedTaskClient player)
|
public void run(DelayedTaskClient player)
|
||||||
{
|
{
|
||||||
Recharge.Instance.use(caller, "Home Teleport", 5 * 60 * 1000, true, false);
|
Recharge.Instance.use(caller, "Home Teleport", 30 * 60 * 1000, true, false);
|
||||||
|
|
||||||
// Do
|
// Do
|
||||||
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
Plugin.getTeleport().TP(caller, clan.getHome().add(0, 1, 0));
|
||||||
@ -945,7 +945,7 @@ public class ClansCommand extends CommandBase<ClansManager>
|
|||||||
{
|
{
|
||||||
UtilPlayer.message(client.getPlayer(), F.main("Clans", "Teleport has been cancelled due to movement."));
|
UtilPlayer.message(client.getPlayer(), F.main("Clans", "Teleport has been cancelled due to movement."));
|
||||||
}
|
}
|
||||||
}, (Plugin.getClanUtility().getClaim(caller.getLocation()) != null ? 30 : 20) * 1000, false);
|
}, 15 * 1000, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void homeSet(Player caller)
|
public void homeSet(Player caller)
|
||||||
|
@ -229,7 +229,7 @@ public class Outpost implements Listener
|
|||||||
Collections.reverse(reverse);
|
Collections.reverse(reverse);
|
||||||
_reverseCircleStages = new LoopIterator<Vector>(reverse);
|
_reverseCircleStages = new LoopIterator<Vector>(reverse);
|
||||||
|
|
||||||
UtilServer.registerEvents(this);
|
UtilServer.RegisterEvents(this);
|
||||||
|
|
||||||
_lifetimeLeft = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 1.5, 0.5), "Despawning in " + F.time(UtilTime.MakeStr(MAX_LIFETIME)));
|
_lifetimeLeft = new Hologram(outpostManager.getClansManager().getHologramManager(), _origin.clone().add(0.5, 1.5, 0.5), "Despawning in " + F.time(UtilTime.MakeStr(MAX_LIFETIME)));
|
||||||
_lifetimeLeft.setInteraction(new HologramInteraction()
|
_lifetimeLeft.setInteraction(new HologramInteraction()
|
||||||
|
@ -144,7 +144,7 @@ public abstract class SiegeWeapon implements Listener
|
|||||||
_infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth());
|
_infoHologram = new Hologram(ClansManager.getInstance().getHologramManager(), _location.clone().add(.5, 3, .5), _name + " Health", getDisplayHealth());
|
||||||
_infoHologram.start();
|
_infoHologram.start();
|
||||||
|
|
||||||
UtilServer.registerEvents(this);
|
UtilServer.RegisterEvents(this);
|
||||||
|
|
||||||
_clans = clansManager;
|
_clans = clansManager;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class BarrierCollisionBox implements Listener
|
|||||||
{
|
{
|
||||||
setBlocks();
|
setBlocks();
|
||||||
|
|
||||||
UtilServer.registerEvents(this);
|
UtilServer.RegisterEvents(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Destruct()
|
public void Destruct()
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.stuck;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
|
|
||||||
public class StuckClient
|
|
||||||
{
|
|
||||||
public Location StartLoc = null;
|
|
||||||
public long UnstickStartTime = -1;
|
|
||||||
public long UnstickEndTime = -1;
|
|
||||||
|
|
||||||
public long getTimeLeft()
|
|
||||||
{
|
|
||||||
return UnstickEndTime - System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,79 +0,0 @@
|
|||||||
package mineplex.game.clans.clans.stuck.commands;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.command.CommandBase;
|
|
||||||
import mineplex.core.common.Rank;
|
|
||||||
import mineplex.core.common.util.Callback;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilTextMiddle;
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
|
||||||
import mineplex.core.delayedtask.DelayedTask;
|
|
||||||
import mineplex.core.delayedtask.DelayedTaskClient;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
|
||||||
import mineplex.game.clans.spawn.Spawn;
|
|
||||||
|
|
||||||
public class ClansSpawnCommand extends CommandBase<Spawn>
|
|
||||||
{
|
|
||||||
public ClansSpawnCommand(Spawn spawn)
|
|
||||||
{
|
|
||||||
super(spawn, Rank.ALL, "spawn", "stuck", "unstick", "unstuck");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Execute(Player caller, String[] args)
|
|
||||||
{
|
|
||||||
if (DelayedTask.Instance.HasTask(caller, "Spawn Teleport"))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You are already teleporting to Spawn."));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Recharge.Instance.usable(caller, "Spawn Teleport", true))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()) != null && !ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).Owner.equals("Borderlands") &&
|
|
||||||
!ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).Owner.equals("Shops") && !ClansManager.getInstance().getClanUtility().getClaim(caller.getLocation()).Owner.equals("Spawn"))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(caller, F.main("Clans", "You must be in the Wilderness/Borderlands/Shops/Spawn to use this command."));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
DelayedTask.Instance.doDelay(caller, "Spawn Teleport", new Callback<DelayedTaskClient>() {
|
|
||||||
public void run(DelayedTaskClient player)
|
|
||||||
{
|
|
||||||
// Do
|
|
||||||
|
|
||||||
if (Math.random() < .5)
|
|
||||||
{
|
|
||||||
caller.teleport(Spawn.getEastSpawn());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
caller.teleport(Spawn.getWestSpawn());
|
|
||||||
}
|
|
||||||
|
|
||||||
Recharge.Instance.use(caller, "Spawn Teleport", 13 * 60 * 1000, false, false);
|
|
||||||
|
|
||||||
// Inform
|
|
||||||
Plugin.getClansManager().getTutorials().sendTutorialMsg(caller, F.main("Clans", "You have been teleported to Spawn."));
|
|
||||||
}
|
|
||||||
}, new Callback<DelayedTaskClient>() {
|
|
||||||
public void run(DelayedTaskClient client)
|
|
||||||
{
|
|
||||||
UtilTextMiddle.display("", "Teleporting to Spawn in " + F.elem(UtilTime.MakeStr(Math.max(0, client.getTimeLeft("Spawn Teleport")))), 0, 5, 0, client.getPlayer());
|
|
||||||
}
|
|
||||||
}, new Callback<DelayedTaskClient>() {
|
|
||||||
public void run(DelayedTaskClient client)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(client.getPlayer(), F.main("Clans", "Teleport has been cancelled due to movement."));
|
|
||||||
}
|
|
||||||
}, 35 * 1000, false);
|
|
||||||
}
|
|
||||||
}
|
|
@ -69,7 +69,7 @@ public class CustomItem implements Listener
|
|||||||
_attributes = new AttributeContainer();
|
_attributes = new AttributeContainer();
|
||||||
_uuid = UUID.randomUUID().toString();
|
_uuid = UUID.randomUUID().toString();
|
||||||
|
|
||||||
UtilServer.registerEvents(this);
|
UtilServer.RegisterEvents(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomItem(Material material)
|
public CustomItem(Material material)
|
||||||
|
@ -73,7 +73,7 @@ public class EnergyCrossbow extends LegendaryItem
|
|||||||
|
|
||||||
private void fire(final Player player)
|
private void fire(final Player player)
|
||||||
{
|
{
|
||||||
UtilServer.registerEvents(new Listener() {
|
UtilServer.RegisterEvents(new Listener() {
|
||||||
private Location _lastLoc;
|
private Location _lastLoc;
|
||||||
|
|
||||||
private Arrow _arrow;
|
private Arrow _arrow;
|
||||||
|
@ -39,11 +39,10 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.common.util.UtilTextMiddle;
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
|
import mineplex.core.common.weight.WeightSet;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.game.clans.clans.ClansManager;
|
import mineplex.game.clans.clans.ClansManager;
|
||||||
import mineplex.game.clans.clans.stuck.commands.ClansSpawnCommand;
|
|
||||||
import mineplex.core.common.weight.WeightSet;
|
|
||||||
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
import mineplex.minecraft.game.classcombat.Skill.event.SkillTriggerEvent;
|
||||||
import mineplex.minecraft.game.classcombat.item.event.WebTossEvent;
|
import mineplex.minecraft.game.classcombat.item.event.WebTossEvent;
|
||||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||||
@ -78,8 +77,6 @@ public class Spawn extends MiniPlugin
|
|||||||
_spawns = new WeightSet<Location>(getEastSpawn(), getWestSpawn());
|
_spawns = new WeightSet<Location>(getEastSpawn(), getWestSpawn());
|
||||||
_shops = new WeightSet<Location>(getNorthTown(), getSouthTown());
|
_shops = new WeightSet<Location>(getNorthTown(), getSouthTown());
|
||||||
_clansManager = clansManager;
|
_clansManager = clansManager;
|
||||||
|
|
||||||
addCommand(new ClansSpawnCommand(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user