Merge branch 'develop' of github.com:Mineplex-LLC/Minecraft-PC into update/skyfall
This commit is contained in:
commit
cf85742583
@ -106,14 +106,14 @@ public class LobbyBalancer implements Listener, Runnable
|
|||||||
InetSocketAddress socketAddress = new InetSocketAddress(server.getPublicAddress(), server.getPort());
|
InetSocketAddress socketAddress = new InetSocketAddress(server.getPublicAddress(), server.getPort());
|
||||||
_plugin.getProxy().getServers().put(server.getName(), _plugin.getProxy().constructServerInfo(server.getName(), socketAddress, "LobbyBalancer", false));
|
_plugin.getProxy().getServers().put(server.getName(), _plugin.getProxy().constructServerInfo(server.getName(), socketAddress, "LobbyBalancer", false));
|
||||||
|
|
||||||
if (server.getName().toUpperCase().startsWith("LOBBY"))
|
if (server.getName().toUpperCase().startsWith("LOBBY-"))
|
||||||
{
|
{
|
||||||
if (server.getMotd() == null || !server.getMotd().contains("Restarting"))
|
if (server.getMotd() == null || !server.getMotd().contains("Restarting"))
|
||||||
{
|
{
|
||||||
_sortedLobbies.add(server);
|
_sortedLobbies.add(server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (server.getName().toUpperCase().startsWith("CLANSHUB"))
|
if (server.getName().toUpperCase().startsWith("CLANSHUB-"))
|
||||||
{
|
{
|
||||||
if (server.getMotd() == null || !server.getMotd().contains("Restarting"))
|
if (server.getMotd() == null || !server.getMotd().contains("Restarting"))
|
||||||
{
|
{
|
||||||
|
@ -14,14 +14,12 @@ public class PlayerJoinHandler implements CommandCallback
|
|||||||
_playerTracker = playerTracker;
|
_playerTracker = playerTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
@Override
|
||||||
public void run(ServerCommand command)
|
public void run(ServerCommand command)
|
||||||
{
|
{
|
||||||
if (command instanceof PlayerJoinCommand)
|
if (command instanceof PlayerJoinCommand)
|
||||||
{
|
{
|
||||||
PlayerJoinCommand joinCommand = (PlayerJoinCommand)command;
|
PlayerJoinCommand joinCommand = (PlayerJoinCommand)command;
|
||||||
|
|
||||||
_playerTracker.kickPlayerIfOnline(UUID.fromString(joinCommand.getUuid()));
|
_playerTracker.kickPlayerIfOnline(UUID.fromString(joinCommand.getUuid()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
package mineplex.bungee.playerTracker;
|
package mineplex.bungee.playerTracker;
|
||||||
|
|
||||||
import java.io.File;
|
import java.util.List;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
import mineplex.serverdata.Region;
|
import mineplex.serverdata.Region;
|
||||||
|
import mineplex.serverdata.commands.PlayerJoinCommand;
|
||||||
import mineplex.serverdata.commands.ServerCommandManager;
|
import mineplex.serverdata.commands.ServerCommandManager;
|
||||||
import mineplex.serverdata.data.DataRepository;
|
import mineplex.serverdata.data.DataRepository;
|
||||||
import mineplex.serverdata.data.PlayerStatus;
|
import mineplex.serverdata.data.PlayerStatus;
|
||||||
import mineplex.serverdata.redis.RedisDataRepository;
|
import mineplex.serverdata.redis.RedisDataRepository;
|
||||||
import mineplex.serverdata.servers.ServerManager;
|
import mineplex.serverdata.servers.ServerManager;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
|
||||||
import net.md_5.bungee.api.event.PostLoginEvent;
|
import net.md_5.bungee.api.event.PostLoginEvent;
|
||||||
@ -20,7 +21,7 @@ import net.md_5.bungee.api.plugin.Listener;
|
|||||||
import net.md_5.bungee.api.plugin.Plugin;
|
import net.md_5.bungee.api.plugin.Plugin;
|
||||||
import net.md_5.bungee.event.EventHandler;
|
import net.md_5.bungee.event.EventHandler;
|
||||||
|
|
||||||
public class PlayerTracker implements Listener, Runnable
|
public class PlayerTracker implements Listener
|
||||||
{
|
{
|
||||||
// Default period before status expiry (8 hours)
|
// Default period before status expiry (8 hours)
|
||||||
private static final int DEFAULT_STATUS_TIMEOUT = 60 * 60 * 8;
|
private static final int DEFAULT_STATUS_TIMEOUT = 60 * 60 * 8;
|
||||||
@ -28,24 +29,29 @@ public class PlayerTracker implements Listener, Runnable
|
|||||||
// Repository storing player status' across network.
|
// Repository storing player status' across network.
|
||||||
private DataRepository<PlayerStatus> _repository;
|
private DataRepository<PlayerStatus> _repository;
|
||||||
|
|
||||||
private Set<UUID> _onlineUUIDs = new HashSet<>();
|
|
||||||
|
|
||||||
private Plugin _plugin;
|
private Plugin _plugin;
|
||||||
|
|
||||||
|
private final List<UUID> _ignoreKick = Lists.newArrayList();
|
||||||
|
|
||||||
public PlayerTracker(Plugin plugin)
|
public PlayerTracker(Plugin plugin)
|
||||||
{
|
{
|
||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
|
|
||||||
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
|
_plugin.getProxy().getPluginManager().registerListener(_plugin, this);
|
||||||
_plugin.getProxy().getScheduler().schedule(_plugin, this, 1L, 1L, TimeUnit.MINUTES);
|
|
||||||
|
|
||||||
_repository = new RedisDataRepository<PlayerStatus>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
_repository = new RedisDataRepository<PlayerStatus>(ServerManager.getMasterConnection(), ServerManager.getSlaveConnection(),
|
||||||
Region.currentRegion(), PlayerStatus.class, "playerStatus");
|
Region.currentRegion(), PlayerStatus.class, "playerStatus");
|
||||||
|
|
||||||
ServerCommandManager.getInstance().registerCommandType("PlayerJoinCommand", mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this));
|
ServerCommandManager.getInstance().initializeServer("BUNGEE ENABLE - " + System.currentTimeMillis());
|
||||||
|
ServerCommandManager.getInstance().registerCommandType(mineplex.serverdata.commands.PlayerJoinCommand.class, new PlayerJoinHandler(this));
|
||||||
|
|
||||||
System.out.println("Initialized PlayerTracker.");
|
System.out.println("Initialized PlayerTracker.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Plugin getPlugin()
|
||||||
|
{
|
||||||
|
return _plugin;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerConnect(final ServerConnectedEvent event)
|
public void playerConnect(final ServerConnectedEvent event)
|
||||||
@ -70,42 +76,32 @@ public class PlayerTracker implements Listener, Runnable
|
|||||||
_repository.removeElement(event.getPlayer().getName().toLowerCase());
|
_repository.removeElement(event.getPlayer().getName().toLowerCase());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
_onlineUUIDs.remove(event.getPlayer().getUniqueId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void playerConnect(final PostLoginEvent event)
|
public void playerConnect(final PostLoginEvent event)
|
||||||
{
|
{
|
||||||
_onlineUUIDs.add(event.getPlayer().getUniqueId());
|
_ignoreKick.add(event.getPlayer().getUniqueId());
|
||||||
}
|
PlayerJoinCommand command = new PlayerJoinCommand(event.getPlayer().getUniqueId());
|
||||||
|
command.publish();
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
Set<UUID> onlineUUIDs = new HashSet<>();
|
|
||||||
|
|
||||||
for (ProxiedPlayer player : _plugin.getProxy().getPlayers())
|
|
||||||
{
|
|
||||||
onlineUUIDs.add(player.getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
_onlineUUIDs = onlineUUIDs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlayerOnline(UUID uuid)
|
public boolean isPlayerOnline(UUID uuid)
|
||||||
{
|
{
|
||||||
return _onlineUUIDs.contains(uuid);
|
return _plugin.getProxy().getPlayer(uuid) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void kickPlayerIfOnline(UUID uuid)
|
public void kickPlayerIfOnline(UUID uuid)
|
||||||
{
|
{
|
||||||
if (_onlineUUIDs.contains(uuid))
|
if (_ignoreKick.remove(uuid))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isPlayerOnline(uuid))
|
||||||
{
|
{
|
||||||
ProxiedPlayer player = _plugin.getProxy().getPlayer(uuid);
|
ProxiedPlayer player = _plugin.getProxy().getPlayer(uuid);
|
||||||
|
|
||||||
if (player != null)
|
player.disconnect(new TextComponent("You have logged in from another location."));
|
||||||
player.disconnect("You have logged in from another location.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,12 @@ public class AnimationPoint
|
|||||||
return _tick;
|
return _tick;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "AnimationPoint[tick" + _tick + ", motion:[" + _move + "], dir:[" + _dir + "]]";
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.core.common.animation;
|
package mineplex.core.common.animation;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.PriorityQueue;
|
import java.util.PriorityQueue;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -36,6 +37,11 @@ public abstract class Animator
|
|||||||
_plugin = plugin;
|
_plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addPoints(Collection<AnimationPoint> points)
|
||||||
|
{
|
||||||
|
for(AnimationPoint p : points) _points.add(p);
|
||||||
|
}
|
||||||
|
|
||||||
public void addPoint(AnimationPoint point) {
|
public void addPoint(AnimationPoint point) {
|
||||||
_points.add(point);
|
_points.add(point);
|
||||||
}
|
}
|
||||||
@ -48,7 +54,9 @@ public abstract class Animator
|
|||||||
* @return Returns a cloned list of the animator points for this instance.
|
* @return Returns a cloned list of the animator points for this instance.
|
||||||
*/
|
*/
|
||||||
public Set<AnimationPoint> getSet() {
|
public Set<AnimationPoint> getSet() {
|
||||||
return new HashSet<AnimationPoint>(_points);
|
Set<AnimationPoint> set = new HashSet<>();
|
||||||
|
set.addAll(_points);
|
||||||
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -110,6 +118,7 @@ public abstract class Animator
|
|||||||
prev.setDirection(_prev.getDirection());
|
prev.setDirection(_prev.getDirection());
|
||||||
|
|
||||||
double diff = ((double)_tick-_prev.getTick())/(_next.getTick()-_prev.getTick());
|
double diff = ((double)_tick-_prev.getTick())/(_next.getTick()-_prev.getTick());
|
||||||
|
if(!Double.isFinite(diff)) diff = 0;
|
||||||
prev.add(next.clone().subtract(prev).toVector().multiply(diff));
|
prev.add(next.clone().subtract(prev).toVector().multiply(diff));
|
||||||
|
|
||||||
Vector dirDiff = _next.getDirection().subtract(prev.getDirection());
|
Vector dirDiff = _next.getDirection().subtract(prev.getDirection());
|
||||||
|
@ -35,5 +35,10 @@ public class AnimatorEntity extends Animator
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void finish(Location loc) {}
|
protected void finish(Location loc) {}
|
||||||
|
|
||||||
|
public Entity getEntity()
|
||||||
|
{
|
||||||
|
return _ent;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
package mineplex.core.common.animation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A small factory class to build animations using location inputs with embedded directions. It then calculates the vector difference
|
||||||
|
* between the locations in an ordered fashion when building the list.
|
||||||
|
*/
|
||||||
|
public class AnimatorFactory
|
||||||
|
{
|
||||||
|
|
||||||
|
private Map<Integer, Location> _locations = new HashMap<>();
|
||||||
|
|
||||||
|
public void addLocation(Location loc, int tick)
|
||||||
|
{
|
||||||
|
_locations.put(tick, loc.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AnimationPoint> getBuildList(Location base)
|
||||||
|
{
|
||||||
|
List<AnimationPoint> list = new ArrayList<>();
|
||||||
|
|
||||||
|
Iterator<Entry<Integer, Location>> it = _locations.entrySet().stream()
|
||||||
|
.sorted((e1, e2)
|
||||||
|
-> Integer.compare(e1.getKey(), e2.getKey())
|
||||||
|
)
|
||||||
|
.iterator();
|
||||||
|
|
||||||
|
while(it.hasNext())
|
||||||
|
{
|
||||||
|
Entry<Integer, Location> e = it.next();
|
||||||
|
Vector diff = e.getValue().clone().subtract(base).toVector();
|
||||||
|
|
||||||
|
list.add(new AnimationPoint(e.getKey(), diff, e.getValue().getDirection()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,12 +5,17 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import net.minecraft.server.v1_8_R3.Entity;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityTypes;
|
||||||
|
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||||
|
import net.minecraft.server.v1_8_R3.NBTTagInt;
|
||||||
|
import net.minecraft.server.v1_8_R3.TileEntity;
|
||||||
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
|
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
@ -23,12 +28,6 @@ import com.java.sk89q.jnbt.Tag;
|
|||||||
import mineplex.core.common.block.DataLocationMap;
|
import mineplex.core.common.block.DataLocationMap;
|
||||||
import mineplex.core.common.util.MapUtil;
|
import mineplex.core.common.util.MapUtil;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import net.minecraft.server.v1_8_R3.Entity;
|
|
||||||
import net.minecraft.server.v1_8_R3.EntityTypes;
|
|
||||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
|
||||||
import net.minecraft.server.v1_8_R3.NBTTagInt;
|
|
||||||
import net.minecraft.server.v1_8_R3.TileEntity;
|
|
||||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
|
||||||
|
|
||||||
public class Schematic
|
public class Schematic
|
||||||
{
|
{
|
||||||
|
@ -5,19 +5,20 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.mojang.authlib.minecraft.InsecureTextureException;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.minecraft.InsecureTextureException;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
|
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
|
||||||
public class SkinData
|
public class SkinData
|
||||||
{
|
{
|
||||||
@ -57,10 +58,10 @@ public class SkinData
|
|||||||
public final static SkinData UNCLE_SAM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjYxODA0NjY4NTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "NmJ+hXmvwQlYFYY7YVQWRr11yBbAfJP+jk11SQ91gUUtJJjb4v8RFbNu5UXNCKxYj3BPtldqshG1maNB0NWJRud7ZyAdHc0JMmR1vtHEge9Hhet4fLyyaZ9rZn4BvD9Guqgv9H/mZzUzrft9TIho0Qbu/U++lVsbZXC2GrJDDMyLnYr9C7f+FUnr0z4WvkNcg23SHBOYkOYT95NSdykIka3c3v+/HvSvuwOnMsfVxqLyCZLpo20vamBJ1uK1dmx2+TVGnUPlofFHRdOXOpJc+YmicJvrsQR6a9zlvnTbU4MYClMOKvjLe6aX5Af+n8Gw3oKcm0PuR8CPLyf9kjcmUF6XMiEXAWWJtCgvhCiFV5/mQQH3cQ1kqk4BDLUxMVhG5tzjKLoQQy39cFM32ee+QFjXlzy59meC8jgvPmOVU3GpJ32XWOtaXMCyeJrhz2QVKRLEr2KZgz8Pd8VrHARXVZsNYEasj8z0cHjgSJqTU9kD90CC+4YpvdyRBRqbNQig5KuGCqUHKgflsEsM7YrFRKP5As1LgqYQfqRAMmLSo47eW0onOwchC9wCqqisPlYSuDRt4Mun/KFGqYh1Sghn8/gzu49La8BpwlekjVEoPEcDaIIgnFzOvgmmgMANkoJ3PzhHoHMoXtObe3eSTi+eYp4qAQVzkTxfF3WXY2fui1M=");
|
public final static SkinData UNCLE_SAM = new SkinData("eyJ0aW1lc3RhbXAiOjE0NjYxODA0NjY4NTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9jYzM1YWRmZTQ3ODBjNmU2NTk4YTJlYzk2ZjdhZGQ5ZDc4NjljMjBlZjRmYjEyNjk2NmJhOGFlMDRlOWRhIn19fQ==", "NmJ+hXmvwQlYFYY7YVQWRr11yBbAfJP+jk11SQ91gUUtJJjb4v8RFbNu5UXNCKxYj3BPtldqshG1maNB0NWJRud7ZyAdHc0JMmR1vtHEge9Hhet4fLyyaZ9rZn4BvD9Guqgv9H/mZzUzrft9TIho0Qbu/U++lVsbZXC2GrJDDMyLnYr9C7f+FUnr0z4WvkNcg23SHBOYkOYT95NSdykIka3c3v+/HvSvuwOnMsfVxqLyCZLpo20vamBJ1uK1dmx2+TVGnUPlofFHRdOXOpJc+YmicJvrsQR6a9zlvnTbU4MYClMOKvjLe6aX5Af+n8Gw3oKcm0PuR8CPLyf9kjcmUF6XMiEXAWWJtCgvhCiFV5/mQQH3cQ1kqk4BDLUxMVhG5tzjKLoQQy39cFM32ee+QFjXlzy59meC8jgvPmOVU3GpJ32XWOtaXMCyeJrhz2QVKRLEr2KZgz8Pd8VrHARXVZsNYEasj8z0cHjgSJqTU9kD90CC+4YpvdyRBRqbNQig5KuGCqUHKgflsEsM7YrFRKP5As1LgqYQfqRAMmLSo47eW0onOwchC9wCqqisPlYSuDRt4Mun/KFGqYh1Sghn8/gzu49La8BpwlekjVEoPEcDaIIgnFzOvgmmgMANkoJ3PzhHoHMoXtObe3eSTi+eYp4qAQVzkTxfF3WXY2fui1M=");
|
||||||
public final static SkinData METAL_MAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTExNTk3OTQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDdlOGQ3MmI0MzI3MjIzZmI1ZjI5OWViN2NiNTVhMTU4OTM4MGYxMWE2ZDIzYmVmZTQ1OWFjNzg3YWY2YTcifX19", "EYXUVtnqtDhaSjBE313TpxriRtW0X7wNdmVR0ARa9qvE8CtP//AhnNxyKkERue1XIyefrYApzM4DWGzU5ZvzraOXg98p/3PSFW5p0PAp14ud/1uJWoq0FuEiJDn7Qo/+K0cuoCVsAn6Bx8nWexxr0XB8ANq/0vpRZpDOPO+irFFGwF8CPbt+7sh09glaHD9q7CM4JzPXrNjLt+ZkhYt7wEuevCXuOONT50tH0BlmfHajs9ai0IiwEwC3R+o0DooMVdCViuVEKWQfMnBDNHN4ZLwEazAcRiFO4VXOG0k/+dbKfX0EwnnygN0qmHKyhQeuR7PUumaRUMHn7sCvWmvgpNzzJMv4f9Biw2SWSI2gpaxHdCoCfFMjCdal+/BbXue6jCvDYq6yQEu+C9BjB3vT633/mbXZZMCl7bRjBzqG/jfeI1ove9o0oSqc4Nx3aA1cOnRE2iMEE74ChgY/sVk4aRVx+GTxKtyRGSzt2V7AvOVlfJh17FQhT/PkiztJ6L1RFLsFKaxQxyiCPgZSXpQ4Dz0iPonxFZl0FjAluElHYb3zn4Uop9sPBqOIeskVUl9zbdlRb7CgDG8a57YkUfs7ZyzzYYmZyt6t08H/PQr++cflY0kfy9eOBDmf9gtes7FLrHHRTE6GJ1+xAkLi5gNEkEUZKZy2embgI5JzuwCIIY8=");
|
public final static SkinData METAL_MAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTExNTk3OTQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84ZDdlOGQ3MmI0MzI3MjIzZmI1ZjI5OWViN2NiNTVhMTU4OTM4MGYxMWE2ZDIzYmVmZTQ1OWFjNzg3YWY2YTcifX19", "EYXUVtnqtDhaSjBE313TpxriRtW0X7wNdmVR0ARa9qvE8CtP//AhnNxyKkERue1XIyefrYApzM4DWGzU5ZvzraOXg98p/3PSFW5p0PAp14ud/1uJWoq0FuEiJDn7Qo/+K0cuoCVsAn6Bx8nWexxr0XB8ANq/0vpRZpDOPO+irFFGwF8CPbt+7sh09glaHD9q7CM4JzPXrNjLt+ZkhYt7wEuevCXuOONT50tH0BlmfHajs9ai0IiwEwC3R+o0DooMVdCViuVEKWQfMnBDNHN4ZLwEazAcRiFO4VXOG0k/+dbKfX0EwnnygN0qmHKyhQeuR7PUumaRUMHn7sCvWmvgpNzzJMv4f9Biw2SWSI2gpaxHdCoCfFMjCdal+/BbXue6jCvDYq6yQEu+C9BjB3vT633/mbXZZMCl7bRjBzqG/jfeI1ove9o0oSqc4Nx3aA1cOnRE2iMEE74ChgY/sVk4aRVx+GTxKtyRGSzt2V7AvOVlfJh17FQhT/PkiztJ6L1RFLsFKaxQxyiCPgZSXpQ4Dz0iPonxFZl0FjAluElHYb3zn4Uop9sPBqOIeskVUl9zbdlRb7CgDG8a57YkUfs7ZyzzYYmZyt6t08H/PQr++cflY0kfy9eOBDmf9gtes7FLrHHRTE6GJ1+xAkLi5gNEkEUZKZy2embgI5JzuwCIIY8=");
|
||||||
public final static SkinData OMEGA_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzI1MTAzNzAwOTksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85MDM2MjNjMmRkMjdhNWM0Y2NlYzY5MWY3NjM0YTNkMzVkNTRiNDg0YjIzNTdhNWQ1ZWFmYmYwNTRkY2NlIn19fQ==", "cQty4zNF2QgzNuVOHTGGX5YVofApKr01KkQ70bO1n+I9nlkc9qqhcigA+uBYdw4THANFsTRwIrskgTS3TTmuaXYmMUoNnj7gr2Gp7D2t7L53QyJJhIw0hHNDvQucf19SOxhtR9FvW+xnh1JcgOTF3VZxIeRaN4bCtqkeFitCJwts4Z7SlDxB4EFZVsifM+gK4iel9YWYGNnZiQm48lxU+dMFd0cCa4L00ngBExQoWC8zbJc3K9LGdqI1YOMh3bCt81F4jcrPnDycxWwOTj/tBri4yeXK1htq5dAixHwq1EF86gQMnfeIIk6D/BREtVKoXK9K4lstYPHLFiBqkwpijArbC0sZp8s/j88NYUz9PgSJ2z/b5jhPChH2OkoGQOL0/QrxqUZUet+WHaIQtvFoqmcFRCKJQembgJGZV0X86XQxEEtevkNgXPigJVyQ5GVuDCeowRkMGfSadQCBsnmdOVZNshS60tBSDcbd2oWeQUJn1+OJkmz+OktbMbP4ttN6x3+MPMSZoGT1bc1BSRNFRYOBZuNz1zLWsHFRyNLaVS3ep/ktE+Rt5sbapo+r4GjrKGV7Unx6pbfoxcnMVxWZ9X/sMgztQdwYEQlnvAxGvCY/1ZIm3/izqB2zAgG7ZfWzKjU2P5VseKokMjHXrzZX9Uqtn0zpITEaG5HjUpRSaJg=");
|
public final static SkinData OMEGA_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzI1MTAzNzAwOTksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85MDM2MjNjMmRkMjdhNWM0Y2NlYzY5MWY3NjM0YTNkMzVkNTRiNDg0YjIzNTdhNWQ1ZWFmYmYwNTRkY2NlIn19fQ==", "cQty4zNF2QgzNuVOHTGGX5YVofApKr01KkQ70bO1n+I9nlkc9qqhcigA+uBYdw4THANFsTRwIrskgTS3TTmuaXYmMUoNnj7gr2Gp7D2t7L53QyJJhIw0hHNDvQucf19SOxhtR9FvW+xnh1JcgOTF3VZxIeRaN4bCtqkeFitCJwts4Z7SlDxB4EFZVsifM+gK4iel9YWYGNnZiQm48lxU+dMFd0cCa4L00ngBExQoWC8zbJc3K9LGdqI1YOMh3bCt81F4jcrPnDycxWwOTj/tBri4yeXK1htq5dAixHwq1EF86gQMnfeIIk6D/BREtVKoXK9K4lstYPHLFiBqkwpijArbC0sZp8s/j88NYUz9PgSJ2z/b5jhPChH2OkoGQOL0/QrxqUZUet+WHaIQtvFoqmcFRCKJQembgJGZV0X86XQxEEtevkNgXPigJVyQ5GVuDCeowRkMGfSadQCBsnmdOVZNshS60tBSDcbd2oWeQUJn1+OJkmz+OktbMbP4ttN6x3+MPMSZoGT1bc1BSRNFRYOBZuNz1zLWsHFRyNLaVS3ep/ktE+Rt5sbapo+r4GjrKGV7Unx6pbfoxcnMVxWZ9X/sMgztQdwYEQlnvAxGvCY/1ZIm3/izqB2zAgG7ZfWzKjU2P5VseKokMjHXrzZX9Uqtn0zpITEaG5HjUpRSaJg=");
|
||||||
public final static SkinData HEADLESS_HORSEMAN = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM4ODc2MjAzODksInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZGM2M2M5NWFjOTA1YjEyMWU5YTE3NmY5ZDFiN2M0MDc2ZGJjMTk3NzhkYjgzMzBlOWIzNTdhOTQ3MzMxZCJ9fX0=", "pQgM6o3nO6+NaxEmkoK33gQefe726HeVA5TVcbnGRY99S8l1UVlTu1W9Unc4IczHRYZ29I75aXUz6UDA7kIRQj4NOQHBXOxlw4cah34WkDECXYwKbgcM3HkRI/JGQf6Uooe5Mz/IaWlisEdXp9i7+WPeqz1qvzwuJ2jUqF8gaJyCbgKSWE8135k+YwinFVA78+so5meRZ6qBNfSeU48Bhf9j3H+Jmq/vwi9EJGDXKAzjYSufdYWQA7gXJQHiUFVgVKSC0wBAMHBVK7ABE2g5GIaLxOfjhOKN8Gdea9dqOUN+uXrGvg7uHxJd9Obw7MbBDVPgXnYDWYDU18DAWJcGVA8tnuPnN2a+mQrbTn9UPftYReUYJA4zpkfEKkljW6lkQ5DkVN/ueQg9QDYjxvjLblSyKHV8lX/ATt4aGiQrCcaQn6c8EeLWijPwozO+pI3MX26ydF8l+B9lTvGvQOqfUS4+TgEI5SEKlKFF4i6rTBAYCHAH8uXry7fZQDoIkcpWiB5b+e7Tr29WoScyFNuR3BMIh0Nky1TPadLxxhkqht8o9AXtccYOmtoMMh06kKWZK5m8w16j+VTUNDYwTV+jxtSFBMh4FPuiH+TzpeHY6P2Cb4gT2UlozWj8ZxZHYIGbYXAFOlDT8IQmRh5zyrXeAZrwoXJPP2OoXl31roChTxw=");
|
|
||||||
public final static SkinData GHOST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5NjQxOTY3ODYsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84NjViODU3N2NlNmFhYzY4N2IxNGQ0ZGIzYmQ1MGU1NjdlZGY4Njc4MDU3ZWM2NjMyZDcxMDQ4MzFhNDk3MmIifX19", "J3nw3OIZYuYxbhOKgPGL+Kn4kWv9cjEB9ygBD07xVJUY/rdPW/BeE15qKpZQt5d8kjj0VGp1Q7g3uIS24NuiQxDZ82l1GT4dLyUN2eOj0im6VGA2yXrnGPaedfu1oPAiG+STFq0ST2IYQKYuOcncsdovxHLrpNHF6ud3WJMnSOYSfAX5NOny1UNkswzCN2OCX+QzW9hwQ+gKOc2U6g47hIcpBcTNlmD3lqXjP7OTn0Ul3kJG5J3lnwBkPnNI5OV9+oI9OWs/fbTee3pK6UVHjgH2w+fO/0jlRnShw7o1BKv/ILBkWZYuq31YiAMWKRm508SS3+kjqU37t6mqBc9AUcAeKfR4G6UiW18+eRfDPaaSnY2mTBwD3boWHYI7fM7pnPF1LmSxwSa9QSu3wsrYF9ID0QI7vyyrPIeZU/eUXE+WbFZ+Nuo/2LlZMjUmcLWa/SuuPo6lA5zJtgkVc/Rgkph+s/sZnPwgeHTFmCr2VJqgWg+J9dnO/fLPkddgzjoy5uOCAO70E/cwbpqGxKD+0iQU0Vk9TzQnCMAUDtzeoyNkuk204cDSqPKtH5JIoQHa6wFAEgaKZoSETBJMZmKzZhne5pVr+NVkmGHOuZ/uE6JH1F4T+vTeeLSEroPDhrNfwVtrrqBFnI/xijfEHdPmtP9OTSDju7MHnEZu4RS7y6Q=");
|
public final static SkinData GHOST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5NjQxOTY3ODYsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS84NjViODU3N2NlNmFhYzY4N2IxNGQ0ZGIzYmQ1MGU1NjdlZGY4Njc4MDU3ZWM2NjMyZDcxMDQ4MzFhNDk3MmIifX19", "J3nw3OIZYuYxbhOKgPGL+Kn4kWv9cjEB9ygBD07xVJUY/rdPW/BeE15qKpZQt5d8kjj0VGp1Q7g3uIS24NuiQxDZ82l1GT4dLyUN2eOj0im6VGA2yXrnGPaedfu1oPAiG+STFq0ST2IYQKYuOcncsdovxHLrpNHF6ud3WJMnSOYSfAX5NOny1UNkswzCN2OCX+QzW9hwQ+gKOc2U6g47hIcpBcTNlmD3lqXjP7OTn0Ul3kJG5J3lnwBkPnNI5OV9+oI9OWs/fbTee3pK6UVHjgH2w+fO/0jlRnShw7o1BKv/ILBkWZYuq31YiAMWKRm508SS3+kjqU37t6mqBc9AUcAeKfR4G6UiW18+eRfDPaaSnY2mTBwD3boWHYI7fM7pnPF1LmSxwSa9QSu3wsrYF9ID0QI7vyyrPIeZU/eUXE+WbFZ+Nuo/2LlZMjUmcLWa/SuuPo6lA5zJtgkVc/Rgkph+s/sZnPwgeHTFmCr2VJqgWg+J9dnO/fLPkddgzjoy5uOCAO70E/cwbpqGxKD+0iQU0Vk9TzQnCMAUDtzeoyNkuk204cDSqPKtH5JIoQHa6wFAEgaKZoSETBJMZmKzZhne5pVr+NVkmGHOuZ/uE6JH1F4T+vTeeLSEroPDhrNfwVtrrqBFnI/xijfEHdPmtP9OTSDju7MHnEZu4RS7y6Q=");
|
||||||
public final static SkinData HAUNTED_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzUyNTUzOTE3OTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lZWM5MmU4ODNiOGFjODI0MDU5YTk5NGM5NTNjNTQ0NDQ0Yjk3ZWFkZDdhNWFjNGY3ZTZhOTUxOGQ5YTkxMSJ9fX0=", "GqycEQvWoZeXDLAJ6ricUx3coA4Y6AswL0GV1KebetoTkd9XNtkJJ9eUf6ViwpSgmL0H89sdMjghThHKczUEmjaFeNl2Z9cwGnR1WOK3KpD+v8C7f10l2DNd7z8s1clJfkVay/5KkgNMneu+ZStF8mCt+uyOSfZX4toLRBba6ZDaz4RlmcNt3e6h+dCaB/npbrWxddX7YZWsAMEKxmMKrG/Rm1Gx7ZOchmd4l6+pypA3Vrjoc0LVjqDV/TsePiNxV9LWFB7Rc6YGkIyz2+z5m168iLnn4+qMMXOYndwH7RGcTLEJDPRfNjawuPNcRlYZ6bf30S540MQdC0dJbRLu0uT9CAyi1vjxezdKjGJZSiY5WmtWrhkiRRtCMr9fGxBRNxPDdf5bs7IgWClFgafkGFZKZjLlOV8qtlMrPQSduPtGBCM64veJchSMFS6MfxgE2O/+4EZ246ZN1bdV6KiLRDIzFmy9PBn2o6MNtcdFc/G5XdD7aCTwuGD6sbG2T97Aiai56CN1vYsc6yXUfeZafSm6qviXAx3zTEd1aw1oAZLj3PAt0uZRHggsBEKvwPVKsgHsOVFj5vu0BfHFbdaSdhL3GFotk06Ilr5cLxOrTwqoVNp/hiIJ8pu7T0AEWy1pMYD1+RszsTjJ76l305cQ3UHvinjnbXllsFQIIVE899s=");
|
public final static SkinData HAUNTED_CHEST = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzUyNTUzOTE3OTcsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lZWM5MmU4ODNiOGFjODI0MDU5YTk5NGM5NTNjNTQ0NDQ0Yjk3ZWFkZDdhNWFjNGY3ZTZhOTUxOGQ5YTkxMSJ9fX0=", "GqycEQvWoZeXDLAJ6ricUx3coA4Y6AswL0GV1KebetoTkd9XNtkJJ9eUf6ViwpSgmL0H89sdMjghThHKczUEmjaFeNl2Z9cwGnR1WOK3KpD+v8C7f10l2DNd7z8s1clJfkVay/5KkgNMneu+ZStF8mCt+uyOSfZX4toLRBba6ZDaz4RlmcNt3e6h+dCaB/npbrWxddX7YZWsAMEKxmMKrG/Rm1Gx7ZOchmd4l6+pypA3Vrjoc0LVjqDV/TsePiNxV9LWFB7Rc6YGkIyz2+z5m168iLnn4+qMMXOYndwH7RGcTLEJDPRfNjawuPNcRlYZ6bf30S540MQdC0dJbRLu0uT9CAyi1vjxezdKjGJZSiY5WmtWrhkiRRtCMr9fGxBRNxPDdf5bs7IgWClFgafkGFZKZjLlOV8qtlMrPQSduPtGBCM64veJchSMFS6MfxgE2O/+4EZ246ZN1bdV6KiLRDIzFmy9PBn2o6MNtcdFc/G5XdD7aCTwuGD6sbG2T97Aiai56CN1vYsc6yXUfeZafSm6qviXAx3zTEd1aw1oAZLj3PAt0uZRHggsBEKvwPVKsgHsOVFj5vu0BfHFbdaSdhL3GFotk06Ilr5cLxOrTwqoVNp/hiIJ8pu7T0AEWy1pMYD1+RszsTjJ76l305cQ3UHvinjnbXllsFQIIVE899s=");
|
||||||
public final static SkinData WITCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTEyMTE1NDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NDg1ZDZlMTBhNmNmMmY3Mzg2NmZhMGRiNjEzOWQ5NWViZDM0ZGZiMGY0YzAxMmRkM2YzYWYxMWQ5ZjQxYyJ9fX0=", "cojkGLflVWxwnhDXmHMke7crkeA78iUYOWY7H3YvMJFD+VZi9E7vUahLTTx5ELH+PvcaHJerSDmuV+Nasc3K2n6zlXXb0B7RB/ose/kdPxHAIJee7IbZX0iFNDn6irUSOS4wOYF/BwaqG3HmpoSxV52SGMs6kqTer2Rjg3X+XwYFFiDHAR/gwhfXLzrM1iBc171vgu6T+kx65iBHa/YB/V/mj8FSxwM0f5IsLpgAEdxDL9PvEKQWgWeZ1CAqEXlGnjPkd9oGzW0TgDz2MksBbYZ2kmn/S53kK9vCrVB7egZPS4VBtKpq1P7Jeu8rtgjnAKVFQJZ2lMHnVRuvGTd8JKoPHarUPpU2LURUMaCtHzSv9v/4gjkafnDhqxG4TTcr5hxFV+ho72HQchoeaUXzIO+Yo71zrVqkrS0hw6OtgMIBlvaGaEUsFvGiCZePBEiHojO43AKqJcJAVeT2RAzHcAaBAO79ACGjNKw/oj02rOurLha9i+99bKui96Eg7SS/nPchbmu5YQ9nSpkW+JeYXnBzGGzNG4y02VWgz15L718+8161zXobhuK07qlY9i1nipFbEJedqG0cfS+AUzauETFvS9nMtxhtftYPCIxm40GQj6e77asNCAEElGssaUGKO3bjm348+oF9tR/eBOYWJQ8kL46IQLDRoop7UhG4ewY=");
|
public final static SkinData WITCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTEyMTE1NDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NDg1ZDZlMTBhNmNmMmY3Mzg2NmZhMGRiNjEzOWQ5NWViZDM0ZGZiMGY0YzAxMmRkM2YzYWYxMWQ5ZjQxYyJ9fX0=", "cojkGLflVWxwnhDXmHMke7crkeA78iUYOWY7H3YvMJFD+VZi9E7vUahLTTx5ELH+PvcaHJerSDmuV+Nasc3K2n6zlXXb0B7RB/ose/kdPxHAIJee7IbZX0iFNDn6irUSOS4wOYF/BwaqG3HmpoSxV52SGMs6kqTer2Rjg3X+XwYFFiDHAR/gwhfXLzrM1iBc171vgu6T+kx65iBHa/YB/V/mj8FSxwM0f5IsLpgAEdxDL9PvEKQWgWeZ1CAqEXlGnjPkd9oGzW0TgDz2MksBbYZ2kmn/S53kK9vCrVB7egZPS4VBtKpq1P7Jeu8rtgjnAKVFQJZ2lMHnVRuvGTd8JKoPHarUPpU2LURUMaCtHzSv9v/4gjkafnDhqxG4TTcr5hxFV+ho72HQchoeaUXzIO+Yo71zrVqkrS0hw6OtgMIBlvaGaEUsFvGiCZePBEiHojO43AKqJcJAVeT2RAzHcAaBAO79ACGjNKw/oj02rOurLha9i+99bKui96Eg7SS/nPchbmu5YQ9nSpkW+JeYXnBzGGzNG4y02VWgz15L718+8161zXobhuK07qlY9i1nipFbEJedqG0cfS+AUzauETFvS9nMtxhtftYPCIxm40GQj6e77asNCAEElGssaUGKO3bjm348+oF9tR/eBOYWJQ8kL46IQLDRoop7UhG4ewY=");
|
||||||
|
public final static SkinData TURKEY = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzU3NzM2MTc5MDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8xYzdmYjczMTRkNmY1ZTMzNmVjN2ViNTI1ZGM0ODMzOWNhMjI4ZDk3ODU1MDM3ZDZhNDIwOGZjNzYwNDc1NiJ9fX0=", "eZWi1LOD8ke7MCUAfhspBCnyfCoGM8suFLKtbW6b27CURoRBG3eKIfwLYYeMp3ObjoZ8gCB90s28Qyw5XMzwvvowy9W/b5cYC0OzQ8+GR7tDZoWc28tGqGBM8cmDJIFQgZdceBIIr2lXeAvEJfLbyrus46hPjk8YTiQW2DsBq88BhKIy6Igb1rGqJ1goVERF07b6+/yMdLKCaT8OZFzKLXfo5rY5gr6HLnvsQiNL9aTrl74agXn1GUcP+QVNe7/c9lYmv5vLCBst1YiIPq27NZASZ++Fwyv6+PRlaFZZYtMHVd4UZeYPl7ak1Cdi/1sUcRpkBbJM8AHIrqq0iuXxrLbc6ldQ2cYQKHg9ljIpW/EZanuf6Wgm/LK1JnxXne9GUb/xPzB1EnZ95i8/u9WJa+NixEcfc3pAzDPYncIR8lishFwyBRta6BCG76U3UY2lQr3YD/48AJ49r7+WVU0gOP/h2SDSdAZHEdvkpVJ0w/xA+SevJ7Y7xA5EJ655YMQ0F8f3WUFTf1pFklE5E+fwkMVCWOPw7UMy558IcRSpdWAPPyf8sc7CpDqRk37/vXWRDa+7YBfgskK6B2eXowrzThUOBx+AmDTF3Rv8ZSr1Un0FWGi+GQ5ny7W9dJBMomzyMUbzz9stsCml5XB+6xLP2MD+9lO1bHipKS6qkhtZChE=");
|
||||||
|
|
||||||
// Comments this out for now, so it doesn't load the player profile
|
// Comments this out for now, so it doesn't load the player profile
|
||||||
// A better way to do this would check for the properties when getting the skull or the skin
|
// A better way to do this would check for the properties when getting the skull or the skin
|
||||||
|
@ -0,0 +1,233 @@
|
|||||||
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
|
import org.apache.commons.lang3.Validate;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.WeakHashMap;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
public class PlayerMap<V> implements Map<UUID, V>
|
||||||
|
{
|
||||||
|
private static final Object LOCK = new Object();
|
||||||
|
|
||||||
|
private static final RemovalListener REMOVAL_LISTENER = new RemovalListener();
|
||||||
|
private static final Set<PlayerMap<?>> ALL_PLAYER_MAPS = Sets.newSetFromMap(new WeakHashMap<>());
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
UtilServer.RegisterEvents(REMOVAL_LISTENER);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Map<UUID, V> _backingMap;
|
||||||
|
|
||||||
|
private PlayerMap(Map<UUID, V> backingMap)
|
||||||
|
{
|
||||||
|
this._backingMap = backingMap;
|
||||||
|
|
||||||
|
synchronized (LOCK)
|
||||||
|
{
|
||||||
|
ALL_PLAYER_MAPS.add(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <V> PlayerMap<V> newMap()
|
||||||
|
{
|
||||||
|
return new PlayerMap<>(new HashMap<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <V> PlayerMap<V> newConcurrentMap()
|
||||||
|
{
|
||||||
|
return new PlayerMap<>(new ConcurrentHashMap<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size()
|
||||||
|
{
|
||||||
|
return _backingMap.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty()
|
||||||
|
{
|
||||||
|
return _backingMap.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public boolean containsKey(Object key)
|
||||||
|
{
|
||||||
|
Validate.notNull(key, "Key cannot be null");
|
||||||
|
if (key instanceof Player)
|
||||||
|
{
|
||||||
|
return containsKey((Player) key);
|
||||||
|
}
|
||||||
|
else if (key instanceof UUID)
|
||||||
|
{
|
||||||
|
return containsKey((UUID) key);
|
||||||
|
}
|
||||||
|
throw new UnsupportedOperationException("Unknown key type: " + key.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean containsKey(Player key)
|
||||||
|
{
|
||||||
|
Validate.notNull(key, "Player cannot be null");
|
||||||
|
return _backingMap.containsKey(key.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean containsKey(UUID key)
|
||||||
|
{
|
||||||
|
return _backingMap.containsKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean containsValue(Object value)
|
||||||
|
{
|
||||||
|
return _backingMap.containsValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public V get(Object key)
|
||||||
|
{
|
||||||
|
Validate.notNull(key, "Key cannot be null");
|
||||||
|
if (key instanceof Player)
|
||||||
|
{
|
||||||
|
return get((Player) key);
|
||||||
|
}
|
||||||
|
else if (key instanceof UUID)
|
||||||
|
{
|
||||||
|
return get((UUID) key);
|
||||||
|
}
|
||||||
|
throw new UnsupportedOperationException("Unknown key type: " + key.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public V get(Player key)
|
||||||
|
{
|
||||||
|
return _backingMap.get(key.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public V get(UUID key)
|
||||||
|
{
|
||||||
|
return _backingMap.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public V put(UUID key, V value)
|
||||||
|
{
|
||||||
|
return _backingMap.put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public V put(Player key, V value)
|
||||||
|
{
|
||||||
|
Validate.notNull(key, "Player cannot be null");
|
||||||
|
return put(key.getUniqueId(), value);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
|
public V remove(Object key)
|
||||||
|
{
|
||||||
|
Validate.notNull(key, "Key cannot be null");
|
||||||
|
if (key instanceof Player)
|
||||||
|
{
|
||||||
|
return remove((Player) key);
|
||||||
|
}
|
||||||
|
else if (key instanceof UUID)
|
||||||
|
{
|
||||||
|
return remove((UUID) key);
|
||||||
|
}
|
||||||
|
throw new UnsupportedOperationException("Unknown key type: " + key.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public V remove(Player key)
|
||||||
|
{
|
||||||
|
return _backingMap.remove(key.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public V remove(UUID key)
|
||||||
|
{
|
||||||
|
return _backingMap.remove(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putAll(@Nonnull Map<? extends UUID, ? extends V> m)
|
||||||
|
{
|
||||||
|
_backingMap.putAll(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
_backingMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nonnull
|
||||||
|
public Set<UUID> keySet()
|
||||||
|
{
|
||||||
|
return _backingMap.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nonnull
|
||||||
|
public Collection<V> values()
|
||||||
|
{
|
||||||
|
return _backingMap.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nonnull
|
||||||
|
public Set<Entry<UUID, V>> entrySet()
|
||||||
|
{
|
||||||
|
return _backingMap.entrySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return _backingMap.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o)
|
||||||
|
{
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
|
||||||
|
PlayerMap<?> playerMap = (PlayerMap<?>) o;
|
||||||
|
|
||||||
|
return _backingMap.equals(playerMap._backingMap);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
return _backingMap.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class RemovalListener implements Listener
|
||||||
|
{
|
||||||
|
@EventHandler
|
||||||
|
public void onQuit(PlayerQuitEvent event)
|
||||||
|
{
|
||||||
|
synchronized (LOCK)
|
||||||
|
{
|
||||||
|
for (PlayerMap<?> map : ALL_PLAYER_MAPS)
|
||||||
|
{
|
||||||
|
map.remove(event.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -132,6 +133,64 @@ public class UtilEnt
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #getEntitiesInsideEntity(Entity, List)}
|
||||||
|
* Uses all players in the same world as the entity as input
|
||||||
|
*/
|
||||||
|
public static List<Player> getPlayersInsideEntity(Entity ent)
|
||||||
|
{
|
||||||
|
return getEntitiesInsideEntity(ent, ent.getWorld().getPlayers());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #getEntitiesInsideEntity(Entity, List)}
|
||||||
|
* Uses all entities in the same world as the entity as input
|
||||||
|
*/
|
||||||
|
public static List<Entity> getEntitiesInsideEntity(Entity ent)
|
||||||
|
{
|
||||||
|
return getEntitiesInsideEntity(ent, ent.getWorld().getEntities());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See {@link #getEntitiesInsideEntity(Entity, List)}
|
||||||
|
* Auto cast to list of players
|
||||||
|
*/
|
||||||
|
public static List<Player> getPlayersInsideEntity(Entity ent, List<Player> players)
|
||||||
|
{
|
||||||
|
return getEntitiesInsideEntity(ent, players);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns entities which are inside the provided entity's boundingbox
|
||||||
|
* @param ent The entity to check inside
|
||||||
|
* @param entities List of entities to check
|
||||||
|
* @return Returns a sublist of entities which are inside the entity's boundingbox
|
||||||
|
*/
|
||||||
|
public static <T extends Entity> List<T> getEntitiesInsideEntity(Entity ent, List<T> entities)
|
||||||
|
{
|
||||||
|
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox();
|
||||||
|
|
||||||
|
List<T> list = new ArrayList<>();
|
||||||
|
|
||||||
|
for(T e : entities)
|
||||||
|
{
|
||||||
|
AxisAlignedBB box2 = ((CraftEntity)e).getHandle().getBoundingBox();
|
||||||
|
if(box2.b(box)) list.add(e);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Returns true if the entities boundinbox collides or is inside the given bounding box
|
||||||
|
*/
|
||||||
|
public static boolean isInsideBoundingBox(Entity ent, Vector a, Vector b)
|
||||||
|
{
|
||||||
|
AxisAlignedBB box = ((CraftEntity)ent).getHandle().getBoundingBox();
|
||||||
|
AxisAlignedBB box2 = new AxisAlignedBB(a.getX(), a.getY(), a.getZ(), b.getX(), b.getY(), b.getZ());
|
||||||
|
|
||||||
|
return box.b(box2);
|
||||||
|
}
|
||||||
|
|
||||||
public static void Vegetate(Entity entity)
|
public static void Vegetate(Entity entity)
|
||||||
{
|
{
|
||||||
Vegetate(entity, false);
|
Vegetate(entity, false);
|
||||||
@ -345,6 +404,35 @@ public class UtilEnt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether this entity should be ticked normally when far away. By default entities are only ticked once every 20 ticks
|
||||||
|
* when they are outside the activation range.
|
||||||
|
*
|
||||||
|
* Default ranges are calculated in a AABB fashion from their closest player:
|
||||||
|
* animalActivationRange = 32
|
||||||
|
* monsterActivationRange = 32
|
||||||
|
* miscActivationRange = 16
|
||||||
|
*
|
||||||
|
* Entities that are unaffected by range (always active):
|
||||||
|
* Players, Projectiles, Enderdragon, Wither, Fireballs, Lightning strikes, TNT, Ender Crystals and Fireworks.
|
||||||
|
*
|
||||||
|
* You can make entities which are by default active (Projectiles etc) not load when far away
|
||||||
|
* or make entities that are not active by default (mobs, animals etc) load when far away
|
||||||
|
*/
|
||||||
|
public static void setTickWhenFarAway(Entity ent, boolean loadWhenFar)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Field state = net.minecraft.server.v1_8_R3.Entity.class.getDeclaredField("defaultActivationState");
|
||||||
|
state.setAccessible(true);
|
||||||
|
state.setBoolean(((CraftEntity)ent).getHandle(), loadWhenFar);
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static String getName(Entity ent)
|
public static String getName(Entity ent)
|
||||||
{
|
{
|
||||||
if (ent == null)
|
if (ent == null)
|
||||||
@ -578,6 +666,16 @@ public class UtilEnt
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static float getStepHeight(Entity ent)
|
||||||
|
{
|
||||||
|
return ((CraftEntity)ent).getHandle().S;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setStepHeight(Entity ent, float stepHeight)
|
||||||
|
{
|
||||||
|
((CraftEntity)ent).getHandle().S = stepHeight;
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isGrounded(Entity ent)
|
public static boolean isGrounded(Entity ent)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -813,6 +911,18 @@ public class UtilEnt
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the entity got a path that will lead it closer to the current navigation path finding target.
|
||||||
|
* It will return false, it it is as close as it can get. Using this got an advantage compared to distance checking, as the target
|
||||||
|
* might be inside blocks, leaving the entity unable to get any closer.
|
||||||
|
* @param ent The entity to check
|
||||||
|
* @return Returns whether the entity can walk any closer to the current navigation target.
|
||||||
|
*/
|
||||||
|
public static boolean canEntityWalkCloserToNavigationTarget(Creature ent)
|
||||||
|
{
|
||||||
|
return ((CraftCreature)ent).getHandle().getNavigation().m();
|
||||||
|
}
|
||||||
|
|
||||||
public static int getNewEntityId()
|
public static int getNewEntityId()
|
||||||
{
|
{
|
||||||
@ -887,7 +997,17 @@ public class UtilEnt
|
|||||||
{
|
{
|
||||||
((CraftEntity)ent).getHandle().setSize((float) width, (float)height);
|
((CraftEntity)ent).getHandle().setSize((float) width, (float)height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static double getHeight(Entity ent)
|
||||||
|
{
|
||||||
|
return ((CraftEntity)ent).getHandle().length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getWidth(Entity ent)
|
||||||
|
{
|
||||||
|
return ((CraftEntity)ent).getHandle().width;
|
||||||
|
}
|
||||||
|
|
||||||
public static void SetMetadata(Entity entity, String key, Object value)
|
public static void SetMetadata(Entity entity, String key, Object value)
|
||||||
{
|
{
|
||||||
entity.setMetadata(key, new FixedMetadataValue(UtilServer.getPlugin(), value));
|
entity.setMetadata(key, new FixedMetadataValue(UtilServer.getPlugin(), value));
|
||||||
|
@ -86,7 +86,7 @@ public class UtilFuture
|
|||||||
CompletableFuture.allOf(values.toArray(new CompletableFuture[values.size()]));
|
CompletableFuture.allOf(values.toArray(new CompletableFuture[values.size()]));
|
||||||
|
|
||||||
return futuresCompleted.thenApply(v ->
|
return futuresCompleted.thenApply(v ->
|
||||||
seqValues.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().join())));
|
(Map<K, Collection<V>>) seqValues.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, entry -> (Collection<V>) entry.getValue().join())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import mineplex.core.common.MinecraftVersion;
|
import java.util.ArrayList;
|
||||||
import mineplex.core.common.events.PlayerMessageEvent;
|
import java.util.Arrays;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import java.util.Collection;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent.Action;
|
import java.util.HashMap;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import java.util.HashSet;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import java.util.Iterator;
|
||||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
import java.util.LinkedList;
|
||||||
import net.minecraft.server.v1_8_R3.Packet;
|
import java.util.List;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder;
|
import java.util.Map;
|
||||||
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
import java.util.Random;
|
||||||
import net.minecraft.server.v1_8_R3.WorldBorder;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -26,9 +27,23 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.InventoryView;
|
import org.bukkit.inventory.InventoryView;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.BlockIterator;
|
import org.bukkit.util.BlockIterator;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.MinecraftVersion;
|
||||||
|
import mineplex.core.common.events.PlayerMessageEvent;
|
||||||
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
|
import net.md_5.bungee.api.chat.ClickEvent.Action;
|
||||||
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityTracker;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
||||||
|
import net.minecraft.server.v1_8_R3.Packet;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder;
|
||||||
|
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||||
|
import net.minecraft.server.v1_8_R3.WorldBorder;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class UtilPlayer
|
public class UtilPlayer
|
||||||
@ -73,6 +88,49 @@ public class UtilPlayer
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setSpectating(Player player, Entity ent)
|
||||||
|
{
|
||||||
|
if(!ent.isValid()) return;
|
||||||
|
|
||||||
|
player.setGameMode(GameMode.SPECTATOR);
|
||||||
|
|
||||||
|
if(player.getSpectatorTarget() != null)
|
||||||
|
{
|
||||||
|
player.setSpectatorTarget(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.teleport(ent);
|
||||||
|
|
||||||
|
if(isTracked(player, ent))
|
||||||
|
{
|
||||||
|
player.setSpectatorTarget(ent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new BukkitRunnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
setSpectating(player, ent);
|
||||||
|
}
|
||||||
|
}.runTaskLater(UtilServer.getPlugin(), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given player is tracking the given target, meaning that the player
|
||||||
|
* got the entity loaded and knows about the entity.
|
||||||
|
*/
|
||||||
|
public static boolean isTracked(Player player, Entity target)
|
||||||
|
{
|
||||||
|
EntityPlayer ep = ((CraftPlayer) player).getHandle();
|
||||||
|
|
||||||
|
EntityTracker tracker = ep.u().getTracker();
|
||||||
|
EntityTrackerEntry entry = tracker.trackedEntities.get(target.getEntityId());
|
||||||
|
|
||||||
|
return entry.trackedPlayers.contains(ep);
|
||||||
|
}
|
||||||
|
|
||||||
public static void hideFrom(Player player, Collection<Player> players) {
|
public static void hideFrom(Player player, Collection<Player> players) {
|
||||||
players.stream().forEach(p->p.hidePlayer(player));
|
players.stream().forEach(p->p.hidePlayer(player));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,33 @@
|
|||||||
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class UtilReflection
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Returns the value of the field from the given object instance
|
||||||
|
*/
|
||||||
|
public static Object getValueOfField(Object object, String fieldName)
|
||||||
|
{
|
||||||
|
return getValueOfField(object.getClass(), object, fieldName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value of the field from the given object instance
|
||||||
|
*/
|
||||||
|
public static Object getValueOfField(Class<?> className, Object object, String fieldName)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Field f = className.getDeclaredField(fieldName);
|
||||||
|
f.setAccessible(true);
|
||||||
|
return f.get(object);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -75,12 +75,7 @@ public class LineParticle
|
|||||||
|
|
||||||
if (!(UtilBlock.airFoliage(newTarget.getBlock()) || UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))))
|
if (!(UtilBlock.airFoliage(newTarget.getBlock()) || UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))))
|
||||||
{
|
{
|
||||||
if (_ignoredTypes == null)
|
if (_ignoredTypes == null || !_ignoredTypes.contains(newTarget.getBlock().getType()))
|
||||||
{
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_ignoredTypes.contains(newTarget.getBlock().getType()))
|
|
||||||
{
|
{
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,8 @@ public class AntiHack extends MiniPlugin
|
|||||||
.put("Killaura (Type B)", new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE))
|
.put("Killaura (Type B)", new CheckThresholds("High CPS", 0, 0, Integer.MAX_VALUE))
|
||||||
.put("Killaura (Type C)", new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE))
|
.put("Killaura (Type C)", new CheckThresholds("Reach", 0, Integer.MAX_VALUE, Integer.MAX_VALUE))
|
||||||
.put("Killaura (Type D)", new CheckThresholds("Kill Aura", 500, 1000, 1500))
|
.put("Killaura (Type D)", new CheckThresholds("Kill Aura", 500, 1000, 1500))
|
||||||
|
.put("Killaura (Type E)", new CheckThresholds("Kill Aura", 300, 700, 2000))
|
||||||
|
.put("Killaura (Type F)", new CheckThresholds("Kill Aura", 150, 250, 350))
|
||||||
.put("BadPackets", new CheckThresholds("Regen", 500, 1000, 2000))
|
.put("BadPackets", new CheckThresholds("Regen", 500, 1000, 2000))
|
||||||
.put("Glide", new CheckThresholds("Flying", 50, 100, 200)) // TODO: specific VL levels
|
.put("Glide", new CheckThresholds("Flying", 50, 100, 200)) // TODO: specific VL levels
|
||||||
.put("Speed", new CheckThresholds("Speed", 50, 100, 200)) // TODO: specific VL levels
|
.put("Speed", new CheckThresholds("Speed", 50, 100, 200)) // TODO: specific VL levels
|
||||||
|
@ -376,9 +376,13 @@ public class AntiHackGuardian implements Listener
|
|||||||
|
|
||||||
public void remove()
|
public void remove()
|
||||||
{
|
{
|
||||||
this._armorStand.remove();
|
|
||||||
this._target = null;
|
this._target = null;
|
||||||
|
UtilServer.Unregister(this);
|
||||||
Managers.get(DisguiseManager.class).undisguise(this._disguise);
|
Managers.get(DisguiseManager.class).undisguise(this._disguise);
|
||||||
|
this._armorStand.remove();
|
||||||
|
this._nmsEntity = null;
|
||||||
|
this._armorStand = null;
|
||||||
|
this._center = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArmorStand getEntity()
|
public ArmorStand getEntity()
|
||||||
|
@ -14,8 +14,6 @@ import mineplex.core.bonuses.event.CarlSpinnerEvent;
|
|||||||
import mineplex.core.bonuses.gui.BonusGui;
|
import mineplex.core.bonuses.gui.BonusGui;
|
||||||
import mineplex.core.bonuses.gui.SpinGui;
|
import mineplex.core.bonuses.gui.SpinGui;
|
||||||
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
|
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
|
||||||
import mineplex.core.bonuses.redis.VoteHandler;
|
|
||||||
import mineplex.core.bonuses.redis.VotifierCommand;
|
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.Callback;
|
import mineplex.core.common.util.Callback;
|
||||||
@ -48,8 +46,6 @@ import mineplex.core.updater.UpdateType;
|
|||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.youtube.YoutubeManager;
|
import mineplex.core.youtube.YoutubeManager;
|
||||||
import mineplex.database.Tables;
|
import mineplex.database.Tables;
|
||||||
import mineplex.database.tables.records.BonusRecord;
|
|
||||||
import mineplex.serverdata.commands.ServerCommandManager;
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||||
import net.minecraft.server.v1_8_R3.EntityCreeper;
|
import net.minecraft.server.v1_8_R3.EntityCreeper;
|
||||||
@ -93,7 +89,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
private ArrayList<Player> _pendingExplosionsPlayers = new ArrayList<>();
|
private ArrayList<Player> _pendingExplosionsPlayers = new ArrayList<>();
|
||||||
private HashMap<String, Boolean> _showCarl = new HashMap<>();
|
private HashMap<String, Boolean> _showCarl = new HashMap<>();
|
||||||
private long _explode;
|
private long _explode;
|
||||||
private boolean _canVote;
|
private boolean _animationRunning;
|
||||||
|
|
||||||
public static long getSqlTime()
|
public static long getSqlTime()
|
||||||
{
|
{
|
||||||
@ -140,43 +136,10 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
private AnimationCarl _animation;
|
private AnimationCarl _animation;
|
||||||
private int _visualTick;
|
private int _visualTick;
|
||||||
|
|
||||||
// Streak
|
|
||||||
// private StreakRecord _dailyStreak;
|
|
||||||
// private StreakRecord _voteStreak;
|
|
||||||
|
|
||||||
private ArrayList<String> _voteList;
|
|
||||||
|
|
||||||
// Donor Queues
|
// Donor Queues
|
||||||
private Queue<GiveDonorData> _coinQueue;
|
private Queue<GiveDonorData> _coinQueue;
|
||||||
private Queue<GiveDonorData> _gemQueue;
|
private Queue<GiveDonorData> _gemQueue;
|
||||||
|
|
||||||
/**
|
|
||||||
* THIS SHOULD ONLY BE USED FOR VOTIFIER!
|
|
||||||
*/
|
|
||||||
public BonusManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
|
||||||
{
|
|
||||||
super("Bonus", plugin);
|
|
||||||
_enabled = false;
|
|
||||||
|
|
||||||
_repository = new BonusRepository(plugin, this, donationManager);
|
|
||||||
_clientManager = clientManager;
|
|
||||||
_donationManager = donationManager;
|
|
||||||
_powerPlayClubRepository = new PowerPlayClubRepository(plugin, clientManager, donationManager);
|
|
||||||
|
|
||||||
System.out.print("VOTIFIER: ");
|
|
||||||
System.out.print("DONATION MANAGER - > " + _donationManager.toString());
|
|
||||||
|
|
||||||
_voteList = new ArrayList<>();
|
|
||||||
_voteList.add("http://vote1.mineplex.com");
|
|
||||||
_voteList.add("http://vote2.mineplex.com");
|
|
||||||
_voteList.add("http://vote3.mineplex.com");
|
|
||||||
|
|
||||||
_coinQueue = new LinkedList<>();
|
|
||||||
_gemQueue = new LinkedList<>();
|
|
||||||
|
|
||||||
updateOffSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BonusManager(JavaPlugin plugin, Location carlLocation, PlayWireManager playWireManager, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, ThankManager thankManager)
|
public BonusManager(JavaPlugin plugin, Location carlLocation, PlayWireManager playWireManager, CoreClientManager clientManager, DonationManager donationManager, PollManager pollManager, NpcManager npcManager, HologramManager hologramManager, StatsManager statsManager, InventoryManager inventoryManager, PetManager petManager, FacebookManager facebookManager, YoutubeManager youtubeManager, GadgetManager gadgetManager, ThankManager thankManager)
|
||||||
{
|
{
|
||||||
super("Bonus", plugin);
|
super("Bonus", plugin);
|
||||||
@ -204,12 +167,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
|
|
||||||
_powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager, _donationManager);
|
_powerPlayClubRepository = new PowerPlayClubRepository(plugin, _clientManager, _donationManager);
|
||||||
|
|
||||||
_voteList = new ArrayList<>();
|
|
||||||
_voteList.add("http://vote1.mineplex.com");
|
|
||||||
_voteList.add("http://vote2.mineplex.com");
|
|
||||||
_voteList.add("http://vote3.mineplex.com");
|
|
||||||
|
|
||||||
_canVote = true;
|
|
||||||
_coinQueue = new LinkedList<>();
|
_coinQueue = new LinkedList<>();
|
||||||
_gemQueue = new LinkedList<>();
|
_gemQueue = new LinkedList<>();
|
||||||
|
|
||||||
@ -239,10 +196,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
|
|
||||||
clientManager.addStoredProcedureLoginProcessor(this);
|
clientManager.addStoredProcedureLoginProcessor(this);
|
||||||
|
|
||||||
ServerCommandManager.getInstance().registerCommandType("VotifierCommand", VotifierCommand.class, new VoteHandler(this));
|
|
||||||
|
|
||||||
updateOffSet();
|
updateOffSet();
|
||||||
// updateStreakRecord();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -263,25 +217,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
return;
|
return;
|
||||||
updateOffSet();
|
updateOffSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void handleVote(final Player player, final int shardsReceived)
|
|
||||||
{
|
|
||||||
final int accountId = _clientManager.getAccountId(player);
|
|
||||||
|
|
||||||
runAsync(() -> _repository.getClientData(accountId, data -> runSync(() ->
|
|
||||||
{
|
|
||||||
BonusClientData oldData = Get(player);
|
|
||||||
if (oldData != null) data.setHologram(oldData.getHologram());
|
|
||||||
Set(player, data);
|
|
||||||
|
|
||||||
_statsManager.incrementStat(player, "Global.DailyVote", 1);
|
|
||||||
addPendingExplosion(player, player.getName());
|
|
||||||
UtilPlayer.message(player, F.main("Carl", "Thanks for voting for Mineplex!"));
|
|
||||||
UtilPlayer.message(player, F.main("Carl", "You received " + F.elem("1 Carl Spinner Ticket") + "!"));
|
|
||||||
})));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void fireCreeper(UpdateEvent event)
|
public void fireCreeper(UpdateEvent event)
|
||||||
@ -291,16 +226,16 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
|
|
||||||
if(_pendingExplosions.isEmpty())
|
if(_pendingExplosions.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!_canVote)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
if (_animationRunning)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!_enabled)
|
if (!_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_animationRunning = true;
|
||||||
_explode = System.currentTimeMillis();
|
_explode = System.currentTimeMillis();
|
||||||
_animation.setTicks(0);
|
_animation.setTicks(0);
|
||||||
_canVote = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -311,10 +246,10 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
|
|
||||||
_animation.itemClean();
|
_animation.itemClean();
|
||||||
|
|
||||||
if(_canVote)
|
if (!_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_enabled)
|
if (!_animationRunning)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity creeper = _carlNpc.getEntity();
|
Entity creeper = _carlNpc.getEntity();
|
||||||
@ -344,10 +279,10 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
if(!_animation.isDone())
|
if(!_animation.isDone())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_animationRunning = false;
|
||||||
DecreaseSize(creeper);
|
DecreaseSize(creeper);
|
||||||
_pendingExplosions.remove(0);
|
_pendingExplosions.remove(0);
|
||||||
_pendingExplosionsPlayers.remove(0);
|
_pendingExplosionsPlayers.remove(0);
|
||||||
_canVote = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -385,7 +320,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
|
|
||||||
public static final long TIME_BETWEEN_BONUSES = 1000 * 60 * 60 * 20;
|
public static final long TIME_BETWEEN_BONUSES = 1000 * 60 * 60 * 20;
|
||||||
public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12;
|
public static final long DAILY_STREAK_RESET_TIME = 1000 * 60 * 60 * 12;
|
||||||
public static final long VOTE_STREAK_RESET_TIME = 1000 * 60 * 60 * 24;
|
|
||||||
|
|
||||||
|
|
||||||
public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback<Boolean> result)
|
public void attemptDailyBonus(final Player player, final BonusAmount amount, final Callback<Boolean> result)
|
||||||
@ -509,20 +443,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateVoteStreak(BonusRecord client)
|
|
||||||
{
|
|
||||||
if (client.getVoteStreak() > 0 && client.getVotetime() != null)
|
|
||||||
{
|
|
||||||
long lastBonus = getLocalTime(client.getVotetime().getTime());
|
|
||||||
long timeLeft = getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME);
|
|
||||||
|
|
||||||
if (timeLeft < 0)
|
|
||||||
{
|
|
||||||
client.setVoteStreak(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void incrementDailyStreak(Player player)
|
public void incrementDailyStreak(Player player)
|
||||||
{
|
{
|
||||||
BonusClientData data = Get(player);
|
BonusClientData data = Get(player);
|
||||||
@ -533,14 +453,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
data.setMaxDailyStreak(data.getDailyStreak());
|
data.setMaxDailyStreak(data.getDailyStreak());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementVoteStreak(BonusRecord client)
|
|
||||||
{
|
|
||||||
client.setVoteStreak(client.getVoteStreak() + 1);
|
|
||||||
|
|
||||||
if (client.getVoteStreak() > client.getMaxVoteStreak())
|
|
||||||
client.setMaxVoteStreak(client.getVoteStreak());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean continueStreak(long localLastBonus, long extendTime)
|
public boolean continueStreak(long localLastBonus, long extendTime)
|
||||||
{
|
{
|
||||||
long maxTime = localLastBonus + TIME_BETWEEN_BONUSES + extendTime;
|
long maxTime = localLastBonus + TIME_BETWEEN_BONUSES + extendTime;
|
||||||
@ -581,13 +493,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
return multiplier;
|
return multiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVoteMultiplier(int streak)
|
|
||||||
{
|
|
||||||
int multiplier = Math.min(100, 5 * streak);
|
|
||||||
if (streak >= 20) multiplier += (1 * (streak - 40));
|
|
||||||
return multiplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BonusAmount getDailyBonusAmount(Player player)
|
public BonusAmount getDailyBonusAmount(Player player)
|
||||||
{
|
{
|
||||||
double mult = getDailyMultiplier(player) / 100.0;
|
double mult = getDailyMultiplier(player) / 100.0;
|
||||||
@ -607,21 +512,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
return amount;
|
return amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BonusAmount getVoteBonusAmount(Player player)
|
|
||||||
{
|
|
||||||
return getVoteBonusAmount(Get(player).getVoteStreak());
|
|
||||||
}
|
|
||||||
|
|
||||||
public BonusAmount getVoteBonusAmount(int voteStreak)
|
|
||||||
{
|
|
||||||
double mult = getVoteMultiplier(voteStreak) / 100.0;
|
|
||||||
|
|
||||||
BonusAmount amount = new BonusAmount();
|
|
||||||
amount.setTickets(1);
|
|
||||||
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BonusAmount getRankBonusAmount(Player player)
|
public BonusAmount getRankBonusAmount(Player player)
|
||||||
{
|
{
|
||||||
Rank rank = _clientManager.Get(player).GetRank();
|
Rank rank = _clientManager.Get(player).GetRank();
|
||||||
@ -648,25 +538,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
//VOTE
|
|
||||||
|
|
||||||
public long timeTillVoteBonus(Player player)
|
|
||||||
{
|
|
||||||
return nextVoteTime(player) - getLocalTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This calculates the the next vote bonus, IT HAS TO MATCH THE MYSQL STORED FUNCTION.
|
|
||||||
public long nextVoteTime(Player player)
|
|
||||||
{
|
|
||||||
Date date = Get(player).getVoteTime();
|
|
||||||
if (date == null)
|
|
||||||
return 0;
|
|
||||||
long lastBonus = date.getTime();
|
|
||||||
|
|
||||||
return getNextVoteTime(getLocalTime(lastBonus));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void awardBonus(final Player player, BonusAmount amount)
|
public void awardBonus(final Player player, BonusAmount amount)
|
||||||
{
|
{
|
||||||
final BonusClientData bonusClient = Get(player);
|
final BonusClientData bonusClient = Get(player);
|
||||||
@ -774,27 +645,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long getNextVoteTime(long time) {
|
|
||||||
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTimeZone(TIMEZONE);
|
|
||||||
calendar.setTimeInMillis(time);
|
|
||||||
|
|
||||||
calendar.add(Calendar.DAY_OF_YEAR, 1);
|
|
||||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
|
||||||
calendar.set(Calendar.SECOND, 0);
|
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
|
||||||
|
|
||||||
return calendar.getTimeInMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canVote(Player player)
|
|
||||||
{
|
|
||||||
long nextVoteTime = nextVoteTime(player);
|
|
||||||
return System.currentTimeMillis() >= nextVoteTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean canDaily(Player player)
|
public boolean canDaily(Player player)
|
||||||
{
|
{
|
||||||
long nextDailyTime = nextDailyBonus(player);
|
long nextDailyTime = nextDailyBonus(player);
|
||||||
@ -826,7 +676,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
|
|
||||||
int availableRewards = 0;
|
int availableRewards = 0;
|
||||||
|
|
||||||
if (canVote(player)) availableRewards++;
|
if (_playWireManager.canRedeem(player)) availableRewards++;
|
||||||
if (_youtubeManager.canYoutube(player)) availableRewards++;
|
if (_youtubeManager.canYoutube(player)) availableRewards++;
|
||||||
if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++;
|
if (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) availableRewards++;
|
||||||
if (canDaily(player)) availableRewards++;
|
if (canDaily(player)) availableRewards++;
|
||||||
@ -991,7 +841,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
{
|
{
|
||||||
if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false))
|
if (Recharge.Instance.use(player, "Carl Inform", 240000, false, false))
|
||||||
{
|
{
|
||||||
if(_pollManager.hasPoll(player) || canVote(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository))
|
if(_pollManager.hasPoll(player) || _playWireManager.canRedeem(player) || (canRank(player) && _clientManager.hasRank(player, Rank.ULTRA) && isPastAugust()) || canDaily(player) || PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository))
|
||||||
{
|
{
|
||||||
if(_showCarl.containsKey(player.getName()))
|
if(_showCarl.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
@ -1048,16 +898,6 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVoteLink()
|
|
||||||
{
|
|
||||||
long sqlTime = getSqlTime();
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTimeInMillis(sqlTime);
|
|
||||||
int date = calendar.get(Calendar.DAY_OF_YEAR);
|
|
||||||
int index = date % _voteList.size();
|
|
||||||
return _voteList.get(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for disabling rank rewards during first month of release
|
* Used for disabling rank rewards during first month of release
|
||||||
* @return
|
* @return
|
||||||
@ -1120,4 +960,4 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
{
|
{
|
||||||
_carlLocation = carlLocation;
|
_carlLocation = carlLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -158,6 +158,7 @@ public class AnimationCarl extends Animation
|
|||||||
@Override
|
@Override
|
||||||
protected void onFinish() {
|
protected void onFinish() {
|
||||||
_isDone = true;
|
_isDone = true;
|
||||||
|
_player = null;
|
||||||
setTicks(0);
|
setTicks(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@ import org.bukkit.plugin.Plugin;
|
|||||||
public class BonusGui extends SimpleGui
|
public class BonusGui extends SimpleGui
|
||||||
{
|
{
|
||||||
|
|
||||||
private final int VOTE_SLOT = 10;
|
//private final int VOTE_SLOT = 10;
|
||||||
private final int RANK_BONUS_SLOT = 12;
|
private final int RANK_BONUS_SLOT = 11;
|
||||||
private final int DAILY_BONUS_SLOT = 14;
|
private final int DAILY_BONUS_SLOT = 13;
|
||||||
private final int POLL_SLOT = 16;
|
private final int POLL_SLOT = 15;
|
||||||
private final int FACEBOOK_SLOT = 19;
|
private final int FACEBOOK_SLOT = 19;
|
||||||
private final int CLAIM_TIPS_SLOT = 25;
|
private final int CLAIM_TIPS_SLOT = 25;
|
||||||
private final int POWER_PLAY_SLOT = 21;
|
private final int POWER_PLAY_SLOT = 21;
|
||||||
@ -32,7 +32,7 @@ public class BonusGui extends SimpleGui
|
|||||||
{
|
{
|
||||||
super(plugin, player, player.getName() + "'s Bonuses", INV_SIZE);
|
super(plugin, player, player.getName() + "'s Bonuses", INV_SIZE);
|
||||||
|
|
||||||
setItem(VOTE_SLOT, new VoteButton(plugin, player, this, manager));
|
//setItem(VOTE_SLOT, new VoteButton(plugin, player, this, manager));
|
||||||
|
|
||||||
setItem(RANK_BONUS_SLOT, new RankBonusButton(getPlugin(), player, this, manager));
|
setItem(RANK_BONUS_SLOT, new RankBonusButton(getPlugin(), player, this, manager));
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -12,6 +13,7 @@ import mineplex.core.bonuses.BonusAmount;
|
|||||||
import mineplex.core.common.jsonchat.ClickEvent;
|
import mineplex.core.common.jsonchat.ClickEvent;
|
||||||
import mineplex.core.common.jsonchat.JsonMessage;
|
import mineplex.core.common.jsonchat.JsonMessage;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.facebook.FacebookManager;
|
import mineplex.core.facebook.FacebookManager;
|
||||||
import mineplex.core.gui.GuiItem;
|
import mineplex.core.gui.GuiItem;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
@ -43,8 +45,31 @@ public class FacebookButton implements GuiItem
|
|||||||
public void click(ClickType clickType)
|
public void click(ClickType clickType)
|
||||||
{
|
{
|
||||||
_player.closeInventory();
|
_player.closeInventory();
|
||||||
|
|
||||||
|
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||||
|
|
||||||
|
final String message;
|
||||||
|
if (isAvailable())
|
||||||
|
{
|
||||||
|
message = "claim Facebook Prize!";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message = "visit our Facebook page!";
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||||
|
UtilPlayer.message(_player, "");
|
||||||
|
|
||||||
new JsonMessage(C.cAquaB + "Click here to claim Facebook Prize!").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/app/185301094822359/").sendToPlayer(_player);
|
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser and " + message).click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/app/185301094822359/").sendToPlayer(_player);
|
||||||
|
new JsonMessage(" " + C.cGreen + C.Line + "https://www.facebook.com/MineplexGames").click(ClickEvent.OPEN_URL, "https://www.facebook.com/MineplexGames/app/185301094822359/").sendToPlayer(_player);
|
||||||
|
UtilPlayer.message(_player, "");
|
||||||
|
if (isAvailable())
|
||||||
|
{
|
||||||
|
UtilPlayer.message(_player, " Please be patient. Prizes may take a few minutes to register.");
|
||||||
|
UtilPlayer.message(_player, "");
|
||||||
|
}
|
||||||
|
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isAvailable()
|
private boolean isAvailable()
|
||||||
|
@ -20,7 +20,7 @@ public class PlayWireButton implements GuiItem
|
|||||||
.setTitle(C.cGreen + C.Bold + "Watch an Ad!")
|
.setTitle(C.cGreen + C.Bold + "Watch an Ad!")
|
||||||
.addLore(
|
.addLore(
|
||||||
C.cWhite + "You have already redeemed your",
|
C.cWhite + "You have already redeemed your",
|
||||||
C.cWhite + "100 Shards for watching the Ad!",
|
C.cWhite + "rewards for watching the Ad!",
|
||||||
" ",
|
" ",
|
||||||
C.cWhite + "You can watch it again, but you won't earn any shards!",
|
C.cWhite + "You can watch it again, but you won't earn any shards!",
|
||||||
" ",
|
" ",
|
||||||
@ -37,6 +37,7 @@ public class PlayWireButton implements GuiItem
|
|||||||
.setTitle(C.cGreen + C.Bold + "Watch an Ad!")
|
.setTitle(C.cGreen + C.Bold + "Watch an Ad!")
|
||||||
.addLore(
|
.addLore(
|
||||||
C.cYellow + "Earn a 100 Shard Reward",
|
C.cYellow + "Earn a 100 Shard Reward",
|
||||||
|
C.cYellow + "and 1 Carl Spin Ticket",
|
||||||
C.cWhite + "by checking out our partner's Advertisement",
|
C.cWhite + "by checking out our partner's Advertisement",
|
||||||
" ",
|
" ",
|
||||||
C.cWhite + "You can watch the Ad once every hour.",
|
C.cWhite + "You can watch the Ad once every hour.",
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package mineplex.core.bonuses.gui;
|
package mineplex.core.bonuses.gui.buttons;
|
||||||
|
|
||||||
import mineplex.core.common.jsonchat.ClickEvent;
|
import mineplex.core.common.jsonchat.ClickEvent;
|
||||||
import mineplex.core.common.jsonchat.JsonMessage;
|
import mineplex.core.common.jsonchat.JsonMessage;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.gui.GuiItem;
|
import mineplex.core.gui.GuiItem;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -39,8 +41,16 @@ public class TwitterButton implements GuiItem
|
|||||||
public void click(ClickType clickType)
|
public void click(ClickType clickType)
|
||||||
{
|
{
|
||||||
_player.closeInventory();
|
_player.closeInventory();
|
||||||
|
|
||||||
|
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||||
|
|
||||||
|
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||||
|
UtilPlayer.message(_player, "");
|
||||||
|
|
||||||
new JsonMessage(C.cAquaB + "Click here to visit our Twitter page!").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player);
|
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player);
|
||||||
|
new JsonMessage(" " + C.cGreen + C.Line + "https://www.twitter.com/Mineplex").click(ClickEvent.OPEN_URL, "https://www.twitter.com/Mineplex").sendToPlayer(_player);
|
||||||
|
UtilPlayer.message(_player, "");
|
||||||
|
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -1,185 +0,0 @@
|
|||||||
package mineplex.core.bonuses.gui.buttons;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import mineplex.core.bonuses.BonusAmount;
|
|
||||||
import mineplex.core.bonuses.BonusClientData;
|
|
||||||
import mineplex.core.bonuses.BonusManager;
|
|
||||||
import mineplex.core.common.jsonchat.ClickEvent;
|
|
||||||
import mineplex.core.common.jsonchat.JsonMessage;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
|
||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
|
||||||
import mineplex.core.gui.GuiItem;
|
|
||||||
import mineplex.core.gui.ItemRefresher;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
public class VoteButton implements GuiItem, Listener {
|
|
||||||
|
|
||||||
private ItemStack _item;
|
|
||||||
|
|
||||||
private String _url;
|
|
||||||
|
|
||||||
private Player _player;
|
|
||||||
private Plugin _plugin;
|
|
||||||
private ItemRefresher _gui;
|
|
||||||
|
|
||||||
private BonusManager _bonusManager;
|
|
||||||
|
|
||||||
public VoteButton(Plugin plugin, Player player, ItemRefresher gui, BonusManager bonusManager)
|
|
||||||
{
|
|
||||||
this._bonusManager = bonusManager;
|
|
||||||
this._player = player;
|
|
||||||
this._plugin = plugin;
|
|
||||||
this._gui = gui;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setup()
|
|
||||||
{
|
|
||||||
//TODO get url from db
|
|
||||||
_url = _bonusManager.getVoteLink();
|
|
||||||
|
|
||||||
setItem();
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, getPlugin());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void close()
|
|
||||||
{
|
|
||||||
HandlerList.unregisterAll(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void click(ClickType clickType)
|
|
||||||
{
|
|
||||||
if (isAvailable())
|
|
||||||
{
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
|
|
||||||
getPlayer().playSound(getPlayer().getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
|
||||||
|
|
||||||
UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "=============================================");
|
|
||||||
UtilPlayer.message(getPlayer(), "");
|
|
||||||
|
|
||||||
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser").click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
|
||||||
new JsonMessage( " " + C.cGreen + C.Line + _url).click(ClickEvent.OPEN_URL, _url).sendToPlayer(getPlayer());
|
|
||||||
UtilPlayer.message(getPlayer(), "");
|
|
||||||
UtilPlayer.message(getPlayer(), " Please be patient. Votes may take a few minutes to register.");
|
|
||||||
UtilPlayer.message(getPlayer(), "");
|
|
||||||
UtilPlayer.message(getPlayer(), C.cGold + C.Bold + C.Strike + "=============================================");
|
|
||||||
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getPlayer().playSound(getPlayer().getLocation(), Sound.ITEM_BREAK, 1, 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getObject()
|
|
||||||
{
|
|
||||||
return _item;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setItem()
|
|
||||||
{
|
|
||||||
ArrayList<String> lore = new ArrayList<String>();
|
|
||||||
Material material;
|
|
||||||
String itemName;
|
|
||||||
byte data = 0;
|
|
||||||
|
|
||||||
if (isAvailable())
|
|
||||||
{
|
|
||||||
material = Material.JUKEBOX;
|
|
||||||
itemName = C.cGreen + C.Bold + "Vote for Mineplex";
|
|
||||||
|
|
||||||
lore.add(" ");
|
|
||||||
lore.add(ChatColor.RESET + "Click to Vote!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
material = Material.REDSTONE_BLOCK;
|
|
||||||
itemName = C.cRed + C.Bold + "Vote for Mineplex";
|
|
||||||
|
|
||||||
lore.add(" ");
|
|
||||||
lore.add(ChatColor.RESET + "Next vote in " + UtilTime.convertString(timeLeft(), 0, TimeUnit.FIT) + "!");
|
|
||||||
}
|
|
||||||
|
|
||||||
lore.add(" ");
|
|
||||||
|
|
||||||
BonusClientData client = _bonusManager.Get(_player);
|
|
||||||
|
|
||||||
BonusAmount bonusAmount = _bonusManager.getVoteBonusAmount(_player);
|
|
||||||
bonusAmount.addLore(lore);
|
|
||||||
lore.add(" ");
|
|
||||||
|
|
||||||
lore.add(C.cYellow + "Current Streak: " + C.cWhite + client.getVoteStreak());
|
|
||||||
lore.add(C.cYellow + "Streak Bonus: " + C.cWhite + "+" + _bonusManager.getVoteMultiplier(client.getVoteStreak()) + "%");
|
|
||||||
if (client.getVoteTime() != null)
|
|
||||||
{
|
|
||||||
long lastBonus = _bonusManager.getLocalTime(client.getVoteTime().getTime());
|
|
||||||
long timeLeft = _bonusManager.getStreakTimeRemaining(lastBonus, BonusManager.VOTE_STREAK_RESET_TIME);
|
|
||||||
|
|
||||||
if (timeLeft > 0)
|
|
||||||
{
|
|
||||||
lore.add(C.cYellow + "Streak Reset: " + C.cWhite + UtilTime.convertString(timeLeft, 1, TimeUnit.FIT));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lore.add(" ");
|
|
||||||
lore.add(C.cYellow + "Highest Streak: " + C.cWhite + client.getMaxVoteStreak());
|
|
||||||
|
|
||||||
// StreakRecord streakRecord = _bonusManager.getVoteStreak();
|
|
||||||
// if (streakRecord != null)
|
|
||||||
// {
|
|
||||||
// lore.add(" ");
|
|
||||||
// lore.add(C.cYellow + "Record: " + C.cWhite + streakRecord.getPlayerName());
|
|
||||||
// lore.add(C.cYellow + "Streak: " + C.cWhite + streakRecord.getStreak());
|
|
||||||
// }
|
|
||||||
|
|
||||||
_item = new ShopItem(material, itemName, lore.toArray(new String[0]), 1, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public long timeLeft()
|
|
||||||
{
|
|
||||||
return _bonusManager.nextVoteTime(getPlayer()) - System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAvailable()
|
|
||||||
{
|
|
||||||
if (_url == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return (timeLeft() <= 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Plugin getPlugin()
|
|
||||||
{
|
|
||||||
return _plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Player getPlayer()
|
|
||||||
{
|
|
||||||
return _player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemRefresher getGui()
|
|
||||||
{
|
|
||||||
return _gui;
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,11 +3,13 @@ package mineplex.core.bonuses.gui.buttons;
|
|||||||
import mineplex.core.common.jsonchat.ClickEvent;
|
import mineplex.core.common.jsonchat.ClickEvent;
|
||||||
import mineplex.core.common.jsonchat.JsonMessage;
|
import mineplex.core.common.jsonchat.JsonMessage;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.gui.GuiItem;
|
import mineplex.core.gui.GuiItem;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.youtube.YoutubeManager;
|
import mineplex.core.youtube.YoutubeManager;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -66,18 +68,27 @@ public class YoutubeButton implements GuiItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
_player.closeInventory();
|
_player.closeInventory();
|
||||||
|
|
||||||
|
_player.playSound(_player.getLocation(), Sound.NOTE_PLING, 1, 1.6f);
|
||||||
|
|
||||||
final String message;
|
final String message;
|
||||||
if (_youtubeManager.canYoutube(_player))
|
if (_youtubeManager.canYoutube(_player))
|
||||||
{
|
{
|
||||||
message = "Click here to claim YouTube Prize!";
|
message = "claim YouTube Prize!";
|
||||||
_youtubeManager.attemptYoutube(_player);
|
_youtubeManager.attemptYoutube(_player);
|
||||||
} else
|
|
||||||
{
|
|
||||||
message = "Click here to visit our YouTube page!";
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message = "visit our YouTube page!";
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||||
|
UtilPlayer.message(_player, "");
|
||||||
|
|
||||||
new JsonMessage(C.cAquaB + message).click(ClickEvent.OPEN_URL, "http://youtube.com/mineplexgamesofficial?sub_confirmation=1").sendToPlayer(_player);
|
new JsonMessage(" " + C.Bold + "Click to Open in Web Browser and " + message).click(ClickEvent.OPEN_URL, "https://www.youtube.com/embed/RW3sOmkiEG-A?list=UU1MtBclG_aHPd0nLmUupCKg&controls=0&showinfo=0&autoplay=1").sendToPlayer(_player);
|
||||||
|
new JsonMessage( " " + C.cGreen + C.Line + "http://youtube.com/mineplexgamesofficial").click(ClickEvent.OPEN_URL, "https://www.youtube.com/embed/RW3sOmkiEG-A?list=UU1MtBclG_aHPd0nLmUupCKg&controls=0&showinfo=0&autoplay=1").sendToPlayer(_player);
|
||||||
|
UtilPlayer.message(_player, "");
|
||||||
|
UtilPlayer.message(_player, C.cGold + C.Bold + C.Strike + "=============================================");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
package mineplex.core.bonuses.redis;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.bonuses.BonusManager;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.serverdata.commands.CommandCallback;
|
|
||||||
import mineplex.serverdata.commands.ServerCommand;
|
|
||||||
|
|
||||||
public class VoteHandler implements CommandCallback
|
|
||||||
{
|
|
||||||
private BonusManager _bonusManager;
|
|
||||||
|
|
||||||
public VoteHandler(BonusManager bonusManager)
|
|
||||||
{
|
|
||||||
_bonusManager = bonusManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run(ServerCommand command)
|
|
||||||
{
|
|
||||||
VotifierCommand v = ((VotifierCommand) command);
|
|
||||||
|
|
||||||
Player player = UtilPlayer.searchExact(v.getPlayerName());
|
|
||||||
|
|
||||||
if (player != null)
|
|
||||||
{
|
|
||||||
_bonusManager.handleVote(player, v.getShardsReceived());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
package mineplex.core.bonuses.redis;
|
|
||||||
|
|
||||||
import mineplex.serverdata.commands.ServerCommand;
|
|
||||||
|
|
||||||
public class VotifierCommand extends ServerCommand
|
|
||||||
{
|
|
||||||
private String _playerName;
|
|
||||||
private int _shardsReceived;
|
|
||||||
|
|
||||||
public VotifierCommand(String playerName, int shardsReceived, String... targetServer)
|
|
||||||
{
|
|
||||||
super(targetServer);
|
|
||||||
|
|
||||||
_playerName = playerName;
|
|
||||||
_shardsReceived = shardsReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPlayerName()
|
|
||||||
{
|
|
||||||
return _playerName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getShardsReceived()
|
|
||||||
{
|
|
||||||
return _shardsReceived;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -132,15 +132,15 @@ public class SnapshotManager
|
|||||||
.collect(Collectors.toCollection(TreeSet::new));
|
.collect(Collectors.toCollection(TreeSet::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<Integer> saveReportSnapshot(Report report, Collection<SnapshotMessage> messages)
|
public CompletableFuture<SnapshotMetadata> saveReportSnapshot(Report report, Collection<SnapshotMessage> messages)
|
||||||
{
|
{
|
||||||
return _snapshotRepository
|
return _snapshotRepository
|
||||||
.saveReportSnapshot(report, messages)
|
.saveReportSnapshot(report, messages)
|
||||||
.whenComplete((snapshotId, throwable) ->
|
.whenComplete((snapshotMetadata, throwable) ->
|
||||||
{
|
{
|
||||||
if (throwable == null)
|
if (throwable == null)
|
||||||
{
|
{
|
||||||
report.setSnapshotId(snapshotId);
|
report.setSnapshotMetadata(snapshotMetadata);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package mineplex.core.chatsnap;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public class SnapshotMetadata
|
||||||
|
{
|
||||||
|
private final int _id;
|
||||||
|
protected String _token = null;
|
||||||
|
protected Integer _creatorId = null;
|
||||||
|
|
||||||
|
public SnapshotMetadata(int id, String token, Integer creatorId)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_token = token;
|
||||||
|
_creatorId = creatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SnapshotMetadata(int id, Integer creatorId)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
_creatorId = creatorId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SnapshotMetadata(int id)
|
||||||
|
{
|
||||||
|
_id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId()
|
||||||
|
{
|
||||||
|
return _id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<String> getToken()
|
||||||
|
{
|
||||||
|
return Optional.ofNullable(_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Integer> getCreatorId()
|
||||||
|
{
|
||||||
|
return Optional.ofNullable(_creatorId);
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
package mineplex.core.chatsnap;
|
package mineplex.core.chatsnap;
|
||||||
|
|
||||||
|
import java.security.SecureRandom;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -20,17 +22,56 @@ import mineplex.serverdata.database.DBPool;
|
|||||||
*/
|
*/
|
||||||
public class SnapshotRepository
|
public class SnapshotRepository
|
||||||
{
|
{
|
||||||
public static String getURL(long reportId)
|
private static final String URL_PREFIX = "http://report.mineplex.com/chatsnap/view.php?token=";
|
||||||
|
|
||||||
|
private static final int TOKEN_CHARS = 8;
|
||||||
|
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
|
||||||
|
|
||||||
|
public static String getURL(String token)
|
||||||
{
|
{
|
||||||
return URL_PREFIX + reportId;
|
return URL_PREFIX + token;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String URL_PREFIX = "http://report.mineplex.com/chatsnap/view.php?id=";
|
public static String generateToken()
|
||||||
|
{
|
||||||
|
// 6 bits per character, round to nearest byte
|
||||||
|
int byteAmount = (int) Math.ceil((TOKEN_CHARS * 6) / 8.0);
|
||||||
|
byte[] bytes = new byte[byteAmount];
|
||||||
|
SECURE_RANDOM.nextBytes(bytes);
|
||||||
|
|
||||||
private static final String INSERT_SNAPSHOT = "INSERT INTO snapshots (creator) VALUES (?);";
|
String token = Base64.getUrlEncoder().encodeToString(bytes);
|
||||||
|
token = replaceDashes(token);
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String replaceDashes(String token)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < token.length(); i++)
|
||||||
|
{
|
||||||
|
char originalChar = token.charAt(i);
|
||||||
|
char newChar = originalChar;
|
||||||
|
|
||||||
|
while (newChar == '-')
|
||||||
|
{
|
||||||
|
byte[] replacementBytes = new byte[1];
|
||||||
|
SECURE_RANDOM.nextBytes(replacementBytes);
|
||||||
|
newChar = Base64.getUrlEncoder().encodeToString(replacementBytes).charAt(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
token = token.replaceFirst(String.valueOf(originalChar), String.valueOf(newChar));
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String INSERT_SNAPSHOT = "INSERT INTO snapshots (token, creator) VALUES (?, ?);";
|
||||||
private static final String INSERT_MESSAGE = "INSERT INTO snapshotMessages (senderId, `server`, `time`, message, snapshotType) VALUES (?, ?, ?, ?, ?);";
|
private static final String INSERT_MESSAGE = "INSERT INTO snapshotMessages (senderId, `server`, `time`, message, snapshotType) VALUES (?, ?, ?, ?, ?);";
|
||||||
private static final String INSERT_MESSAGE_RECIPIENT = "INSERT INTO snapshotRecipients (messageId, recipientId) VALUES (?, ?);";
|
private static final String INSERT_MESSAGE_RECIPIENT = "INSERT INTO snapshotRecipients (messageId, recipientId) VALUES (?, ?);";
|
||||||
private static final String INSERT_MESSAGE_MAPPING = "INSERT INTO snapshotMessageMap (snapshotId, messageId) VALUES (?, ?);";
|
private static final String INSERT_MESSAGE_MAPPING = "INSERT INTO snapshotMessageMap (snapshotId, messageId) VALUES (?, ?);";
|
||||||
|
private static final String GET_ID_FROM_TOKEN = "SELECT snapshots.id FROM snapshots WHERE snapshots.token = ?;";
|
||||||
|
private static final String GET_METADATA = "SELECT token, creator FROM snapshots WHERE id = ?;";
|
||||||
|
private static final String SET_TOKEN = "UPDATE snapshots SET token = ? WHERE id = ?;";
|
||||||
|
|
||||||
private final String _serverName;
|
private final String _serverName;
|
||||||
private final Logger _logger;
|
private final Logger _logger;
|
||||||
@ -41,17 +82,17 @@ public class SnapshotRepository
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<Integer> saveReportSnapshot(Report report, Collection<SnapshotMessage> messages)
|
public CompletableFuture<SnapshotMetadata> saveReportSnapshot(Report report, Collection<SnapshotMessage> messages)
|
||||||
{
|
{
|
||||||
return CompletableFuture.supplyAsync(() ->
|
return CompletableFuture.supplyAsync(() ->
|
||||||
{
|
{
|
||||||
try (Connection connection = DBPool.getAccount().getConnection())
|
try (Connection connection = DBPool.getAccount().getConnection())
|
||||||
{
|
{
|
||||||
int snapshotId = report.getSnapshotId().orElseThrow(() ->
|
SnapshotMetadata snapshotMetadata = report.getSnapshotMetadata().orElseThrow(() ->
|
||||||
new IllegalStateException("Report does not have associated snapshot id."));
|
new IllegalStateException("Report does not have associated snapshot."));
|
||||||
|
|
||||||
insertMessages(snapshotId, messages, connection);
|
insertMessages(snapshotMetadata.getId(), messages, connection);
|
||||||
return snapshotId;
|
return snapshotMetadata;
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
@ -60,15 +101,15 @@ public class SnapshotRepository
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<Integer> saveSnapshot(Collection<SnapshotMessage> messages)
|
public CompletableFuture<SnapshotMetadata> saveSnapshot(Collection<SnapshotMessage> messages)
|
||||||
{
|
{
|
||||||
return CompletableFuture.supplyAsync(() ->
|
return CompletableFuture.supplyAsync(() ->
|
||||||
{
|
{
|
||||||
try (Connection connection = DBPool.getAccount().getConnection())
|
try (Connection connection = DBPool.getAccount().getConnection())
|
||||||
{
|
{
|
||||||
int snapshotId = createSnapshot(connection, null);
|
SnapshotMetadata snapshotMetadata = createSnapshot(connection, null);
|
||||||
insertMessages(snapshotId, messages, connection);
|
insertMessages(snapshotMetadata.getId(), messages, connection);
|
||||||
return snapshotId;
|
return snapshotMetadata;
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
@ -77,7 +118,7 @@ public class SnapshotRepository
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public CompletableFuture<Integer> createSnapshot(Integer creatorAccountId)
|
public CompletableFuture<SnapshotMetadata> createSnapshot(Integer creatorAccountId)
|
||||||
{
|
{
|
||||||
return CompletableFuture.supplyAsync(() ->
|
return CompletableFuture.supplyAsync(() ->
|
||||||
{
|
{
|
||||||
@ -92,17 +133,19 @@ public class SnapshotRepository
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private int createSnapshot(Connection connection, Integer creatorAccount) throws SQLException
|
private SnapshotMetadata createSnapshot(Connection connection, Integer creatorAccount) throws SQLException
|
||||||
{
|
{
|
||||||
|
String token = getUnusedToken(connection);
|
||||||
PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_SNAPSHOT, new String[]{"id"});
|
PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_SNAPSHOT, new String[]{"id"});
|
||||||
|
insertSnapshotStatement.setString(1, token);
|
||||||
|
|
||||||
if (creatorAccount != null)
|
if (creatorAccount != null)
|
||||||
{
|
{
|
||||||
insertSnapshotStatement.setInt(1, creatorAccount);
|
insertSnapshotStatement.setInt(2, creatorAccount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
insertSnapshotStatement.setNull(1, Types.INTEGER);
|
insertSnapshotStatement.setNull(2, Types.INTEGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
insertSnapshotStatement.execute();
|
insertSnapshotStatement.execute();
|
||||||
@ -111,7 +154,7 @@ public class SnapshotRepository
|
|||||||
{
|
{
|
||||||
if (resultSet.next())
|
if (resultSet.next())
|
||||||
{
|
{
|
||||||
return resultSet.getInt(1);
|
return new SnapshotMetadata(resultSet.getInt(1), token, creatorAccount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -120,6 +163,97 @@ public class SnapshotRepository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getUnusedToken(Connection connection) throws SQLException
|
||||||
|
{
|
||||||
|
String token;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
token = generateToken();
|
||||||
|
}
|
||||||
|
while(getByToken(connection, token).isPresent());
|
||||||
|
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Optional<Integer> getByToken(Connection connection, String token) throws SQLException
|
||||||
|
{
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement(GET_ID_FROM_TOKEN))
|
||||||
|
{
|
||||||
|
statement.setString(1, token);
|
||||||
|
|
||||||
|
try (ResultSet resultSet = statement.executeQuery())
|
||||||
|
{
|
||||||
|
if (resultSet.next())
|
||||||
|
{
|
||||||
|
int snapshotId = resultSet.getInt("id");
|
||||||
|
return Optional.of(snapshotId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Optional.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompletableFuture<SnapshotMetadata> getSnapshotMetadata(int snapshotId)
|
||||||
|
{
|
||||||
|
CompletableFuture<SnapshotMetadata> future = CompletableFuture.supplyAsync(() ->
|
||||||
|
{
|
||||||
|
try (Connection connection = DBPool.getAccount().getConnection())
|
||||||
|
{
|
||||||
|
try (PreparedStatement statement = connection.prepareStatement(GET_METADATA))
|
||||||
|
{
|
||||||
|
statement.setInt(1, snapshotId);
|
||||||
|
|
||||||
|
ResultSet resultSet = statement.executeQuery();
|
||||||
|
if (resultSet.next())
|
||||||
|
{
|
||||||
|
String token = resultSet.getString("token");
|
||||||
|
if (resultSet.wasNull())
|
||||||
|
{
|
||||||
|
// assign token to snapshot if it doesn't have one
|
||||||
|
token = getUnusedToken(connection);
|
||||||
|
setToken(connection, snapshotId, token);
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer creatorId = resultSet.getInt("creator");
|
||||||
|
if (resultSet.wasNull()) creatorId = null;
|
||||||
|
|
||||||
|
return new SnapshotMetadata(snapshotId, token, creatorId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
future.exceptionally(throwable ->
|
||||||
|
{
|
||||||
|
_logger.log(Level.SEVERE, "Error whilst getting snapshot metadata for id: " + snapshotId, throwable);
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
|
||||||
|
return future;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setToken(Connection connection, int snapshotId, String token) throws SQLException
|
||||||
|
{
|
||||||
|
try (PreparedStatement setTokenStatement = connection.prepareStatement(SET_TOKEN))
|
||||||
|
{
|
||||||
|
setTokenStatement.setString(1, token);
|
||||||
|
setTokenStatement.setInt(2, snapshotId);
|
||||||
|
setTokenStatement.execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void insertMessages(int snapshotId, Collection<SnapshotMessage> messages, Connection connection) throws SQLException
|
private void insertMessages(int snapshotId, Collection<SnapshotMessage> messages, Connection connection) throws SQLException
|
||||||
{
|
{
|
||||||
try (PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_MESSAGE, new String[]{"id"}))
|
try (PreparedStatement insertSnapshotStatement = connection.prepareStatement(INSERT_MESSAGE, new String[]{"id"}))
|
||||||
|
@ -1,15 +1,28 @@
|
|||||||
package mineplex.core.cosmetic.ui.page;
|
package mineplex.core.cosmetic.ui.page;
|
||||||
|
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.TextStyle;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.BannerMeta;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.currency.GlobalCurrency;
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.common.util.banner.CountryFlag;
|
import mineplex.core.common.util.banner.CountryFlag;
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||||
@ -28,12 +41,6 @@ import mineplex.core.shop.item.IButton;
|
|||||||
import mineplex.core.shop.item.SalesPackageProcessor;
|
import mineplex.core.shop.item.SalesPackageProcessor;
|
||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.BannerMeta;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
|
|
||||||
public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||||
{
|
{
|
||||||
@ -145,6 +152,22 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
itemLore.add(C.cBlack);
|
itemLore.add(C.cBlack);
|
||||||
itemLore.add(C.cBlue + "Found in Haunted Chests");
|
itemLore.add(C.cBlue + "Found in Haunted Chests");
|
||||||
}
|
}
|
||||||
|
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -14)
|
||||||
|
{
|
||||||
|
itemLore.add(C.cBlack);
|
||||||
|
YearMonth yearMonth = gadget.getYearMonth();
|
||||||
|
if (yearMonth != null)
|
||||||
|
{
|
||||||
|
int year = yearMonth.getYear();
|
||||||
|
Month month = yearMonth.getMonth();
|
||||||
|
String monthName = month.getDisplayName(TextStyle.FULL, Locale.US);
|
||||||
|
itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemLore.add(C.cBlue + "Found in Power Play Club");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Rank Unlocks
|
//Rank Unlocks
|
||||||
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
|
else if (gadget.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
|
||||||
|
@ -1,12 +1,22 @@
|
|||||||
package mineplex.core.cosmetic.ui.page;
|
package mineplex.core.cosmetic.ui.page;
|
||||||
|
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.time.format.TextStyle;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.currency.GlobalCurrency;
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||||
import mineplex.core.cosmetic.ui.button.MountButton;
|
import mineplex.core.cosmetic.ui.button.MountButton;
|
||||||
@ -17,9 +27,6 @@ import mineplex.core.mount.Mount;
|
|||||||
import mineplex.core.shop.item.IButton;
|
import mineplex.core.shop.item.IButton;
|
||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
|
|
||||||
public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||||
{
|
{
|
||||||
@ -99,8 +106,25 @@ public class MountPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -9)
|
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -9)
|
||||||
{
|
{
|
||||||
itemLore.add(C.cBlack);
|
itemLore.add(C.cBlack);
|
||||||
itemLore.add(C.cBlue + "Found in Halloween Chests");
|
itemLore.add(C.cBlue + "Found in Haunted Chests");
|
||||||
}
|
}
|
||||||
|
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -14)
|
||||||
|
{
|
||||||
|
itemLore.add(C.cBlack);
|
||||||
|
YearMonth yearMonth = mount.getYearMonth();
|
||||||
|
if (yearMonth != null)
|
||||||
|
{
|
||||||
|
int year = yearMonth.getYear();
|
||||||
|
Month month = yearMonth.getMonth();
|
||||||
|
String monthName = month.getDisplayName(TextStyle.FULL, Locale.US);
|
||||||
|
itemLore.addAll(UtilText.splitLine(C.cBlue + "Monthly Power Play Club Reward for " + monthName + " " + year, LineFormat.LORE));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemLore.add(C.cBlue + "Found in Power Play Club");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Rank Unlocks
|
//Rank Unlocks
|
||||||
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
|
else if (mount.getCost(GlobalCurrency.TREASURE_SHARD) == -10)
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,19 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.Blocks;
|
||||||
|
import net.minecraft.server.v1_8_R3.ChatMessage;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
|
import net.minecraft.server.v1_8_R3.Items;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutOpenWindow;
|
||||||
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSetSlot;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.currency.GlobalCurrency;
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -24,12 +37,6 @@ import mineplex.core.shop.item.IButton;
|
|||||||
import mineplex.core.shop.item.ShopItem;
|
import mineplex.core.shop.item.ShopItem;
|
||||||
import mineplex.core.shop.page.AnvilContainer;
|
import mineplex.core.shop.page.AnvilContainer;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
import net.minecraft.server.v1_8_R3.*;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
|
|
||||||
public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||||
{
|
{
|
||||||
@ -98,7 +105,12 @@ public class PetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -9)
|
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -9)
|
||||||
{
|
{
|
||||||
itemLore.add(C.cBlack);
|
itemLore.add(C.cBlack);
|
||||||
itemLore.add(C.cBlue + "Found in Halloween Chests");
|
itemLore.add(C.cBlue + "Found in Haunted Chests");
|
||||||
|
}
|
||||||
|
else if (pet.getCost(GlobalCurrency.TREASURE_SHARD) == -14)
|
||||||
|
{
|
||||||
|
itemLore.add(C.cBlack);
|
||||||
|
itemLore.add(C.cBlue + "Found in Power Play Club");
|
||||||
}
|
}
|
||||||
|
|
||||||
//Rank Unlocks
|
//Rank Unlocks
|
||||||
|
@ -109,6 +109,19 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
createBedChunk();
|
createBedChunk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void cleanupLazyCallers(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SLOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_spawnPacketMap.values().forEach(list -> list.removeIf(base -> base.getEntity() == null));
|
||||||
|
_spawnPacketMap.values().removeIf(list -> list.size() == 0);
|
||||||
|
_entityDisguiseMap.values().forEach(list -> list.removeIf(base -> base.getEntity() == null));
|
||||||
|
_entityDisguiseMap.values().removeIf(list -> list.size() == 0);
|
||||||
|
_disguisePlayerMap.keySet().removeIf(base -> base.getEntity() == null);
|
||||||
|
}
|
||||||
|
|
||||||
// We want to re-register entities that were reloaded by chunk loading
|
// We want to re-register entities that were reloaded by chunk loading
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityAdd(ChunkAddEntityEvent event)
|
public void onEntityAdd(ChunkAddEntityEvent event)
|
||||||
@ -261,7 +274,11 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
|||||||
entityPlayer.playerConnection.networkManager.handle(((DisguisePlayer) originalDisguise).getUndisguiseInfoPackets(true));
|
entityPlayer.playerConnection.networkManager.handle(((DisguisePlayer) originalDisguise).getUndisguiseInfoPackets(true));
|
||||||
if (reason != UndisguiseReason.QUIT)
|
if (reason != UndisguiseReason.QUIT)
|
||||||
{
|
{
|
||||||
entityPlayer.playerConnection.networkManager.handle(((DisguisePlayer) originalDisguise).getUndisguiseInfoPackets(false));
|
Packet add = ((DisguisePlayer) originalDisguise).getUndisguiseInfoPackets(false);
|
||||||
|
if (add != null)
|
||||||
|
{
|
||||||
|
entityPlayer.playerConnection.networkManager.handle(add);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,15 +51,15 @@ public class DisguiseArmorStand extends DisguiseInsentient
|
|||||||
public Packet getSpawnPacket()
|
public Packet getSpawnPacket()
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = getEntity().getId();
|
||||||
packet.b = (byte) 30;
|
packet.b = (byte) 30;
|
||||||
packet.c = (int) MathHelper.floor(Entity.locX * 32.0D);
|
packet.c = (int) MathHelper.floor(getEntity().locX * 32.0D);
|
||||||
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D);
|
||||||
packet.e = (int) MathHelper.floor(Entity.locZ * 32.0D);
|
packet.e = (int) MathHelper.floor(getEntity().locZ * 32.0D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
|
packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F));
|
||||||
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.uuid = Entity.getUniqueID();
|
packet.uuid = getEntity().getUniqueID();
|
||||||
|
|
||||||
double var2 = 3.9D;
|
double var2 = 3.9D;
|
||||||
double var4 = 0;
|
double var4 = 0;
|
||||||
|
@ -17,13 +17,15 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class DisguiseBase
|
public abstract class DisguiseBase
|
||||||
{
|
{
|
||||||
protected Entity Entity;
|
private WeakReference<Entity> _entity = new WeakReference<>(null);
|
||||||
|
|
||||||
protected DataWatcher DataWatcher;
|
protected DataWatcher DataWatcher;
|
||||||
|
|
||||||
private DisguiseBase _soundDisguise;
|
private DisguiseBase _soundDisguise;
|
||||||
@ -56,18 +58,18 @@ public abstract class DisguiseBase
|
|||||||
|
|
||||||
public void attemptToSpawn()
|
public void attemptToSpawn()
|
||||||
{
|
{
|
||||||
this.Entity.world.addEntity(this.Entity, CreatureSpawnEvent.SpawnReason.CUSTOM);
|
this.getEntity().world.addEntity(this.getEntity(), CreatureSpawnEvent.SpawnReason.CUSTOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntity(org.bukkit.entity.Entity entity)
|
public void setEntity(org.bukkit.entity.Entity entity)
|
||||||
{
|
{
|
||||||
Entity = ((CraftEntity) entity).getHandle();
|
setEntity(((CraftEntity) entity).getHandle());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateDataWatcher()
|
public void UpdateDataWatcher()
|
||||||
{
|
{
|
||||||
DataWatcher.watch(0, Entity.getDataWatcher().getByte(0), net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, Entity.getDataWatcher().getByte(0));
|
DataWatcher.watch(0, getEntity().getDataWatcher().getByte(0), net.minecraft.server.v1_8_R3.Entity.META_ENTITYDATA, getEntity().getDataWatcher().getByte(0));
|
||||||
DataWatcher.watch(1, Entity.getDataWatcher().getShort(1), net.minecraft.server.v1_8_R3.Entity.META_AIR, (int) Entity.getDataWatcher().getShort(1));
|
DataWatcher.watch(1, getEntity().getDataWatcher().getShort(1), net.minecraft.server.v1_8_R3.Entity.META_AIR, (int) getEntity().getDataWatcher().getShort(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Packet getSpawnPacket();
|
public abstract Packet getSpawnPacket();
|
||||||
@ -75,22 +77,22 @@ public abstract class DisguiseBase
|
|||||||
public Packet getMetadataPacket()
|
public Packet getMetadataPacket()
|
||||||
{
|
{
|
||||||
UpdateDataWatcher();
|
UpdateDataWatcher();
|
||||||
return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true);
|
return new PacketPlayOutEntityMetadata(getEntity().getId(), DataWatcher, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resendMetadata()
|
public void resendMetadata()
|
||||||
{
|
{
|
||||||
if (Entity == null || !Entity.getBukkitEntity().isValid() || !(Entity.world instanceof WorldServer))
|
if (getEntity() == null || !getEntity().getBukkitEntity().isValid() || !(getEntity().world instanceof WorldServer))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) Entity.world).tracker.trackedEntities;
|
IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) getEntity().world).tracker.trackedEntities;
|
||||||
|
|
||||||
if (tracker.get(Entity.getId()) == null)
|
if (tracker.get(getEntity().getId()) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Packet packet = getMetadataPacket();
|
Packet packet = getMetadataPacket();
|
||||||
|
|
||||||
for (EntityPlayer player : tracker.get(Entity.getId()).trackedPlayers)
|
for (EntityPlayer player : tracker.get(getEntity().getId()).trackedPlayers)
|
||||||
{
|
{
|
||||||
UtilPlayer.sendPacket(player.getBukkitEntity(), packet);
|
UtilPlayer.sendPacket(player.getBukkitEntity(), packet);
|
||||||
}
|
}
|
||||||
@ -106,17 +108,17 @@ public abstract class DisguiseBase
|
|||||||
|
|
||||||
public void playHurtSound()
|
public void playHurtSound()
|
||||||
{
|
{
|
||||||
Entity.world.makeSound(Entity, _soundDisguise.getHurtSound(), _soundDisguise.getVolume(), _soundDisguise.getPitch());
|
getEntity().world.makeSound(getEntity(), _soundDisguise.getHurtSound(), _soundDisguise.getVolume(), _soundDisguise.getPitch());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity getEntity()
|
public Entity getEntity()
|
||||||
{
|
{
|
||||||
return Entity;
|
return _entity.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEntityId()
|
public int getEntityId()
|
||||||
{
|
{
|
||||||
return Entity.getId();
|
return getEntity().getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract String getHurtSound();
|
protected abstract String getHurtSound();
|
||||||
@ -128,13 +130,13 @@ public abstract class DisguiseBase
|
|||||||
public List<Player> getTrackedPlayers()
|
public List<Player> getTrackedPlayers()
|
||||||
{
|
{
|
||||||
List<Player> players = new ArrayList<>();
|
List<Player> players = new ArrayList<>();
|
||||||
IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) Entity.world).tracker.trackedEntities;
|
IntHashMap<EntityTrackerEntry> tracker = ((WorldServer) getEntity().world).tracker.trackedEntities;
|
||||||
if (tracker.get(Entity.getId()) == null)
|
if (tracker.get(getEntity().getId()) == null)
|
||||||
{
|
{
|
||||||
System.out.println("Tracker did not contain " + Entity.getId() + " " + Entity.getCustomName() + " " + Entity.dead + " " + Entity.locX + " " + Entity.locY + " " + Entity.locZ);
|
System.out.println("Tracker did not contain " + getEntity().getId() + " " + getEntity().getCustomName() + " " + getEntity().dead + " " + getEntity().locX + " " + getEntity().locY + " " + getEntity().locZ);
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
for (EntityPlayer ep : tracker.get(Entity.getId()).trackedPlayers)
|
for (EntityPlayer ep : tracker.get(getEntity().getId()).trackedPlayers)
|
||||||
{
|
{
|
||||||
players.add(ep.getBukkitEntity());
|
players.add(ep.getBukkitEntity());
|
||||||
}
|
}
|
||||||
@ -194,4 +196,10 @@ public abstract class DisguiseBase
|
|||||||
{
|
{
|
||||||
return this._disguiseType;
|
return this._disguiseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEntity(net.minecraft.server.v1_8_R3.Entity entity)
|
||||||
|
{
|
||||||
|
_entity.clear();
|
||||||
|
_entity = new WeakReference<>(entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,19 +36,19 @@ public class DisguiseBlock extends DisguiseBase
|
|||||||
public Packet getSpawnPacket()
|
public Packet getSpawnPacket()
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();
|
PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity();
|
||||||
packet.a = Entity.getId();
|
packet.a = getEntity().getId();
|
||||||
packet.b = MathHelper.floor(Entity.locX * 32.0D);
|
packet.b = MathHelper.floor(getEntity().locX * 32.0D);
|
||||||
packet.c = MathHelper.floor(Entity.locY * 32.0D);
|
packet.c = MathHelper.floor(getEntity().locY * 32.0D);
|
||||||
packet.d = MathHelper.floor(Entity.locZ * 32.0D);
|
packet.d = MathHelper.floor(getEntity().locZ * 32.0D);
|
||||||
packet.h = MathHelper.d(Entity.pitch * 256.0F / 360.0F);
|
packet.h = MathHelper.d(getEntity().pitch * 256.0F / 360.0F);
|
||||||
packet.i = MathHelper.d(Entity.yaw * 256.0F / 360.0F);
|
packet.i = MathHelper.d(getEntity().yaw * 256.0F / 360.0F);
|
||||||
packet.j = 70;
|
packet.j = 70;
|
||||||
packet.k = _blockId | _blockData << 12;
|
packet.k = _blockId | _blockData << 12;
|
||||||
packet.uuid = Entity.getUniqueID();
|
packet.uuid = getEntity().getUniqueID();
|
||||||
|
|
||||||
double d1 = Entity.motX;
|
double d1 = getEntity().motX;
|
||||||
double d2 = Entity.motY;
|
double d2 = getEntity().motY;
|
||||||
double d3 = Entity.motZ;
|
double d3 = getEntity().motZ;
|
||||||
double d4 = 3.9D;
|
double d4 = 3.9D;
|
||||||
|
|
||||||
if (d1 < -d4)
|
if (d1 < -d4)
|
||||||
|
@ -16,15 +16,15 @@ public abstract class DisguiseCreature extends DisguiseInsentient
|
|||||||
public Packet getSpawnPacket()
|
public Packet getSpawnPacket()
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = getEntity().getId();
|
||||||
packet.b = (byte) getDisguiseType().getTypeId();
|
packet.b = (byte) getDisguiseType().getTypeId();
|
||||||
packet.c = (int) MathHelper.floor(Entity.locX*32D);
|
packet.c = (int) MathHelper.floor(getEntity().locX*32D);
|
||||||
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D);
|
||||||
packet.e = (int) MathHelper.floor(Entity.locZ*32D);
|
packet.e = (int) MathHelper.floor(getEntity().locZ*32D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
|
packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F));
|
||||||
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.uuid = Entity.getUniqueID();
|
packet.uuid = getEntity().getUniqueID();
|
||||||
|
|
||||||
double var2 = 3.9D;
|
double var2 = 3.9D;
|
||||||
double var4 = 0;
|
double var4 = 0;
|
||||||
|
@ -36,7 +36,7 @@ public class DisguiseEnderman extends DisguiseMonster
|
|||||||
{
|
{
|
||||||
super.UpdateDataWatcher();
|
super.UpdateDataWatcher();
|
||||||
|
|
||||||
DataWatcher.watch(0, Byte.valueOf((byte) (DataWatcher.getByte(0) & ~(1 << 0))), Entity.META_ENTITYDATA,
|
DataWatcher.watch(0, Byte.valueOf((byte) (DataWatcher.getByte(0) & ~(1 << 0))), getEntity().META_ENTITYDATA,
|
||||||
(byte) (DataWatcher.getByte(0) & ~(1 << 0)));
|
(byte) (DataWatcher.getByte(0) & ~(1 << 0)));
|
||||||
DataWatcher.watch(16, DataWatcher.getShort(16), EntityEnderman.META_BLOCK, getBlock(DataWatcher.getShort(16)));
|
DataWatcher.watch(16, DataWatcher.getShort(16), EntityEnderman.META_BLOCK, getBlock(DataWatcher.getShort(16)));
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,9 @@ public abstract class DisguiseLiving extends DisguiseBase
|
|||||||
{
|
{
|
||||||
ItemStack item = null;
|
ItemStack item = null;
|
||||||
|
|
||||||
if (Entity instanceof EntityLiving)
|
if (getEntity() instanceof EntityLiving)
|
||||||
{
|
{
|
||||||
item = CraftItemStack.asBukkitCopy(((EntityLiving) Entity).getEquipment()[nmsSlot]);
|
item = CraftItemStack.asBukkitCopy(((EntityLiving) getEntity()).getEquipment()[nmsSlot]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null || item.getType() == Material.AIR)
|
if (item == null || item.getType() == Material.AIR)
|
||||||
@ -111,15 +111,15 @@ public abstract class DisguiseLiving extends DisguiseBase
|
|||||||
else
|
else
|
||||||
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 5))), EntityLiving.META_ENTITYDATA, (byte) (b0 & ~(1 << 5)));
|
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 5))), EntityLiving.META_ENTITYDATA, (byte) (b0 & ~(1 << 5)));
|
||||||
|
|
||||||
if (Entity instanceof EntityLiving)
|
if (getEntity() instanceof EntityLiving)
|
||||||
{
|
{
|
||||||
DataWatcher.watch(6, Entity.getDataWatcher().getFloat(6), EntityLiving.META_HEALTH,
|
DataWatcher.watch(6, getEntity().getDataWatcher().getFloat(6), EntityLiving.META_HEALTH,
|
||||||
Entity.getDataWatcher().getFloat(6));
|
getEntity().getDataWatcher().getFloat(6));
|
||||||
DataWatcher.watch(7, Entity.getDataWatcher().getInt(7), EntityLiving.META_POTION_COLOR, Entity.getDataWatcher()
|
DataWatcher.watch(7, getEntity().getDataWatcher().getInt(7), EntityLiving.META_POTION_COLOR, getEntity().getDataWatcher()
|
||||||
.getInt(7));
|
.getInt(7));
|
||||||
DataWatcher.watch(8, Entity.getDataWatcher().getByte(8), EntityLiving.META_AMBIENT_POTION, Entity.getDataWatcher()
|
DataWatcher.watch(8, getEntity().getDataWatcher().getByte(8), EntityLiving.META_AMBIENT_POTION, getEntity().getDataWatcher()
|
||||||
.getByte(8) == 1);
|
.getByte(8) == 1);
|
||||||
DataWatcher.watch(9, Entity.getDataWatcher().getByte(9), EntityLiving.META_ARROWS, (int) Entity.getDataWatcher()
|
DataWatcher.watch(9, getEntity().getDataWatcher().getByte(9), EntityLiving.META_ARROWS, (int) getEntity().getDataWatcher()
|
||||||
.getByte(9));
|
.getByte(9));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,15 +28,15 @@ public class DisguiseMagmaCube extends DisguiseInsentient
|
|||||||
public Packet getSpawnPacket()
|
public Packet getSpawnPacket()
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = getEntity().getId();
|
||||||
packet.b = (byte) 62;
|
packet.b = (byte) 62;
|
||||||
packet.c = (int) MathHelper.floor(Entity.locX * 32D);
|
packet.c = (int) MathHelper.floor(getEntity().locX * 32D);
|
||||||
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D);
|
||||||
packet.e = (int) MathHelper.floor(Entity.locZ * 32D);
|
packet.e = (int) MathHelper.floor(getEntity().locZ * 32D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
|
packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F));
|
||||||
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.uuid = Entity.getUniqueID();
|
packet.uuid = getEntity().getUniqueID();
|
||||||
|
|
||||||
double var2 = 3.9D;
|
double var2 = 3.9D;
|
||||||
double var4 = 0;
|
double var4 = 0;
|
||||||
|
@ -202,7 +202,7 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
|
|
||||||
byte b0 = DataWatcher.getByte(0);
|
byte b0 = DataWatcher.getByte(0);
|
||||||
|
|
||||||
if (Entity.isSneaking())
|
if (getEntity().isSneaking())
|
||||||
{
|
{
|
||||||
DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 1)), EntityHuman.META_ENTITYDATA, (byte) (b0 | 1 << 1));
|
DataWatcher.watch(0, Byte.valueOf((byte) (b0 | 1 << 1)), EntityHuman.META_ENTITYDATA, (byte) (b0 | 1 << 1));
|
||||||
}
|
}
|
||||||
@ -211,9 +211,9 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 1))), EntityHuman.META_ENTITYDATA, (byte) (b0 & ~(1 << 1)));
|
DataWatcher.watch(0, Byte.valueOf((byte) (b0 & ~(1 << 1))), EntityHuman.META_ENTITYDATA, (byte) (b0 & ~(1 << 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Entity instanceof EntityPlayer)
|
if (getEntity() instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
EntityPlayer entityPlayer = (EntityPlayer) Entity;
|
EntityPlayer entityPlayer = (EntityPlayer) getEntity();
|
||||||
|
|
||||||
DataWatcher.watch(10, entityPlayer.getDataWatcher().getByte(10), EntityPlayer.META_SKIN, entityPlayer.getDataWatcher().getByte(10));
|
DataWatcher.watch(10, entityPlayer.getDataWatcher().getByte(10), EntityPlayer.META_SKIN, entityPlayer.getDataWatcher().getByte(10));
|
||||||
DataWatcher.watch(16, (byte) 0, EntityPlayer.META_CAPE, (byte) 1);
|
DataWatcher.watch(16, (byte) 0, EntityPlayer.META_CAPE, (byte) 1);
|
||||||
@ -224,13 +224,13 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
public PacketPlayOutNamedEntitySpawn getSpawnPacket()
|
public PacketPlayOutNamedEntitySpawn getSpawnPacket()
|
||||||
{
|
{
|
||||||
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
||||||
packet.a = Entity.getId();
|
packet.a = getEntity().getId();
|
||||||
packet.b = _profile.getId();
|
packet.b = _profile.getId();
|
||||||
packet.c = MathHelper.floor(Entity.locX * 32.0D);
|
packet.c = MathHelper.floor(getEntity().locX * 32.0D);
|
||||||
packet.d = MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = MathHelper.floor(getEntity().locY * 32.0D);
|
||||||
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
|
packet.e = MathHelper.floor(getEntity().locZ * 32.0D);
|
||||||
packet.f = (byte) ((int) ((Entity.isFakeHead() ? Entity.fakePitch : Entity.pitch) * 256.0F / 360.0F));
|
packet.f = (byte) ((int) ((getEntity().isFakeHead() ? getEntity().fakePitch : getEntity().pitch) * 256.0F / 360.0F));
|
||||||
packet.g = (byte) ((int) ((Entity.isFakeHead() ? Entity.fakePitch : Entity.pitch) * 256.0F / 360.0F));
|
packet.g = (byte) ((int) ((getEntity().isFakeHead() ? getEntity().fakePitch : getEntity().pitch) * 256.0F / 360.0F));
|
||||||
packet.i = DataWatcher;
|
packet.i = DataWatcher;
|
||||||
|
|
||||||
return packet;
|
return packet;
|
||||||
@ -253,11 +253,11 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
@Override
|
@Override
|
||||||
public void onDisguise(boolean isActive)
|
public void onDisguise(boolean isActive)
|
||||||
{
|
{
|
||||||
if (this.Entity instanceof EntityPlayer)
|
if (this.getEntity() instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
if (_sendSkinToSelf)
|
if (_sendSkinToSelf)
|
||||||
{
|
{
|
||||||
EntityPlayer entityPlayer = ((EntityPlayer) this.Entity);
|
EntityPlayer entityPlayer = ((EntityPlayer) this.getEntity());
|
||||||
|
|
||||||
// First construct the packet which will remove the previous disguise from the tab list
|
// First construct the packet which will remove the previous disguise from the tab list
|
||||||
PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER);
|
PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER);
|
||||||
@ -285,11 +285,11 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
@Override
|
@Override
|
||||||
public void onUndisguise(boolean wasActive)
|
public void onUndisguise(boolean wasActive)
|
||||||
{
|
{
|
||||||
if (this.Entity instanceof EntityPlayer)
|
if (this.getEntity() instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
if (_sendSkinToSelf)
|
if (_sendSkinToSelf)
|
||||||
{
|
{
|
||||||
EntityPlayer entityPlayer = ((EntityPlayer) this.Entity);
|
EntityPlayer entityPlayer = ((EntityPlayer) this.getEntity());
|
||||||
|
|
||||||
// First construct the packet which will remove the previous disguise from the tab list
|
// First construct the packet which will remove the previous disguise from the tab list
|
||||||
PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER);
|
PacketPlayOutPlayerInfo playerInfoPacketRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER);
|
||||||
@ -320,9 +320,9 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
{
|
{
|
||||||
if (disguise instanceof DisguisePlayer)
|
if (disguise instanceof DisguisePlayer)
|
||||||
{
|
{
|
||||||
if (((DisguisePlayer) disguise).getSendSkinDataToSelf() && _sendSkinToSelf && this.Entity instanceof EntityPlayer)
|
if (((DisguisePlayer) disguise).getSendSkinDataToSelf() && _sendSkinToSelf && this.getEntity() instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
EntityPlayer entityPlayer = ((EntityPlayer) this.Entity);
|
EntityPlayer entityPlayer = ((EntityPlayer) this.getEntity());
|
||||||
|
|
||||||
PacketPlayOutPlayerInfo playerInfoRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER);
|
PacketPlayOutPlayerInfo playerInfoRemove = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER);
|
||||||
PacketPlayOutPlayerInfo.PlayerInfoData data = playerInfoRemove.new PlayerInfoData(getSelfProfile(), entityPlayer.ping, getAppropriateGamemode(), null);
|
PacketPlayOutPlayerInfo.PlayerInfoData data = playerInfoRemove.new PlayerInfoData(getSelfProfile(), entityPlayer.ping, getAppropriateGamemode(), null);
|
||||||
@ -338,9 +338,9 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
{
|
{
|
||||||
if (disguise instanceof DisguisePlayer)
|
if (disguise instanceof DisguisePlayer)
|
||||||
{
|
{
|
||||||
if (((DisguisePlayer) disguise).getSendSkinDataToSelf() && _sendSkinToSelf && this.Entity instanceof EntityPlayer)
|
if (((DisguisePlayer) disguise).getSendSkinDataToSelf() && _sendSkinToSelf && this.getEntity() instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
EntityPlayer entityPlayer = ((EntityPlayer) this.Entity);
|
EntityPlayer entityPlayer = ((EntityPlayer) this.getEntity());
|
||||||
|
|
||||||
PacketPlayOutPlayerInfo playerInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER);
|
PacketPlayOutPlayerInfo playerInfoPacket = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER);
|
||||||
PacketPlayOutPlayerInfo.PlayerInfoData data = playerInfoPacket.new PlayerInfoData(((DisguisePlayer) disguise)._originalProfile, entityPlayer.ping, entityPlayer.playerInteractManager.getGameMode(), null);
|
PacketPlayOutPlayerInfo.PlayerInfoData data = playerInfoPacket.new PlayerInfoData(((DisguisePlayer) disguise)._originalProfile, entityPlayer.ping, entityPlayer.playerInteractManager.getGameMode(), null);
|
||||||
@ -421,9 +421,9 @@ public class DisguisePlayer extends DisguiseHuman
|
|||||||
|
|
||||||
private WorldSettings.EnumGamemode getAppropriateGamemode()
|
private WorldSettings.EnumGamemode getAppropriateGamemode()
|
||||||
{
|
{
|
||||||
if (Entity instanceof EntityPlayer)
|
if (getEntity() instanceof EntityPlayer)
|
||||||
{
|
{
|
||||||
return ((EntityPlayer) Entity).playerInteractManager.getGameMode();
|
return ((EntityPlayer) getEntity()).playerInteractManager.getGameMode();
|
||||||
}
|
}
|
||||||
return WorldSettings.EnumGamemode.SURVIVAL;
|
return WorldSettings.EnumGamemode.SURVIVAL;
|
||||||
}
|
}
|
||||||
|
@ -21,15 +21,15 @@ public class DisguiseRabbit extends DisguiseAnimal
|
|||||||
public Packet getSpawnPacket()
|
public Packet getSpawnPacket()
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = getEntity().getId();
|
||||||
packet.b = (byte) 101;
|
packet.b = (byte) 101;
|
||||||
packet.c = (int) MathHelper.floor(Entity.locX * 32D);
|
packet.c = (int) MathHelper.floor(getEntity().locX * 32D);
|
||||||
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D);
|
||||||
packet.e = (int) MathHelper.floor(Entity.locZ * 32D);
|
packet.e = (int) MathHelper.floor(getEntity().locZ * 32D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
|
packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F));
|
||||||
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.uuid = Entity.getUniqueID();
|
packet.uuid = getEntity().getUniqueID();
|
||||||
|
|
||||||
double var2 = 3.9D;
|
double var2 = 3.9D;
|
||||||
double var4 = 0;
|
double var4 = 0;
|
||||||
|
@ -28,15 +28,15 @@ public class DisguiseSlime extends DisguiseInsentient
|
|||||||
public Packet getSpawnPacket()
|
public Packet getSpawnPacket()
|
||||||
{
|
{
|
||||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||||
packet.a = Entity.getId();
|
packet.a = getEntity().getId();
|
||||||
packet.b = (byte) 55;
|
packet.b = (byte) 55;
|
||||||
packet.c = (int) MathHelper.floor(Entity.locX * 32D);
|
packet.c = (int) MathHelper.floor(getEntity().locX * 32D);
|
||||||
packet.d = (int) MathHelper.floor(Entity.locY * 32.0D);
|
packet.d = (int) MathHelper.floor(getEntity().locY * 32.0D);
|
||||||
packet.e = (int) MathHelper.floor(Entity.locZ * 32D);
|
packet.e = (int) MathHelper.floor(getEntity().locZ * 32D);
|
||||||
packet.i = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.i = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.j = (byte) ((int) (Entity.pitch * 256.0F / 360.0F));
|
packet.j = (byte) ((int) (getEntity().pitch * 256.0F / 360.0F));
|
||||||
packet.k = (byte) ((int) (Entity.yaw * 256.0F / 360.0F));
|
packet.k = (byte) ((int) (getEntity().yaw * 256.0F / 360.0F));
|
||||||
packet.uuid = Entity.getUniqueID();
|
packet.uuid = getEntity().getUniqueID();
|
||||||
|
|
||||||
double var2 = 3.9D;
|
double var2 = 3.9D;
|
||||||
double var4 = 0;
|
double var4 = 0;
|
||||||
|
@ -38,7 +38,6 @@ import mineplex.core.donation.DonationManager;
|
|||||||
import mineplex.core.gadget.commands.AmmoCommand;
|
import mineplex.core.gadget.commands.AmmoCommand;
|
||||||
import mineplex.core.gadget.commands.LockCosmeticsCommand;
|
import mineplex.core.gadget.commands.LockCosmeticsCommand;
|
||||||
import mineplex.core.gadget.commands.UnlockCosmeticsCommand;
|
import mineplex.core.gadget.commands.UnlockCosmeticsCommand;
|
||||||
import mineplex.core.gadget.commands.WinRoomTestCommand;
|
|
||||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||||
@ -121,6 +120,7 @@ import mineplex.core.gadget.gadgets.morph.MorphSlime;
|
|||||||
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
|
import mineplex.core.gadget.gadgets.morph.MorphSnowman;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphSquid;
|
import mineplex.core.gadget.gadgets.morph.MorphSquid;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphTitan;
|
import mineplex.core.gadget.gadgets.morph.MorphTitan;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.MorphTurkey;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphUncleSam;
|
import mineplex.core.gadget.gadgets.morph.MorphUncleSam;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphVillager;
|
import mineplex.core.gadget.gadgets.morph.MorphVillager;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphWitch;
|
import mineplex.core.gadget.gadgets.morph.MorphWitch;
|
||||||
@ -276,7 +276,6 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addCommand(new UnlockCosmeticsCommand(this));
|
addCommand(new UnlockCosmeticsCommand(this));
|
||||||
addCommand(new LockCosmeticsCommand(this));
|
addCommand(new LockCosmeticsCommand(this));
|
||||||
addCommand(new AmmoCommand(this));
|
addCommand(new AmmoCommand(this));
|
||||||
addCommand(new WinRoomTestCommand(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSets()
|
private void createSets()
|
||||||
@ -289,6 +288,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
//Costumes
|
//Costumes
|
||||||
addSet(new SetRaveSuit(this));
|
addSet(new SetRaveSuit(this));
|
||||||
addSet(new SetSpaceSuit(this));
|
addSet(new SetSpaceSuit(this));
|
||||||
|
// Hidden in this update
|
||||||
//addSet(new SetWindUpSuit(this));
|
//addSet(new SetWindUpSuit(this));
|
||||||
addSet(new SetParty(this));
|
addSet(new SetParty(this));
|
||||||
addSet(new SetCupidsLove(this));
|
addSet(new SetCupidsLove(this));
|
||||||
@ -335,6 +335,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new OutfitSpaceSuitLeggings(this));
|
addGadget(new OutfitSpaceSuitLeggings(this));
|
||||||
addGadget(new OutfitSpaceSuitBoots(this));
|
addGadget(new OutfitSpaceSuitBoots(this));
|
||||||
|
|
||||||
|
// Hidden in this update
|
||||||
/*addGadget(new OutfitWindUpSuitHelmet(this));
|
/*addGadget(new OutfitWindUpSuitHelmet(this));
|
||||||
addGadget(new OutfitWindUpSuitChestplate(this));
|
addGadget(new OutfitWindUpSuitChestplate(this));
|
||||||
addGadget(new OutfitWindUpSuitLeggings(this));
|
addGadget(new OutfitWindUpSuitLeggings(this));
|
||||||
@ -365,9 +366,11 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new MorphSquid(this));
|
addGadget(new MorphSquid(this));
|
||||||
addGadget(new MorphWitch(this));
|
addGadget(new MorphWitch(this));
|
||||||
addGadget(new MorphGrimReaper(this));
|
addGadget(new MorphGrimReaper(this));
|
||||||
// Not being added in this update!
|
addGadget(new MorphTurkey(this));
|
||||||
|
// Hidden in this update
|
||||||
|
//addGadget(new MorphSleigh(this));
|
||||||
//addGadget(new MorphMetalMan(this));
|
//addGadget(new MorphMetalMan(this));
|
||||||
|
|
||||||
// Particles
|
// Particles
|
||||||
addGadget(new ParticleFoot(this));
|
addGadget(new ParticleFoot(this));
|
||||||
addGadget(new ParticleFireRings(this));
|
addGadget(new ParticleFireRings(this));
|
||||||
|
@ -0,0 +1,85 @@
|
|||||||
|
package mineplex.core.gadget.commands;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Horse;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.EulerAngle;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
|
||||||
|
public class ReindeerTestCommand extends CommandBase<GadgetManager>
|
||||||
|
{
|
||||||
|
|
||||||
|
private GadgetManager _plugin;
|
||||||
|
private Horse _horse;
|
||||||
|
private ArmorStand _armorStand;
|
||||||
|
|
||||||
|
public ReindeerTestCommand(GadgetManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Rank.JNR_DEV, "reindeer");
|
||||||
|
_plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (_horse == null)
|
||||||
|
{
|
||||||
|
Location testHorse = new Location(caller.getWorld(), 8.5, 71, 0.5, 0, 0);
|
||||||
|
testHorse.setYaw(180);
|
||||||
|
Horse horse = testHorse.getWorld().spawn(testHorse, Horse.class);
|
||||||
|
horse.setVariant(Horse.Variant.HORSE);
|
||||||
|
horse.setColor(Horse.Color.BROWN);
|
||||||
|
horse.setStyle(Horse.Style.NONE);
|
||||||
|
|
||||||
|
UtilEnt.Vegetate(horse, true);
|
||||||
|
UtilEnt.ghost(horse, true, false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* South
|
||||||
|
* .4 1 .6
|
||||||
|
* .2 1 .7
|
||||||
|
* 0 4 0
|
||||||
|
* 0 2 0
|
||||||
|
*
|
||||||
|
* North
|
||||||
|
*/
|
||||||
|
|
||||||
|
Location hornALoc = horse.getLocation().clone().add(-.3, 1, -.5);
|
||||||
|
Location hornBLoc = horse.getLocation().clone().add(-.25, 1, -.6);
|
||||||
|
|
||||||
|
ArmorStand hornA = hornALoc.getWorld().spawn(hornALoc, ArmorStand.class);
|
||||||
|
hornA.setVisible(false);
|
||||||
|
hornA.setGravity(false);
|
||||||
|
hornA.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH));
|
||||||
|
hornA.setRightArmPose(new EulerAngle(0, 4, 0));
|
||||||
|
|
||||||
|
ArmorStand hornB = hornBLoc.getWorld().spawn(hornBLoc, ArmorStand.class);
|
||||||
|
hornB.setVisible(false);
|
||||||
|
hornB.setGravity(false);
|
||||||
|
hornB.getEquipment().setItemInHand(new ItemStack(Material.DEAD_BUSH));
|
||||||
|
hornB.setRightArmPose(new EulerAngle(0, 2, 0));
|
||||||
|
|
||||||
|
_horse = horse;
|
||||||
|
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(UtilServer.getPlugin(), new Runnable()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Location location = _horse.getLocation();
|
||||||
|
location.setYaw(180);
|
||||||
|
_horse.teleport(location);
|
||||||
|
}
|
||||||
|
}, 1l, 1l);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,72 +0,0 @@
|
|||||||
package mineplex.core.gadget.commands;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import mineplex.core.command.CommandBase;
|
|
||||||
import mineplex.core.common.Rank;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.gadgets.wineffect.*;
|
|
||||||
import mineplex.core.gadget.types.WinEffectGadget;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class WinRoomTestCommand extends CommandBase<GadgetManager>
|
|
||||||
{
|
|
||||||
|
|
||||||
private GadgetManager _manager;
|
|
||||||
|
|
||||||
public WinRoomTestCommand(GadgetManager manager)
|
|
||||||
{
|
|
||||||
super(manager, Rank.JNR_DEV, "winroomtest");
|
|
||||||
_manager = manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Execute(Player player, String[] args)
|
|
||||||
{
|
|
||||||
if (args.length < 1 || args.length > 2)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Win Rooms", "Usage: /winroomtest <room name> [play]"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
boolean play = false;
|
|
||||||
if (args.length == 2)
|
|
||||||
{
|
|
||||||
if (args[1].equalsIgnoreCase("true"))
|
|
||||||
{
|
|
||||||
play = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
loadWinRoom(args[0], player, play);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadWinRoom(String roomName, Player player, boolean play)
|
|
||||||
{
|
|
||||||
List<String> names = Arrays.asList("BabyChicken", "DragonRider", "Fireworks", "Flames", "Halloween", "LavaTrap",
|
|
||||||
"LightningStrike", "MrPunchMan", "Podium", "RiseOfTheElderGuardian", "SnowTrails");
|
|
||||||
List<Class> winClasses = Arrays.asList(WinEffectBabyChicken.class, WinEffectDragonRider.class,
|
|
||||||
WinEffectFireworks.class, WinEffectFlames.class, WinEffectHalloween.class, WinEffectLavaTrap.class,
|
|
||||||
WinEffectLightningStrike.class, WinEffectMrPunchMan.class, WinEffectPodium.class,
|
|
||||||
WinEffectRiseOfTheElderGuardian.class, WinEffectSnowTrails.class);
|
|
||||||
if (names.contains(roomName))
|
|
||||||
{
|
|
||||||
int index = names.indexOf(roomName);
|
|
||||||
WinEffectGadget gadget = (WinEffectGadget) _manager.getGadget(winClasses.get(index));
|
|
||||||
gadget.setup(player, new ArrayList<>(), new ArrayList<>(), player.getLocation().clone().add(100, 0, 100));
|
|
||||||
gadget.buildWinnerRoom();
|
|
||||||
gadget.teleport();
|
|
||||||
if (play)
|
|
||||||
{
|
|
||||||
gadget.runPlay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Win Rooms", "Wrong room name!"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -16,6 +16,8 @@ import mineplex.core.common.util.UtilText;
|
|||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.gadgets.Ammo;
|
import mineplex.core.gadget.gadgets.Ammo;
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class ItemSnowball extends ItemGadget
|
public class ItemSnowball extends ItemGadget
|
||||||
{
|
{
|
||||||
@ -59,4 +61,12 @@ public class ItemSnowball extends ItemGadget
|
|||||||
event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f);
|
event.getDamager().getWorld().playSound(event.getDamager().getLocation(), Sound.STEP_SNOW, 1, 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void cleanup(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_snowballs.entrySet().removeIf(ent -> !ent.getKey().isValid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.EntityEffect;
|
import org.bukkit.EntityEffect;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -24,18 +23,19 @@ import mineplex.core.common.util.UtilAction;
|
|||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseBat;
|
import mineplex.core.disguise.disguises.DisguiseBat;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.projectile.IThrown;
|
import mineplex.core.projectile.IThrown;
|
||||||
import mineplex.core.projectile.ProjectileUser;
|
import mineplex.core.projectile.ProjectileUser;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
|
|
||||||
public class MorphBat extends MorphGadget implements IThrown
|
public class MorphBat extends MorphGadget implements IThrown
|
||||||
{
|
{
|
||||||
@ -60,9 +60,6 @@ public class MorphBat extends MorphGadget implements IThrown
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseBat disguise = new DisguiseBat(player);
|
DisguiseBat disguise = new DisguiseBat(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +67,6 @@ public class MorphBat extends MorphGadget implements IThrown
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -12,12 +11,13 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBlaze;
|
import mineplex.core.disguise.disguises.DisguiseBlaze;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
@ -43,9 +43,6 @@ public class MorphBlaze extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseBlaze disguise = new DisguiseBlaze(player);
|
DisguiseBlaze disguise = new DisguiseBlaze(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +50,6 @@ public class MorphBlaze extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,21 +4,12 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import mineplex.core.common.currency.GlobalCurrency;
|
import org.bukkit.Bukkit;
|
||||||
import mineplex.core.common.util.*;
|
import org.bukkit.ChatColor;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import org.bukkit.Color;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseRabbit;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import org.bukkit.*;
|
|
||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -30,6 +21,30 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilFirework;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseRabbit;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class MorphBunny extends MorphGadget
|
public class MorphBunny extends MorphGadget
|
||||||
{
|
{
|
||||||
private HashSet<Player> _jumpCharge = new HashSet<Player>();
|
private HashSet<Player> _jumpCharge = new HashSet<Player>();
|
||||||
@ -56,9 +71,6 @@ public class MorphBunny extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseRabbit disguise = new DisguiseRabbit(player);
|
DisguiseRabbit disguise = new DisguiseRabbit(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, 1));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 999999999, 1));
|
||||||
@ -70,7 +82,6 @@ public class MorphBunny extends MorphGadget
|
|||||||
{
|
{
|
||||||
_jumpCharge.remove(player);
|
_jumpCharge.remove(player);
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
|
||||||
player.removePotionEffect(PotionEffectType.SPEED);
|
player.removePotionEffect(PotionEffectType.SPEED);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -19,14 +18,15 @@ import mineplex.core.common.util.UtilAction;
|
|||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
|
|
||||||
public class MorphChicken extends MorphGadget
|
public class MorphChicken extends MorphGadget
|
||||||
{
|
{
|
||||||
@ -49,9 +49,6 @@ public class MorphChicken extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseChicken disguise = new DisguiseChicken(player);
|
DisguiseChicken disguise = new DisguiseChicken(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +56,6 @@ public class MorphChicken extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguiseCow;
|
import mineplex.core.disguise.disguises.DisguiseCow;
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
|
||||||
public class MorphCow extends MorphGadget
|
public class MorphCow extends MorphGadget
|
||||||
{
|
{
|
||||||
@ -37,9 +37,6 @@ public class MorphCow extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseCow disguise = new DisguiseCow(player);
|
DisguiseCow disguise = new DisguiseCow(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +44,6 @@ public class MorphCow extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.morph;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.EntityEffect;
|
import org.bukkit.EntityEffect;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -17,17 +16,18 @@ import mineplex.core.common.util.LineFormat;
|
|||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
import mineplex.core.disguise.disguises.DisguiseCreeper;
|
import mineplex.core.disguise.disguises.DisguiseCreeper;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
|
|
||||||
public class MorphCreeper extends MorphGadget
|
public class MorphCreeper extends MorphGadget
|
||||||
{
|
{
|
||||||
@ -51,9 +51,6 @@ public class MorphCreeper extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseCreeper disguise = new DisguiseCreeper(player);
|
DisguiseCreeper disguise = new DisguiseCreeper(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +58,6 @@ public class MorphCreeper extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.FireworkEffect;
|
import org.bukkit.FireworkEffect;
|
||||||
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.FireworkEffect.Type;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -23,6 +22,7 @@ import mineplex.core.common.util.UtilFirework;
|
|||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguiseEnderman;
|
import mineplex.core.disguise.disguises.DisguiseEnderman;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -48,9 +48,6 @@ public class MorphEnderman extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseEnderman disguise = new DisguiseEnderman(player);
|
DisguiseEnderman disguise = new DisguiseEnderman(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +55,6 @@ public class MorphEnderman extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
|
@ -5,16 +5,6 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import mineplex.core.common.skin.SkinData;
|
|
||||||
import mineplex.core.common.util.*;
|
|
||||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
|
||||||
import mineplex.core.gadget.gadgets.particle.unrelated.MetalManEffect;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.utils.UtilGameProfile;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -22,6 +12,24 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
import mineplex.core.common.skin.SkinData;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.unrelated.MetalManEffect;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.utils.UtilGameProfile;
|
||||||
|
|
||||||
public class MorphMetalMan extends MorphGadget
|
public class MorphMetalMan extends MorphGadget
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -29,9 +37,12 @@ public class MorphMetalMan extends MorphGadget
|
|||||||
|
|
||||||
public MorphMetalMan(GadgetManager manager)
|
public MorphMetalMan(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Metal Man Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "This powerful suit forged of metal makes the wearer strong enough to even battle the gods",
|
super(manager, "Metal Man Morph", UtilText.splitLinesToArray(new String[]{
|
||||||
"", C.cWhite + "Left-click to shoot laser beam"}, LineFormat.LORE),
|
C.cGray + "This powerful suit forged of metal makes the wearer strong enough to even battle the gods",
|
||||||
0, Material.IRON_INGOT, (byte) 0);
|
"",
|
||||||
|
C.cWhite + "Left-click to shoot laser beam"
|
||||||
|
}, LineFormat.LORE),
|
||||||
|
-14, Material.IRON_INGOT, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,7 +56,7 @@ public class MorphMetalMan extends MorphGadget
|
|||||||
|
|
||||||
DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile);
|
DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile);
|
||||||
disguisePlayer.showInTabList(true, 0);
|
disguisePlayer.showInTabList(true, 0);
|
||||||
Manager.getDisguiseManager().disguise(disguisePlayer);
|
UtilMorph.disguise(player, disguisePlayer, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -53,7 +64,7 @@ public class MorphMetalMan extends MorphGadget
|
|||||||
{
|
{
|
||||||
removeArmor(player);
|
removeArmor(player);
|
||||||
|
|
||||||
Manager.getDisguiseManager().undisguise(player);
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -2,12 +2,14 @@ package mineplex.core.gadget.gadgets.morph;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
|
|
||||||
import mineplex.core.common.Rank;
|
import mineplex.core.common.Rank;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -16,16 +18,17 @@ import mineplex.core.common.util.UtilAction;
|
|||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguisePig;
|
import mineplex.core.disguise.disguises.DisguisePig;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
|
|
||||||
public class MorphPig extends MorphGadget
|
public class MorphPig extends MorphGadget
|
||||||
{
|
{
|
||||||
@ -50,9 +53,6 @@ public class MorphPig extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguisePig disguise = new DisguisePig(player);
|
DisguisePig disguise = new DisguisePig(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,7 +60,6 @@ public class MorphPig extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||||
@ -12,6 +11,7 @@ import mineplex.core.common.util.UtilServer;
|
|||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.visibility.VisibilityManager;
|
import mineplex.core.visibility.VisibilityManager;
|
||||||
|
|
||||||
@ -38,10 +38,7 @@ public class MorphPumpkinKing extends MorphGadget
|
|||||||
|
|
||||||
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
|
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
|
||||||
disguise.showArmor();
|
disguise.showArmor();
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
disguise.SetSkeletonType(SkeletonType.WITHER);
|
disguise.SetSkeletonType(SkeletonType.WITHER);
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
|
|
||||||
player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
|
player.getInventory().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
|
||||||
@ -54,7 +51,6 @@ public class MorphPumpkinKing extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
player.getInventory().setHelmet(null);
|
player.getInventory().setHelmet(null);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,238 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleExitEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.block.schematic.Schematic;
|
||||||
|
import mineplex.core.common.block.schematic.UtilSchematic;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.sleigh.Sleigh;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.sleigh.SleighPosition;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class MorphSleigh extends MorphGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Directions of the Sleigh, with the correct coord for the player to be teleported and the schematic name
|
||||||
|
*/
|
||||||
|
public enum SleighDirection
|
||||||
|
{
|
||||||
|
NORTH("SleighMorphNorth.schematic", 0.5, 4.5),
|
||||||
|
SOUTH("SleighMorphSouth.schematic", 0.5, 1.5),
|
||||||
|
EAST("SleighMorphEast.schematic", 1.5, 1.5),
|
||||||
|
WEST("SleighMorphWest.schematic", 4.5, 1.5);
|
||||||
|
|
||||||
|
private String _schematic;
|
||||||
|
private double _fixedX;
|
||||||
|
private double _fixedZ;
|
||||||
|
|
||||||
|
SleighDirection(String schematic, double fixedX, double fixedZ)
|
||||||
|
{
|
||||||
|
_schematic = schematic;
|
||||||
|
_fixedX = fixedX;
|
||||||
|
_fixedZ = fixedZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSchematic()
|
||||||
|
{
|
||||||
|
return _schematic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getFixedX()
|
||||||
|
{
|
||||||
|
return _fixedX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getFixedZ()
|
||||||
|
{
|
||||||
|
return _fixedZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<Player, Sleigh> _sleighs = new HashMap<>();
|
||||||
|
private Map<SleighDirection, Schematic> _schematics = new HashMap<>();
|
||||||
|
|
||||||
|
private List<SleighPosition> _positions = new ArrayList<>();
|
||||||
|
|
||||||
|
private Long _rightClickStart = null;
|
||||||
|
|
||||||
|
public MorphSleigh(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Sleigh Morph", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), -14, Material.STAINED_CLAY, (byte) 14, YearMonth.of(2016, Month.DECEMBER));
|
||||||
|
// Loads sleigh schematics
|
||||||
|
for (SleighDirection sleighDirection : SleighDirection.values())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Schematic schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/" + sleighDirection.getSchematic()));
|
||||||
|
_schematics.put(sleighDirection, schematic);
|
||||||
|
} catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buildPositions();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
applyArmor(player, message);
|
||||||
|
|
||||||
|
// TODO DISGUISE
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
removeArmor(player);
|
||||||
|
|
||||||
|
// TODO UNDISGUISE
|
||||||
|
if (_sleighs.containsKey(player))
|
||||||
|
{
|
||||||
|
_sleighs.get(player).stopEffect();
|
||||||
|
_sleighs.remove(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activates the sleigh effect when left-clicking
|
||||||
|
* This will be changed in the next releases
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void activateSleigh(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (!isActive(event.getPlayer()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!UtilEvent.isAction(event, UtilEvent.ActionType.L))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (player.getItemInHand().getType() != Material.AIR)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//if (!Recharge.Instance.use(player, getName(), 150000, true, false, "Cosmetics"))
|
||||||
|
//return;
|
||||||
|
|
||||||
|
List<SleighPosition> freePositions = _positions.stream().filter(position -> !position.isUsed()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (freePositions.size() == 0)
|
||||||
|
{
|
||||||
|
UtilPlayer.message(player, F.main("Sleigh Ride", "There are too many sleighs in the sky right now! Please wait a minute and try again!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int randomPosition = UtilMath.random.nextInt(freePositions.size());
|
||||||
|
SleighPosition position = freePositions.get(randomPosition);
|
||||||
|
position.setUsed(true);
|
||||||
|
SleighDirection direction = position.getDirection();
|
||||||
|
Schematic schematic = _schematics.get(direction);
|
||||||
|
if (schematic == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
schematic = UtilSchematic.loadSchematic(new File("../../update/schematic/SleighMorph.schematic"));
|
||||||
|
Location fixYaw = player.getLocation().clone();
|
||||||
|
fixYaw.setYaw(90);
|
||||||
|
player.teleport(fixYaw);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Sleigh sleigh = new Sleigh(player, schematic, position);
|
||||||
|
sleigh.startEffect();
|
||||||
|
_sleighs.put(player, sleigh);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops player from leaving the sleigh if it's activte
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onLeaveVehicle(VehicleExitEvent event)
|
||||||
|
{
|
||||||
|
if (event.getExited() instanceof Player)
|
||||||
|
{
|
||||||
|
Player player = (Player) event.getExited();
|
||||||
|
if (isActive(player))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates positions in the hub map
|
||||||
|
* TODO add arcade positions
|
||||||
|
*/
|
||||||
|
private void buildPositions()
|
||||||
|
{
|
||||||
|
_positions.add(new SleighPosition(-11, 143, -30, SleighDirection.SOUTH, -9.5, 145.5, -28.5));
|
||||||
|
_positions.add(new SleighPosition(57, 109, -150, SleighDirection.SOUTH, 58.5, 111.5, -148.5));
|
||||||
|
_positions.add(new SleighPosition(141, 101, 80, SleighDirection.NORTH, 142.5, 103.5, 84.5));
|
||||||
|
_positions.add(new SleighPosition(-12, 88, 85, SleighDirection.NORTH, -10.5, 90.5, 89.5));
|
||||||
|
_positions.add(new SleighPosition(-95, 90, 70, SleighDirection.NORTH, -93.5, 92.5, 74.5));
|
||||||
|
_positions.add(new SleighPosition(-105, 115, -80, SleighDirection.EAST, -103.5, 117.5, -78.5));
|
||||||
|
_positions.add(new SleighPosition(-135, 97, -8, SleighDirection.EAST, -133.5, 99.5, -6.5));
|
||||||
|
_positions.add(new SleighPosition(-45, 97, 15, SleighDirection.EAST, -43.5, 99.5, 16.5));
|
||||||
|
_positions.add(new SleighPosition(136, 116, 85, SleighDirection.WEST, 140.5, 118.5, 86.5));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes sleighs if they run out of time, or moves them if they still have time
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onUpdate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() == UpdateType.FASTER)
|
||||||
|
{
|
||||||
|
_sleighs.values().forEach(Sleigh::playSound);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Iterator<Map.Entry<Player, Sleigh>> iterator = _sleighs.entrySet().iterator();
|
||||||
|
while (iterator.hasNext())
|
||||||
|
{
|
||||||
|
Map.Entry<Player, Sleigh> entry = iterator.next();
|
||||||
|
Sleigh sleigh = entry.getValue();
|
||||||
|
if (!sleigh.update())
|
||||||
|
{
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,11 +1,10 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.*;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.achievement.AchievementManager;
|
import mineplex.core.achievement.AchievementManager;
|
||||||
@ -14,12 +13,13 @@ import mineplex.core.common.util.LineFormat;
|
|||||||
import mineplex.core.common.util.UtilAction;
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSlime;
|
import mineplex.core.disguise.disguises.DisguiseSlime;
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
|
||||||
public class MorphSlime extends MorphGadget
|
public class MorphSlime extends MorphGadget
|
||||||
{
|
{
|
||||||
@ -49,8 +49,6 @@ public class MorphSlime extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseSlime disguise = new DisguiseSlime(player);
|
DisguiseSlime disguise = new DisguiseSlime(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
|
|
||||||
int size = 1 + (_achievementManager.getMineplexLevelNumber(player, _clientManager.Get(player).GetRank())) / 8;
|
int size = 1 + (_achievementManager.getMineplexLevelNumber(player, _clientManager.Get(player).GetRank())) / 8;
|
||||||
|
|
||||||
@ -61,8 +59,7 @@ public class MorphSlime extends MorphGadget
|
|||||||
size = 12;
|
size = 12;
|
||||||
|
|
||||||
disguise.SetSize(size);
|
disguise.SetSize(size);
|
||||||
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +67,6 @@ public class MorphSlime extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package mineplex.core.gadget.gadgets.morph;
|
|||||||
|
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -28,6 +27,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
|
|||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSnowman;
|
import mineplex.core.disguise.disguises.DisguiseSnowman;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.recharge.RechargeData;
|
import mineplex.core.recharge.RechargeData;
|
||||||
@ -60,9 +60,6 @@ public class MorphSnowman extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseSnowman disguise = new DisguiseSnowman(player);
|
DisguiseSnowman disguise = new DisguiseSnowman(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +67,6 @@ public class MorphSnowman extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,8 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import mineplex.core.common.util.*;
|
import java.time.Month;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSquid;
|
import java.time.YearMonth;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.SwimManager;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
import mineplex.core.gadget.types.OutfitGadget;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
import mineplex.core.projectile.IThrown;
|
|
||||||
import mineplex.core.projectile.ProjectileUser;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
@ -26,6 +15,26 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseSquid;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.SwimManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.gadget.types.OutfitGadget;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
import mineplex.core.projectile.IThrown;
|
||||||
|
import mineplex.core.projectile.ProjectileUser;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class MorphSquid extends MorphGadget implements IThrown
|
public class MorphSquid extends MorphGadget implements IThrown
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -37,7 +46,7 @@ public class MorphSquid extends MorphGadget implements IThrown
|
|||||||
C.cWhite + "Swim to enable Fast Swimming",
|
C.cWhite + "Swim to enable Fast Swimming",
|
||||||
C.cWhite + "Sneak to shoot a fish above you"
|
C.cWhite + "Sneak to shoot a fish above you"
|
||||||
}, LineFormat.LORE),
|
}, LineFormat.LORE),
|
||||||
0, Material.INK_SACK, (byte) 0);
|
-14, Material.INK_SACK, (byte) 0, YearMonth.of(2016, Month.SEPTEMBER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,9 +54,6 @@ public class MorphSquid extends MorphGadget implements IThrown
|
|||||||
{
|
{
|
||||||
applyArmor(player, message);
|
applyArmor(player, message);
|
||||||
DisguiseSquid disguiseSquid = new DisguiseSquid(player);
|
DisguiseSquid disguiseSquid = new DisguiseSquid(player);
|
||||||
//disguiseSquid.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
|
|
||||||
//disguiseSquid.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguiseSquid);
|
|
||||||
UtilMorph.disguise(player, disguiseSquid, Manager);
|
UtilMorph.disguise(player, disguiseSquid, Manager);
|
||||||
onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId())));
|
onToggleSwim(new PlayerToggleSwimEvent(player, SwimManager.isSwimming(player.getUniqueId())));
|
||||||
}
|
}
|
||||||
@ -56,7 +62,6 @@ public class MorphSquid extends MorphGadget implements IThrown
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
removeArmor(player);
|
removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -25,17 +24,18 @@ import mineplex.core.common.util.UtilAction;
|
|||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilEvent;
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.common.util.UtilParticle;
|
import mineplex.core.common.util.UtilParticle;
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.recharge.RechargedEvent;
|
import mineplex.core.recharge.RechargedEvent;
|
||||||
@ -64,10 +64,7 @@ public class MorphTitan extends MorphGadget
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseGuardian disguise = new DisguiseGuardian(player);
|
DisguiseGuardian disguise = new DisguiseGuardian(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
disguise.setElder(true);
|
disguise.setElder(true);
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +72,6 @@ public class MorphTitan extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
|
import mineplex.core.common.skin.SkinData;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.utils.UtilGameProfile;
|
||||||
|
|
||||||
|
public class MorphTurkey extends MorphGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
public MorphTurkey(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Turkey Morph", UtilText.splitLinesToArray(new String[]
|
||||||
|
{
|
||||||
|
C.cGray + "Gobble, Gobble, please don't stuff me!",
|
||||||
|
C.blankLine,
|
||||||
|
C.cWhite + "Sneak to gobble."
|
||||||
|
},
|
||||||
|
LineFormat.LORE), -14, Material.COOKED_CHICKEN, (byte) 0, YearMonth.of(2016, Month.NOVEMBER));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
applyArmor(player, message);
|
||||||
|
|
||||||
|
GameProfile profile = UtilGameProfile.getGameProfile(player);
|
||||||
|
profile.getProperties().clear();
|
||||||
|
profile.getProperties().put("textures", SkinData.TURKEY.getProperty());
|
||||||
|
|
||||||
|
DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile);
|
||||||
|
disguisePlayer.showInTabList(true, 0);
|
||||||
|
UtilMorph.disguise(player, disguisePlayer, Manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
removeArmor(player);
|
||||||
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSneak(PlayerToggleSneakEvent event)
|
||||||
|
{
|
||||||
|
if (!isActive(event.getPlayer()))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!event.isSneaking())
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 1f, 1.25f);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,13 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import mineplex.core.common.skin.SkinData;
|
import mineplex.core.common.skin.SkinData;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
@ -9,24 +16,13 @@ import mineplex.core.common.util.UtilFirework;
|
|||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.utils.UtilGameProfile;
|
import mineplex.core.utils.UtilGameProfile;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.WeakHashMap;
|
|
||||||
|
|
||||||
public class MorphUncleSam extends MorphGadget
|
public class MorphUncleSam extends MorphGadget
|
||||||
{
|
{
|
||||||
private Map<UUID, DisguisePlayer> _disguises = new HashMap<>();
|
|
||||||
|
|
||||||
public MorphUncleSam(GadgetManager manager)
|
public MorphUncleSam(GadgetManager manager)
|
||||||
{
|
{
|
||||||
@ -53,9 +49,7 @@ public class MorphUncleSam extends MorphGadget
|
|||||||
|
|
||||||
DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile);
|
DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile);
|
||||||
disguisePlayer.showInTabList(true, 0);
|
disguisePlayer.showInTabList(true, 0);
|
||||||
Manager.getDisguiseManager().disguise(disguisePlayer);
|
UtilMorph.disguise(player, disguisePlayer, Manager);
|
||||||
|
|
||||||
this._disguises.put(player.getUniqueId(), disguisePlayer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -63,7 +57,7 @@ public class MorphUncleSam extends MorphGadget
|
|||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
|
|
||||||
Manager.getDisguiseManager().undisguise(this._disguises.remove(player.getUniqueId()));
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -84,9 +78,4 @@ public class MorphUncleSam extends MorphGadget
|
|||||||
UtilFirework.playFreedomFirework(player.getLocation().clone().add(0, 2, 0));
|
UtilFirework.playFreedomFirework(player.getLocation().clone().add(0, 2, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void quit(PlayerQuitEvent event)
|
|
||||||
{
|
|
||||||
this._disguises.remove(event.getPlayer().getUniqueId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,18 +3,6 @@ package mineplex.core.gadget.gadgets.morph;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import mineplex.core.common.currency.GlobalCurrency;
|
|
||||||
import mineplex.core.common.util.*;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseVillager;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
import mineplex.core.projectile.IThrown;
|
|
||||||
import mineplex.core.projectile.ProjectileUser;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.EntityEffect;
|
import org.bukkit.EntityEffect;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -28,6 +16,26 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseVillager;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.projectile.IThrown;
|
||||||
|
import mineplex.core.projectile.ProjectileUser;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class MorphVillager extends MorphGadget implements IThrown
|
public class MorphVillager extends MorphGadget implements IThrown
|
||||||
{
|
{
|
||||||
private HashSet<Item> _gems = new HashSet<Item>();
|
private HashSet<Item> _gems = new HashSet<Item>();
|
||||||
@ -52,9 +60,6 @@ public class MorphVillager extends MorphGadget implements IThrown
|
|||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
|
|
||||||
DisguiseVillager disguise = new DisguiseVillager(player);
|
DisguiseVillager disguise = new DisguiseVillager(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager);
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +67,6 @@ public class MorphVillager extends MorphGadget implements IThrown
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -17,6 +20,7 @@ import mineplex.core.common.util.UtilText;
|
|||||||
import mineplex.core.disguise.disguises.DisguiseWitch;
|
import mineplex.core.disguise.disguises.DisguiseWitch;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
@ -27,7 +31,10 @@ public class MorphWitch extends MorphGadget
|
|||||||
|
|
||||||
public MorphWitch(GadgetManager manager)
|
public MorphWitch(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{C.cWhite + "Press sneak to summon your trusty bat and start brewing"}, LineFormat.LORE), 0, Material.SKULL_ITEM, (byte) 3);
|
super(manager, "Witch Morph", UtilText.splitLinesToArray(new String[]{
|
||||||
|
C.cWhite + "Press sneak to summon your trusty bat and start brewing"
|
||||||
|
}, LineFormat.LORE),
|
||||||
|
-14, Material.SKULL_ITEM, (byte) 3, YearMonth.of(2016, Month.OCTOBER));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -35,9 +42,7 @@ public class MorphWitch extends MorphGadget
|
|||||||
{
|
{
|
||||||
this.applyArmor(player, message);
|
this.applyArmor(player, message);
|
||||||
DisguiseWitch disguiseWitch = new DisguiseWitch(player);
|
DisguiseWitch disguiseWitch = new DisguiseWitch(player);
|
||||||
disguiseWitch.setName(player.getName(), Manager.getClientManager().Get(player).GetRank());
|
UtilMorph.disguise(player, disguiseWitch, Manager);
|
||||||
disguiseWitch.setCustomNameVisible(true);
|
|
||||||
Manager.getDisguiseManager().disguise(disguiseWitch);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,7 +54,7 @@ public class MorphWitch extends MorphGadget
|
|||||||
{
|
{
|
||||||
witchEffectManager.stop();
|
witchEffectManager.stop();
|
||||||
}
|
}
|
||||||
Manager.getDisguiseManager().undisguise(player);
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getWitchItem()
|
public ItemStack getWitchItem()
|
||||||
|
@ -4,31 +4,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import mineplex.core.common.Rank;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.LineFormat;
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilEvent;
|
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
|
||||||
import mineplex.core.common.util.UtilParticle;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
|
||||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
import mineplex.core.inventory.ClientItem;
|
|
||||||
import mineplex.core.inventory.data.Item;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -40,6 +15,31 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.Rank;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.inventory.ClientItem;
|
||||||
|
import mineplex.core.inventory.data.Item;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class MorphWither extends MorphGadget
|
public class MorphWither extends MorphGadget
|
||||||
{
|
{
|
||||||
private ArrayList<WitherSkull> _skulls = new ArrayList<WitherSkull>();
|
private ArrayList<WitherSkull> _skulls = new ArrayList<WitherSkull>();
|
||||||
@ -65,9 +65,6 @@ public class MorphWither extends MorphGadget
|
|||||||
player.setHealth(300);
|
player.setHealth(300);
|
||||||
|
|
||||||
DisguiseWither disguise = new DisguiseWither(player);
|
DisguiseWither disguise = new DisguiseWither(player);
|
||||||
//disguise.setName(player.getName(), Manager.getClientManager().Get(player).getRealOrDisguisedRank());
|
|
||||||
//disguise.setCustomNameVisible(true);
|
|
||||||
//Manager.getDisguiseManager().disguise(disguise);
|
|
||||||
UtilMorph.disguise(player, disguise, Manager, true);
|
UtilMorph.disguise(player, disguise, Manager, true);
|
||||||
|
|
||||||
player.setMaxHealth(20);
|
player.setMaxHealth(20);
|
||||||
@ -78,7 +75,6 @@ public class MorphWither extends MorphGadget
|
|||||||
public void disableCustom(Player player, boolean message)
|
public void disableCustom(Player player, boolean message)
|
||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
//Manager.getDisguiseManager().undisguise(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
|
||||||
player.setAllowFlight(false);
|
player.setAllowFlight(false);
|
||||||
|
@ -4,11 +4,12 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.disguise.DisguiseManager;
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBase;
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
import mineplex.core.disguise.disguises.DisguiseInsentient;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class UtilMorph
|
public class UtilMorph
|
||||||
{
|
{
|
||||||
@ -17,38 +18,54 @@ public class UtilMorph
|
|||||||
* UtilMorph helps disguising and undisguising players, avoiding the use of deprecated methods
|
* UtilMorph helps disguising and undisguising players, avoiding the use of deprecated methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private static Map<UUID, DisguiseInsentient> _disguises = new HashMap<>();
|
private static Map<UUID, DisguiseBase> _disguises = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disguises a player with custom name
|
* Disguises a player with custom name
|
||||||
* @param player The player that will be disguised
|
* @param player The player that will be disguised
|
||||||
* @param disguiseInsentient The disguise that will be applied
|
* @param disguiseBase The disguise that will be applied
|
||||||
* @param gadgetManager The gadget manager
|
* @param gadgetManager The gadget manager
|
||||||
*/
|
*/
|
||||||
public static void disguise(Player player, DisguiseInsentient disguiseInsentient, GadgetManager gadgetManager)
|
public static void disguise(Player player, DisguiseBase disguiseBase, GadgetManager gadgetManager)
|
||||||
{
|
{
|
||||||
_disguises.put(player.getUniqueId(), disguiseInsentient);
|
_disguises.put(player.getUniqueId(), disguiseBase);
|
||||||
disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank());
|
if (disguiseBase instanceof DisguiseInsentient)
|
||||||
disguiseInsentient.setCustomNameVisible(true);
|
{
|
||||||
gadgetManager.getDisguiseManager().disguise(disguiseInsentient);
|
DisguiseInsentient disguiseInsentient = (DisguiseInsentient) disguiseBase;
|
||||||
|
disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank());
|
||||||
|
disguiseInsentient.setCustomNameVisible(true);
|
||||||
|
gadgetManager.getDisguiseManager().disguise(disguiseInsentient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gadgetManager.getDisguiseManager().disguise(disguiseBase);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disguises a player with custom name (special case for the Wither Morph)
|
* Disguises a player with custom name (special case for the Wither Morph)
|
||||||
* @param player The player that will be disguised
|
* @param player The player that will be disguised
|
||||||
* @param disguiseInsentient The disguise that will be applied
|
* @param disguiseBase The disguise that will be applied
|
||||||
* @param gadgetManager The gadget manager
|
* @param gadgetManager The gadget manager
|
||||||
* @param wither
|
* @param wither
|
||||||
*/
|
*/
|
||||||
public static void disguise(Player player, DisguiseInsentient disguiseInsentient, GadgetManager gadgetManager, boolean wither)
|
public static void disguise(Player player, DisguiseBase disguiseBase, GadgetManager gadgetManager, boolean wither)
|
||||||
{
|
{
|
||||||
_disguises.put(player.getUniqueId(), disguiseInsentient);
|
_disguises.put(player.getUniqueId(), disguiseBase);
|
||||||
disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank());
|
if (disguiseBase instanceof DisguiseInsentient)
|
||||||
if (!wither)
|
|
||||||
{
|
{
|
||||||
disguiseInsentient.setCustomNameVisible(true);
|
DisguiseInsentient disguiseInsentient = (DisguiseInsentient) disguiseBase;
|
||||||
|
disguiseInsentient.setName(player.getName(), gadgetManager.getClientManager().Get(player).getRealOrDisguisedRank());
|
||||||
|
if (!wither)
|
||||||
|
{
|
||||||
|
disguiseInsentient.setCustomNameVisible(true);
|
||||||
|
}
|
||||||
|
gadgetManager.getDisguiseManager().disguise(disguiseInsentient);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gadgetManager.getDisguiseManager().disguise(disguiseBase);
|
||||||
}
|
}
|
||||||
gadgetManager.getDisguiseManager().disguise(disguiseInsentient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,187 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.morph.managers.sleigh;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.block.schematic.Schematic;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.MorphSleigh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the sleigh effect for the Sleigh Morph
|
||||||
|
*/
|
||||||
|
public class Sleigh
|
||||||
|
{
|
||||||
|
|
||||||
|
private Map<Location, Material> _oldBlockMaterials = new HashMap<>();
|
||||||
|
private Map<Location, Byte> _oldBlockDatas = new HashMap<>();
|
||||||
|
|
||||||
|
private Player _player;
|
||||||
|
private Location _originalLocation;
|
||||||
|
private Schematic _schematic;
|
||||||
|
private SleighPosition _sleighPosition;
|
||||||
|
private Arrow _arrow;
|
||||||
|
private float _yaw;
|
||||||
|
|
||||||
|
private int _moves = 0;
|
||||||
|
|
||||||
|
public Sleigh(Player player, Schematic schematic, SleighPosition sleighPosition)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
_schematic = schematic;
|
||||||
|
_sleighPosition = sleighPosition;
|
||||||
|
_yaw = (sleighPosition.getDirection() == MorphSleigh.SleighDirection.SOUTH) ? 0f :
|
||||||
|
(sleighPosition.getDirection() == MorphSleigh.SleighDirection.NORTH) ? 180f :
|
||||||
|
(sleighPosition.getDirection() == MorphSleigh.SleighDirection.WEST) ? 90f : -90f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the sleigh effect
|
||||||
|
*/
|
||||||
|
public void startEffect()
|
||||||
|
{
|
||||||
|
_originalLocation = _player.getLocation().clone();
|
||||||
|
Location origin = new Location(_originalLocation.getWorld(), _sleighPosition.getX(),
|
||||||
|
_sleighPosition.getY(), _sleighPosition.getZ());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pasteSchematic(origin, 0, 0);
|
||||||
|
} catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the sleigh effect
|
||||||
|
*/
|
||||||
|
public void stopEffect()
|
||||||
|
{
|
||||||
|
restoreBlocks();
|
||||||
|
_arrow.remove();
|
||||||
|
_player.teleport(_originalLocation.clone().add(0, 5, 0));
|
||||||
|
_sleighPosition.setUsed(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pastes the schematic for the sleigh
|
||||||
|
* @param origin The location where the sleigh schematic will be placed
|
||||||
|
* @param playerX The X coord where player will be teleported
|
||||||
|
* @param playerZ The Z coord where player will be teleported
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private void pasteSchematic(Location origin, int playerX, int playerZ) throws IOException
|
||||||
|
{
|
||||||
|
restoreBlocks();
|
||||||
|
short width = _schematic.getWidth();
|
||||||
|
short height = _schematic.getHeight();
|
||||||
|
short length = _schematic.getLength();
|
||||||
|
for (short x = 0; x < width; x++)
|
||||||
|
{
|
||||||
|
for (short y = 0; y < height; y++)
|
||||||
|
{
|
||||||
|
for (short z = 0; z < length; z++)
|
||||||
|
{
|
||||||
|
Location location = origin.clone().add(x, y, z);
|
||||||
|
_oldBlockMaterials.put(location, location.getBlock().getType());
|
||||||
|
_oldBlockDatas.put(location, location.getBlock().getData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_schematic.paste(origin);
|
||||||
|
Location playerLoc = new Location(_originalLocation.getWorld(), _sleighPosition.getPlayerX() + playerX,
|
||||||
|
_sleighPosition.getPlayerY(), _sleighPosition.getPlayerZ() + playerZ);
|
||||||
|
// Spawns arrow so it looks like player is sitting on the sleigh
|
||||||
|
if (_arrow != null)
|
||||||
|
{
|
||||||
|
_arrow.remove();
|
||||||
|
}
|
||||||
|
_arrow = playerLoc.getWorld().spawn(playerLoc, Arrow.class);
|
||||||
|
UtilEnt.ghost(_arrow, true, true);
|
||||||
|
playerLoc.setYaw(_yaw);
|
||||||
|
playerLoc.setPitch(0.0f);
|
||||||
|
_player.teleport(playerLoc);
|
||||||
|
_arrow.setPassenger(_player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates sleigh to look like its moving
|
||||||
|
* @return true if the sleigh was moved, false if the time is over (3 seconds)
|
||||||
|
*/
|
||||||
|
public boolean update()
|
||||||
|
{
|
||||||
|
_moves++;
|
||||||
|
int x = 0, z = 0;
|
||||||
|
switch (_sleighPosition.getDirection())
|
||||||
|
{
|
||||||
|
case NORTH:
|
||||||
|
z = -1 * _moves;
|
||||||
|
break;
|
||||||
|
case SOUTH:
|
||||||
|
z = _moves;
|
||||||
|
break;
|
||||||
|
case WEST:
|
||||||
|
x = -1 * _moves;
|
||||||
|
break;
|
||||||
|
case EAST:
|
||||||
|
x = _moves;
|
||||||
|
}
|
||||||
|
Location newOrigin = new Location(_originalLocation.getWorld(), _sleighPosition.getX() + x,
|
||||||
|
_sleighPosition.getY(), _sleighPosition.getZ() + z);
|
||||||
|
restoreBlocks();
|
||||||
|
UtilParticle.PlayParticle(UtilParticle.ParticleType.SNOW_SHOVEL, _player.getLocation(), 0f, 0f, 0f, 0.6f, 100,
|
||||||
|
UtilParticle.ViewDist.LONGER, UtilServer.getPlayers());
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pasteSchematic(newOrigin, x, z);
|
||||||
|
} catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (_moves >= 20 * 3)
|
||||||
|
{
|
||||||
|
stopEffect();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Plays sleigh sound to the player
|
||||||
|
*/
|
||||||
|
public void playSound()
|
||||||
|
{
|
||||||
|
_player.playSound(_player.getLocation(), Sound.ORB_PICKUP, 1f, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restores the blocks that were changed from pasting the schematic
|
||||||
|
*/
|
||||||
|
private void restoreBlocks()
|
||||||
|
{
|
||||||
|
for (Map.Entry<Location, Material> entry : _oldBlockMaterials.entrySet())
|
||||||
|
{
|
||||||
|
Location location = entry.getKey();
|
||||||
|
Material material = entry.getValue();
|
||||||
|
byte data = 0;
|
||||||
|
if (_oldBlockDatas.containsKey(location))
|
||||||
|
{
|
||||||
|
data = _oldBlockDatas.get(location);
|
||||||
|
}
|
||||||
|
location.getBlock().setType(material);
|
||||||
|
location.getBlock().setData(data);
|
||||||
|
}
|
||||||
|
_oldBlockMaterials.clear();
|
||||||
|
_oldBlockDatas.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,76 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.morph.managers.sleigh;
|
||||||
|
|
||||||
|
import mineplex.core.gadget.gadgets.morph.MorphSleigh;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles positions from Sleigh and player, and the direction of the sleigh and player
|
||||||
|
*/
|
||||||
|
public class SleighPosition
|
||||||
|
{
|
||||||
|
|
||||||
|
private int _x;
|
||||||
|
private int _y;
|
||||||
|
private int _z;
|
||||||
|
private MorphSleigh.SleighDirection _direction;
|
||||||
|
private double _playerX;
|
||||||
|
private double _playerY;
|
||||||
|
private double _playerZ;
|
||||||
|
private boolean _used;
|
||||||
|
|
||||||
|
public SleighPosition(int x, int y, int z, MorphSleigh.SleighDirection direction, double playerX, double playerY, double playerZ)
|
||||||
|
{
|
||||||
|
_x = x;
|
||||||
|
_y = y;
|
||||||
|
_z = z;
|
||||||
|
_direction = direction;
|
||||||
|
_playerX = playerX;
|
||||||
|
_playerY = playerY;
|
||||||
|
_playerZ = playerZ;
|
||||||
|
_used = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getX()
|
||||||
|
{
|
||||||
|
return _x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY()
|
||||||
|
{
|
||||||
|
return _y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZ()
|
||||||
|
{
|
||||||
|
return _z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MorphSleigh.SleighDirection getDirection()
|
||||||
|
{
|
||||||
|
return _direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPlayerX()
|
||||||
|
{
|
||||||
|
return _playerX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPlayerY()
|
||||||
|
{
|
||||||
|
return _playerY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPlayerZ()
|
||||||
|
{
|
||||||
|
return _playerZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsed(boolean used)
|
||||||
|
{
|
||||||
|
_used = used;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUsed()
|
||||||
|
{
|
||||||
|
return _used;
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
package mineplex.core.gadget.gadgets.outfit.windupsuit;
|
package mineplex.core.gadget.gadgets.outfit.windupsuit;
|
||||||
|
|
||||||
import mineplex.core.common.util.*;
|
import java.util.HashMap;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import java.util.Iterator;
|
||||||
import mineplex.core.gadget.types.OutfitGadget;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
import org.bukkit.ChatColor;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
@ -13,8 +14,17 @@ import org.bukkit.event.player.PlayerToggleSneakEvent;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import mineplex.core.common.util.C;
|
||||||
import java.util.Iterator;
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilColor;
|
||||||
|
import mineplex.core.common.util.UtilGear;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.common.util.UtilTextBottom;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.OutfitGadget;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
public class OutfitWindUpSuit extends OutfitGadget
|
public class OutfitWindUpSuit extends OutfitGadget
|
||||||
{
|
{
|
||||||
@ -94,17 +104,17 @@ public class OutfitWindUpSuit extends OutfitGadget
|
|||||||
if (phase == 0)
|
if (phase == 0)
|
||||||
{
|
{
|
||||||
updateNextColor(color, colors[phase], player, phase);
|
updateNextColor(color, colors[phase], player, phase);
|
||||||
percentage += 5;
|
percentage += 1;
|
||||||
}
|
}
|
||||||
else if (phase == 1)
|
else if (phase == 1)
|
||||||
{
|
{
|
||||||
updateNextColor(color, colors[phase], player, phase);
|
updateNextColor(color, colors[phase], player, phase);
|
||||||
percentage += 5;
|
percentage += 1;
|
||||||
}
|
}
|
||||||
else if (phase == 2)
|
else if (phase == 2)
|
||||||
{
|
{
|
||||||
updateNextColor(color, colors[phase], player, phase);
|
updateNextColor(color, colors[phase], player, phase);
|
||||||
percentage += 5;
|
percentage += 1;
|
||||||
}
|
}
|
||||||
else if (phase == 3)
|
else if (phase == 3)
|
||||||
{
|
{
|
||||||
@ -153,6 +163,10 @@ public class OutfitWindUpSuit extends OutfitGadget
|
|||||||
if (_boosterManager.getTicks(player) >= 1800)
|
if (_boosterManager.getTicks(player) >= 1800)
|
||||||
{
|
{
|
||||||
_boosterManager.removeEffects(player);
|
_boosterManager.removeEffects(player);
|
||||||
|
for (ItemStack itemStack : player.getEquipment().getArmorContents())
|
||||||
|
{
|
||||||
|
UtilColor.applyColor(itemStack, UtilColor.DEFAULT_LEATHER_COLOR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -204,9 +218,9 @@ public class OutfitWindUpSuit extends OutfitGadget
|
|||||||
private void updateNextColor(Color original, Color finalColor, Player player, int phase)
|
private void updateNextColor(Color original, Color finalColor, Player player, int phase)
|
||||||
{
|
{
|
||||||
// Makes a really smooth transition between colors
|
// Makes a really smooth transition between colors
|
||||||
Color nextColor = UtilColor.getNextColor(original, finalColor, 5);
|
Color nextColor = UtilColor.getNextColor(original, finalColor, 1);
|
||||||
|
|
||||||
if (nextColor.getRed() == finalColor.getRed() && nextColor.getGreen() == finalColor.getGreen() && nextColor.getBlue() == finalColor.getBlue())
|
if (compareColors(finalColor, nextColor))
|
||||||
_colorPhase.put(player, phase + 1);
|
_colorPhase.put(player, phase + 1);
|
||||||
|
|
||||||
updateColor(player, nextColor);
|
updateColor(player, nextColor);
|
||||||
@ -247,4 +261,27 @@ public class OutfitWindUpSuit extends OutfitGadget
|
|||||||
double percent = ((_percentage.get(player) * 100d) / 888d) / 100d;
|
double percent = ((_percentage.get(player) * 100d) / 888d) / 100d;
|
||||||
UtilTextBottom.displayProgress(C.Bold + getSet().getName(), percent, "", player);
|
UtilTextBottom.displayProgress(C.Bold + getSet().getName(), percent, "", player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean compareColors(Color colorA, Color colorB)
|
||||||
|
{
|
||||||
|
int rA = colorA.getRed(), rB = colorB.getRed();
|
||||||
|
int gA = colorA.getGreen(), gB = colorB.getGreen();
|
||||||
|
int bA = colorA.getBlue(), bB = colorB.getBlue();
|
||||||
|
int minR = Math.min(rA, rB), maxR = Math.max(rA, rB);
|
||||||
|
int minG = Math.min(gA, gB), maxG = Math.max(gA, gB);
|
||||||
|
int minB = Math.min(bA, bB), maxB = Math.max(bA, bB);
|
||||||
|
if (maxR - minR > 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (maxG - minG > 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (maxB - minB > 2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,5 @@
|
|||||||
package mineplex.core.gadget.gadgets.outfit.windupsuit;
|
package mineplex.core.gadget.gadgets.outfit.windupsuit;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilFirework;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.types.OutfitGadget;
|
|
||||||
import mineplex.core.noteblock.INoteVerifier;
|
|
||||||
import mineplex.core.noteblock.NBSReader;
|
|
||||||
import mineplex.core.noteblock.NotePlayer;
|
|
||||||
import mineplex.core.noteblock.NoteSong;
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import org.bukkit.FireworkEffect;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -21,7 +7,28 @@ import java.io.FileNotFoundException;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class OutfitWindUpSuitBoosterManager
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.FireworkEffect;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilColor;
|
||||||
|
import mineplex.core.common.util.UtilFirework;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.noteblock.NBSReader;
|
||||||
|
import mineplex.core.noteblock.NotePlayer;
|
||||||
|
import mineplex.core.noteblock.NoteSong;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class OutfitWindUpSuitBoosterManager implements Listener
|
||||||
{
|
{
|
||||||
|
|
||||||
private GadgetManager _gadget;
|
private GadgetManager _gadget;
|
||||||
@ -32,6 +39,7 @@ public class OutfitWindUpSuitBoosterManager
|
|||||||
public OutfitWindUpSuitBoosterManager(GadgetManager gadget)
|
public OutfitWindUpSuitBoosterManager(GadgetManager gadget)
|
||||||
{
|
{
|
||||||
_gadget = gadget;
|
_gadget = gadget;
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, gadget.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyEffects(Player player)
|
public void applyEffects(Player player)
|
||||||
@ -121,4 +129,36 @@ public class OutfitWindUpSuitBoosterManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flickers colors between yellow and red to mimic the invulnerability star from mario
|
||||||
|
*/
|
||||||
|
@EventHandler
|
||||||
|
public void onUpdate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SEC)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_notePlayers.keySet().forEach(player -> flickerColor(player));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void flickerColor(Player player)
|
||||||
|
{
|
||||||
|
ItemStack[] playerArmor = player.getEquipment().getArmorContents();
|
||||||
|
for (ItemStack item : playerArmor)
|
||||||
|
{
|
||||||
|
if (item != null)
|
||||||
|
{
|
||||||
|
LeatherArmorMeta leatherMeta = (LeatherArmorMeta) item.getItemMeta();
|
||||||
|
if (leatherMeta.getColor().getRed() == 255 && leatherMeta.getColor().getGreen() == 255)
|
||||||
|
{
|
||||||
|
UtilColor.applyColor(item, Color.fromRGB(255, 0, 0));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UtilColor.applyColor(item, Color.fromRGB(255, 255, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,18 @@ public class ParticleFairy extends ParticleGadget
|
|||||||
// Create
|
// Create
|
||||||
if (!_fairy.containsKey(player)) _fairy.put(player, new ParticleFairyData(player));
|
if (!_fairy.containsKey(player)) _fairy.put(player, new ParticleFairyData(player));
|
||||||
|
|
||||||
_fairy.get(player).Update();
|
ParticleFairyData data = _fairy.get(player);
|
||||||
|
|
||||||
|
if (!data.Fairy.getWorld().equals(player.getWorld()))
|
||||||
|
{
|
||||||
|
data.Fairy = null;
|
||||||
|
data.Player = null;
|
||||||
|
data.Target = null;
|
||||||
|
data = new ParticleFairyData(player);
|
||||||
|
_fairy.put(player, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
data.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,7 +43,7 @@ public class ParticleFreedom extends ParticleGadget
|
|||||||
public void stopEffect(Player player)
|
public void stopEffect(Player player)
|
||||||
{
|
{
|
||||||
if (_effects.containsKey(player.getUniqueId()))
|
if (_effects.containsKey(player.getUniqueId()))
|
||||||
_effects.get(player.getUniqueId()).stop();
|
_effects.remove(player.getUniqueId()).stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,6 @@ public class ParticleFoot extends ParticleGadget
|
|||||||
|
|
||||||
_foot = !_foot;
|
_foot = !_foot;
|
||||||
|
|
||||||
cleanSteps();
|
|
||||||
|
|
||||||
if (!Manager.isMoving(player)) return;
|
if (!Manager.isMoving(player)) return;
|
||||||
|
|
||||||
if (!UtilEnt.isGrounded(player)) return;
|
if (!UtilEnt.isGrounded(player)) return;
|
||||||
@ -85,6 +83,15 @@ public class ParticleFoot extends ParticleGadget
|
|||||||
UtilServer.getPlayers());
|
UtilServer.getPlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void cleanup(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.FASTEST)
|
||||||
|
return;
|
||||||
|
|
||||||
|
cleanSteps();
|
||||||
|
}
|
||||||
|
|
||||||
public void cleanSteps()
|
public void cleanSteps()
|
||||||
{
|
{
|
||||||
if (_steps.isEmpty()) return;
|
if (_steps.isEmpty()) return;
|
||||||
|
@ -26,7 +26,6 @@ public class WinEffectHalloween extends WinEffectGadget
|
|||||||
{
|
{
|
||||||
|
|
||||||
private DisguisePlayer _npc;
|
private DisguisePlayer _npc;
|
||||||
private Skeleton _skeleton;
|
|
||||||
private List<DisguisePlayer> _disguisePlayers = new ArrayList<>();
|
private List<DisguisePlayer> _disguisePlayers = new ArrayList<>();
|
||||||
private int _tick;
|
private int _tick;
|
||||||
|
|
||||||
@ -68,8 +67,6 @@ public class WinEffectHalloween extends WinEffectGadget
|
|||||||
_nonTeam.forEach(p -> UtilPlayer.showForAll(p));
|
_nonTeam.forEach(p -> UtilPlayer.showForAll(p));
|
||||||
_disguisePlayers.forEach(d -> d.getEntity().getBukkitEntity().remove());
|
_disguisePlayers.forEach(d -> d.getEntity().getBukkitEntity().remove());
|
||||||
_disguisePlayers.clear();
|
_disguisePlayers.clear();
|
||||||
_skeleton.remove();
|
|
||||||
_skeleton = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -78,6 +78,7 @@ public class WinEffectPodium extends WinEffectGadget
|
|||||||
@Override
|
@Override
|
||||||
public void finish()
|
public void finish()
|
||||||
{
|
{
|
||||||
|
Manager.getDisguiseManager().undisguise(_npc);
|
||||||
_npc = null;
|
_npc = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.core.gadget.types;
|
package mineplex.core.gadget.types;
|
||||||
|
|
||||||
|
import java.time.YearMonth;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -31,19 +32,43 @@ public abstract class Gadget extends SalesPackageBase implements Listener
|
|||||||
private String[] _alternativePackageNames;
|
private String[] _alternativePackageNames;
|
||||||
|
|
||||||
private boolean _free;
|
private boolean _free;
|
||||||
|
|
||||||
|
private YearMonth _yearMonth = null;
|
||||||
|
|
||||||
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data)
|
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data)
|
||||||
{
|
{
|
||||||
this(manager, gadgetType, name, desc, cost, mat, data, 1);
|
this(manager, gadgetType, name, desc, cost, mat, data, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth)
|
||||||
|
{
|
||||||
|
this(manager, gadgetType, name, desc, cost, mat, data, yearMonth, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, String... alternativesalepackageNames)
|
||||||
|
{
|
||||||
|
super(name, mat, data, desc, cost, quantity);
|
||||||
|
|
||||||
|
_gadgetType = gadgetType;
|
||||||
|
KnownPackage = false;
|
||||||
|
_free = false;
|
||||||
|
|
||||||
|
_alternativePackageNames = alternativesalepackageNames;
|
||||||
|
if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; }
|
||||||
|
|
||||||
|
Manager = manager;
|
||||||
|
|
||||||
|
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||||
|
}
|
||||||
|
|
||||||
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, int quantity, String... alternativesalepackageNames)
|
public Gadget(GadgetManager manager, GadgetType gadgetType, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth, int quantity, String... alternativesalepackageNames)
|
||||||
{
|
{
|
||||||
super(name, mat, data, desc, cost, quantity);
|
super(name, mat, data, desc, cost, quantity);
|
||||||
|
|
||||||
_gadgetType = gadgetType;
|
_gadgetType = gadgetType;
|
||||||
KnownPackage = false;
|
KnownPackage = false;
|
||||||
_free = false;
|
_free = false;
|
||||||
|
_yearMonth = yearMonth;
|
||||||
|
|
||||||
_alternativePackageNames = alternativesalepackageNames;
|
_alternativePackageNames = alternativesalepackageNames;
|
||||||
if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; }
|
if(_alternativePackageNames == null) { _alternativePackageNames = new String[0]; }
|
||||||
@ -83,6 +108,11 @@ public abstract class Gadget extends SalesPackageBase implements Listener
|
|||||||
{
|
{
|
||||||
return _active.contains(player);
|
return _active.contains(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public YearMonth getYearMonth()
|
||||||
|
{
|
||||||
|
return _yearMonth;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event)
|
public void onPlayerQuit(PlayerQuitEvent event)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package mineplex.core.gadget.types;
|
package mineplex.core.gadget.types;
|
||||||
|
|
||||||
|
import java.time.YearMonth;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -15,6 +17,11 @@ public abstract class MorphGadget extends Gadget
|
|||||||
{
|
{
|
||||||
super(manager, GadgetType.MORPH, name, desc, cost, mat, data);
|
super(manager, GadgetType.MORPH, name, desc, cost, mat, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MorphGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, YearMonth yearMonth)
|
||||||
|
{
|
||||||
|
super(manager, GadgetType.MORPH, name, desc, cost, mat, data, yearMonth);
|
||||||
|
}
|
||||||
|
|
||||||
public void applyArmor(Player player, boolean message)
|
public void applyArmor(Player player, boolean message)
|
||||||
{
|
{
|
||||||
|
@ -94,21 +94,27 @@ public abstract class WinEffectGadget extends Gadget
|
|||||||
|
|
||||||
public void runFinish()
|
public void runFinish()
|
||||||
{
|
{
|
||||||
finish();
|
try
|
||||||
_player = null;
|
|
||||||
_baseLocation = null;
|
|
||||||
_team.clear();
|
|
||||||
_team = null;
|
|
||||||
_nonTeam.clear();
|
|
||||||
_nonTeam = null;
|
|
||||||
_other.clear();
|
|
||||||
_other = null;
|
|
||||||
_allPlayers.clear();
|
|
||||||
_allPlayers = null;
|
|
||||||
// Loads gadgets back when players are teleported to the arcade hub, after the win effect
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
|
||||||
{
|
{
|
||||||
Manager.getUserGadgetPersistence().load(player);
|
finish();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_player = null;
|
||||||
|
_baseLocation = null;
|
||||||
|
_team.clear();
|
||||||
|
_team = null;
|
||||||
|
_nonTeam.clear();
|
||||||
|
_nonTeam = null;
|
||||||
|
_other.clear();
|
||||||
|
_other = null;
|
||||||
|
_allPlayers.clear();
|
||||||
|
_allPlayers = null;
|
||||||
|
// Loads gadgets back when players are teleported to the arcade hub, after the win effect
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
Manager.getUserGadgetPersistence().load(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ public enum GameDisplay
|
|||||||
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
|
Evolution("Evolution", Material.EMERALD, (byte)0, GameCategory.ARCADE, 16),
|
||||||
Gravity("Gravity", Material.ENDER_PORTAL_FRAME, (byte)0, GameCategory.EXTRA, 18),
|
Gravity("Gravity", Material.ENDER_PORTAL_FRAME, (byte)0, GameCategory.EXTRA, 18),
|
||||||
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
|
||||||
|
Halloween2016("Pumpkin's Revenge", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 63),
|
||||||
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
|
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
|
||||||
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
|
HoleInTheWall("Hole in the Wall", Material.STAINED_GLASS, (byte) 2, GameCategory.ARCADE, 52),
|
||||||
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
|
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
|
||||||
|
@ -1,52 +1,334 @@
|
|||||||
package mineplex.core.memory;
|
package mineplex.core.memory;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import net.minecraft.server.v1_8_R3.CraftingManager;
|
import net.minecraft.server.v1_8_R3.CraftingManager;
|
||||||
|
import net.minecraft.server.v1_8_R3.EnchantmentManager;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||||
import net.minecraft.server.v1_8_R3.IInventory;
|
import net.minecraft.server.v1_8_R3.IInventory;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoal;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalNearestAttackableTarget;
|
||||||
|
import net.minecraft.server.v1_8_R3.PathfinderGoalSelector;
|
||||||
|
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByBlockEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class MemoryFix extends MiniPlugin
|
public class MemoryFix extends MiniPlugin
|
||||||
{
|
{
|
||||||
private static Field _intHashMap;
|
private static Field _intHashMap;
|
||||||
|
|
||||||
public MemoryFix(JavaPlugin plugin)
|
public MemoryFix(JavaPlugin plugin)
|
||||||
{
|
{
|
||||||
super("Memory Fix", plugin);
|
super("Memory Fix", plugin);
|
||||||
|
|
||||||
//_intHashMap = IntHashMap.class.
|
//_intHashMap = IntHashMap.class.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void fixLastDamageEventLeaks(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SLOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<World> worldList = Bukkit.getWorlds();
|
||||||
|
Set<World> worlds = new HashSet<>(worldList);
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
if (worlds.size() != worldList.size())
|
||||||
|
throw new RuntimeException("Error: Duplicated worlds?!?!");
|
||||||
|
|
||||||
|
for (World world : worlds)
|
||||||
|
{
|
||||||
|
WorldServer worldServer = ((CraftWorld) world).getHandle();
|
||||||
|
|
||||||
|
for (net.minecraft.server.v1_8_R3.Entity nmsentity : worldServer.entityList)
|
||||||
|
{
|
||||||
|
Entity entity = nmsentity.getBukkitEntity();
|
||||||
|
EntityDamageEvent lastDamageCause = entity.getLastDamageCause();
|
||||||
|
if (lastDamageCause != null)
|
||||||
|
{
|
||||||
|
Entity damaged = lastDamageCause.getEntity();
|
||||||
|
Entity damagerEntity = null;
|
||||||
|
Block damagerBlock = null;
|
||||||
|
if (lastDamageCause instanceof EntityDamageByEntityEvent)
|
||||||
|
damagerEntity = ((EntityDamageByEntityEvent) lastDamageCause).getDamager();
|
||||||
|
if (lastDamageCause instanceof EntityDamageByBlockEvent)
|
||||||
|
damagerBlock = ((EntityDamageByBlockEvent) lastDamageCause).getDamager();
|
||||||
|
|
||||||
|
boolean shouldRemove = false;
|
||||||
|
|
||||||
|
if (!damaged.isValid())
|
||||||
|
shouldRemove = true;
|
||||||
|
else if (damagerEntity != null)
|
||||||
|
{
|
||||||
|
if (!damagerEntity.isValid())
|
||||||
|
shouldRemove = true;
|
||||||
|
else if (!worlds.contains(damagerEntity.getWorld()))
|
||||||
|
shouldRemove = true;
|
||||||
|
}
|
||||||
|
else if (damagerBlock != null)
|
||||||
|
{
|
||||||
|
if (!worlds.contains(damagerBlock.getWorld()))
|
||||||
|
shouldRemove = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldRemove)
|
||||||
|
entity.setLastDamageCause(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Field PATHFINDER_GOAL_SELECTOR_B;
|
||||||
|
private static boolean PATHFINDER_GOAL_SELECTOR_B_SUCCESSFUL;
|
||||||
|
|
||||||
|
private static Field PATHFINDER_GOAL_SELECTOR_C;
|
||||||
|
private static boolean PATHFINDER_GOAL_SELECTOR_C_SUCCESSFUL;
|
||||||
|
|
||||||
|
private static Field PATHFINDER_GOAL_SELECTOR_ITEM_A;
|
||||||
|
private static boolean PATHFINDER_GOAL_SELECTOR_ITEM_A_SUCCESSFUL;
|
||||||
|
|
||||||
|
private static Field PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D;
|
||||||
|
private static boolean PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D_SUCCESSFUL;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PATHFINDER_GOAL_SELECTOR_ITEM_A = Class.forName(PathfinderGoalSelector.class.getName() + "$PathfinderGoalSelectorItem").getDeclaredField("a");
|
||||||
|
PATHFINDER_GOAL_SELECTOR_ITEM_A.setAccessible(true);
|
||||||
|
PATHFINDER_GOAL_SELECTOR_ITEM_A_SUCCESSFUL = true;
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PATHFINDER_GOAL_SELECTOR_B = PathfinderGoalSelector.class.getDeclaredField("b");
|
||||||
|
PATHFINDER_GOAL_SELECTOR_B.setAccessible(true);
|
||||||
|
PATHFINDER_GOAL_SELECTOR_B_SUCCESSFUL = true;
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PATHFINDER_GOAL_SELECTOR_C = PathfinderGoalSelector.class.getDeclaredField("c");
|
||||||
|
PATHFINDER_GOAL_SELECTOR_C.setAccessible(true);
|
||||||
|
PATHFINDER_GOAL_SELECTOR_C_SUCCESSFUL = true;
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D = PathfinderGoalNearestAttackableTarget.class.getDeclaredField("d");
|
||||||
|
PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D.setAccessible(true);
|
||||||
|
PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D_SUCCESSFUL = true;
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@EventHandler
|
||||||
|
public void fixPathfinderGoalLeaks(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SLOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
List<World> worldList = Bukkit.getWorlds();
|
||||||
|
Set<World> worlds = new HashSet<>(worldList);
|
||||||
|
|
||||||
|
// Sanity check
|
||||||
|
if (worlds.size() != worldList.size())
|
||||||
|
throw new RuntimeException("Error: Duplicated worlds?!?!");
|
||||||
|
|
||||||
|
for (World world : worlds)
|
||||||
|
{
|
||||||
|
WorldServer worldServer = ((CraftWorld) world).getHandle();
|
||||||
|
|
||||||
|
for (net.minecraft.server.v1_8_R3.Entity nmsentity : worldServer.entityList)
|
||||||
|
{
|
||||||
|
if (nmsentity instanceof EntityInsentient)
|
||||||
|
{
|
||||||
|
EntityInsentient ei = (EntityInsentient) nmsentity;
|
||||||
|
if (PATHFINDER_GOAL_SELECTOR_ITEM_A_SUCCESSFUL)
|
||||||
|
{
|
||||||
|
if (PATHFINDER_GOAL_SELECTOR_B_SUCCESSFUL)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PathfinderGoalSelector targetSelector = ei.targetSelector;
|
||||||
|
List<Object> list = (List<Object>) PATHFINDER_GOAL_SELECTOR_B.get(targetSelector);
|
||||||
|
for (Object object : list)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PathfinderGoal goal = (PathfinderGoal) PATHFINDER_GOAL_SELECTOR_ITEM_A.get(object);
|
||||||
|
if (goal instanceof PathfinderGoalNearestAttackableTarget && PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D_SUCCESSFUL)
|
||||||
|
{
|
||||||
|
net.minecraft.server.v1_8_R3.Entity original = (net.minecraft.server.v1_8_R3.Entity) PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D.get(goal);
|
||||||
|
boolean shouldClear = false;
|
||||||
|
|
||||||
|
if (original != null)
|
||||||
|
{
|
||||||
|
if (!original.valid)
|
||||||
|
shouldClear = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldClear)
|
||||||
|
PATHFINDER_GOAL_NEAREST_ATTACKABLE_TARGET_D.set(goal, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object ENCHANTMENTMANAGER_D;
|
||||||
|
private static Field ENCHANTMENT_MODIFIER_THORNS_A;
|
||||||
|
private static Field ENCHANTMENT_MODIFIER_THORNS_B;
|
||||||
|
private static boolean ENCHANTMENTMANAGER_D_SUCCESSFUL;
|
||||||
|
|
||||||
|
private static Object ENCHANTMENTMANAGER_E;
|
||||||
|
private static Field ENCHANTMENT_MODIFIER_ARTHROPODS_A;
|
||||||
|
private static Field ENCHANTMENT_MODIFIER_ARTHROPODS_B;
|
||||||
|
private static boolean ENCHANTMENTMANAGER_E_SUCCESSFUL;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Field field = EnchantmentManager.class.getDeclaredField("d");
|
||||||
|
field.setAccessible(true);
|
||||||
|
ENCHANTMENTMANAGER_D = field.get(null);
|
||||||
|
ENCHANTMENT_MODIFIER_THORNS_A = ENCHANTMENTMANAGER_D.getClass().getDeclaredField("a");
|
||||||
|
ENCHANTMENT_MODIFIER_THORNS_A.setAccessible(true);
|
||||||
|
ENCHANTMENT_MODIFIER_THORNS_B = ENCHANTMENTMANAGER_D.getClass().getDeclaredField("b");
|
||||||
|
ENCHANTMENT_MODIFIER_THORNS_B.setAccessible(true);
|
||||||
|
ENCHANTMENTMANAGER_D_SUCCESSFUL = true;
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Field field = EnchantmentManager.class.getDeclaredField("e");
|
||||||
|
field.setAccessible(true);
|
||||||
|
ENCHANTMENTMANAGER_E = field.get(null);
|
||||||
|
ENCHANTMENT_MODIFIER_ARTHROPODS_A = ENCHANTMENTMANAGER_E.getClass().getDeclaredField("a");
|
||||||
|
ENCHANTMENT_MODIFIER_ARTHROPODS_A.setAccessible(true);
|
||||||
|
ENCHANTMENT_MODIFIER_ARTHROPODS_B = ENCHANTMENTMANAGER_E.getClass().getDeclaredField("b");
|
||||||
|
ENCHANTMENT_MODIFIER_ARTHROPODS_B.setAccessible(true);
|
||||||
|
ENCHANTMENTMANAGER_E_SUCCESSFUL = true;
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void fixEnchantmentManager(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SLOW)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ENCHANTMENTMANAGER_D_SUCCESSFUL)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
net.minecraft.server.v1_8_R3.Entity a = (net.minecraft.server.v1_8_R3.Entity) ENCHANTMENT_MODIFIER_THORNS_A.get(ENCHANTMENTMANAGER_D);
|
||||||
|
net.minecraft.server.v1_8_R3.Entity b = (net.minecraft.server.v1_8_R3.Entity) ENCHANTMENT_MODIFIER_THORNS_B.get(ENCHANTMENTMANAGER_D);
|
||||||
|
|
||||||
|
if ((a != null && !a.valid) || (b != null && !b.valid))
|
||||||
|
{
|
||||||
|
ENCHANTMENT_MODIFIER_THORNS_A.set(ENCHANTMENTMANAGER_D, null);
|
||||||
|
ENCHANTMENT_MODIFIER_THORNS_B.set(ENCHANTMENTMANAGER_D, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ENCHANTMENTMANAGER_E_SUCCESSFUL)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
net.minecraft.server.v1_8_R3.Entity a = (net.minecraft.server.v1_8_R3.Entity) ENCHANTMENT_MODIFIER_ARTHROPODS_A.get(ENCHANTMENTMANAGER_E);
|
||||||
|
net.minecraft.server.v1_8_R3.Entity b = (net.minecraft.server.v1_8_R3.Entity) ENCHANTMENT_MODIFIER_ARTHROPODS_B.get(ENCHANTMENTMANAGER_E);
|
||||||
|
|
||||||
|
if ((a != null && !a.valid) || (b != null && !b.valid))
|
||||||
|
{
|
||||||
|
ENCHANTMENT_MODIFIER_ARTHROPODS_A.set(ENCHANTMENTMANAGER_E, null);
|
||||||
|
ENCHANTMENT_MODIFIER_ARTHROPODS_B.set(ENCHANTMENTMANAGER_E, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ReflectiveOperationException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void fixInventoryLeaks(UpdateEvent event)
|
public void fixInventoryLeaks(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (World world : Bukkit.getWorlds())
|
for (World world : Bukkit.getWorlds())
|
||||||
{
|
{
|
||||||
for (Object tileEntity : ((CraftWorld)world).getHandle().tileEntityList)
|
for (Object tileEntity : ((CraftWorld) world).getHandle().tileEntityList)
|
||||||
{
|
{
|
||||||
if (tileEntity instanceof IInventory)
|
if (tileEntity instanceof IInventory)
|
||||||
{
|
{
|
||||||
Iterator<HumanEntity> entityIterator = ((IInventory)tileEntity).getViewers().iterator();
|
Iterator<HumanEntity> entityIterator = ((IInventory) tileEntity).getViewers().iterator();
|
||||||
|
|
||||||
while (entityIterator.hasNext())
|
while (entityIterator.hasNext())
|
||||||
{
|
{
|
||||||
HumanEntity entity = entityIterator.next();
|
HumanEntity entity = entityIterator.next();
|
||||||
|
|
||||||
if (entity instanceof CraftPlayer && !((CraftPlayer)entity).isOnline())
|
if (entity instanceof CraftPlayer && !((CraftPlayer) entity).isOnline())
|
||||||
{
|
{
|
||||||
entityIterator.remove();
|
entityIterator.remove();
|
||||||
}
|
}
|
||||||
@ -54,17 +336,17 @@ public class MemoryFix extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CraftingManager.getInstance().lastCraftView = null;
|
CraftingManager.getInstance().lastCraftView = null;
|
||||||
CraftingManager.getInstance().lastRecipe = null;
|
CraftingManager.getInstance().lastRecipe = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void fixEntityTrackerLeak(UpdateEvent event)
|
public void fixEntityTrackerLeak(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// NEED TO FIX STUCK NETWORKMANAGERS.....
|
// NEED TO FIX STUCK NETWORKMANAGERS.....
|
||||||
/*
|
/*
|
||||||
for (World world : Bukkit.getWorlds())
|
for (World world : Bukkit.getWorlds())
|
||||||
|
@ -1,26 +1,28 @@
|
|||||||
package mineplex.core.mount;
|
package mineplex.core.mount;
|
||||||
|
|
||||||
|
import java.time.YearMonth;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityCreature;
|
||||||
|
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||||
|
import org.bukkit.entity.Horse;
|
||||||
|
import org.bukkit.entity.Horse.Color;
|
||||||
|
import org.bukkit.entity.Horse.Style;
|
||||||
|
import org.bukkit.entity.Horse.Variant;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import net.minecraft.server.v1_8_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.Horse.Variant;
|
|
||||||
import org.bukkit.entity.Horse;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Horse.Color;
|
|
||||||
import org.bukkit.entity.Horse.Style;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class HorseMount extends Mount<SingleEntityMountData<Horse>>
|
public class HorseMount extends Mount<SingleEntityMountData<Horse>>
|
||||||
{
|
{
|
||||||
@ -29,7 +31,7 @@ public class HorseMount extends Mount<SingleEntityMountData<Horse>>
|
|||||||
protected Variant _variant;
|
protected Variant _variant;
|
||||||
protected double _jump;
|
protected double _jump;
|
||||||
protected Material _armor;
|
protected Material _armor;
|
||||||
|
|
||||||
public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor)
|
public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor)
|
||||||
{
|
{
|
||||||
super (manager, name, displayMaterial, displayData, desc, cost);
|
super (manager, name, displayMaterial, displayData, desc, cost);
|
||||||
@ -41,6 +43,18 @@ public class HorseMount extends Mount<SingleEntityMountData<Horse>>
|
|||||||
_jump = jump;
|
_jump = jump;
|
||||||
_armor = armor;
|
_armor = armor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HorseMount(MountManager manager, String name, String[] desc, Material displayMaterial, byte displayData, int cost, Color color, Style style, Variant variant, double jump, Material armor, YearMonth yearMonth)
|
||||||
|
{
|
||||||
|
super (manager, name, displayMaterial, displayData, desc, cost, yearMonth);
|
||||||
|
KnownPackage = false;
|
||||||
|
|
||||||
|
_color = color;
|
||||||
|
_style = style;
|
||||||
|
_variant = variant;
|
||||||
|
_jump = jump;
|
||||||
|
_armor = armor;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void UpdateHorse(UpdateEvent event)
|
public void UpdateHorse(UpdateEvent event)
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
package mineplex.core.mount;
|
package mineplex.core.mount;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import java.time.YearMonth;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import java.util.HashMap;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import java.util.HashSet;
|
||||||
import mineplex.core.mount.event.MountActivateEvent;
|
|
||||||
import mineplex.core.shop.item.SalesPackageBase;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
@ -14,8 +13,11 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import mineplex.core.common.util.F;
|
||||||
import java.util.HashSet;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.mount.event.MountActivateEvent;
|
||||||
|
import mineplex.core.shop.item.SalesPackageBase;
|
||||||
|
|
||||||
public abstract class Mount<T extends MountData> extends SalesPackageBase implements Listener
|
public abstract class Mount<T extends MountData> extends SalesPackageBase implements Listener
|
||||||
{
|
{
|
||||||
@ -23,6 +25,8 @@ public abstract class Mount<T extends MountData> extends SalesPackageBase implem
|
|||||||
protected HashMap<Player, T> _active = new HashMap<Player, T>();
|
protected HashMap<Player, T> _active = new HashMap<Player, T>();
|
||||||
|
|
||||||
public MountManager Manager;
|
public MountManager Manager;
|
||||||
|
|
||||||
|
private YearMonth _yearMonth = null;
|
||||||
|
|
||||||
public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int coins)
|
public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int coins)
|
||||||
{
|
{
|
||||||
@ -33,6 +37,17 @@ public abstract class Mount<T extends MountData> extends SalesPackageBase implem
|
|||||||
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
|
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Mount(MountManager manager, String name, Material material, byte displayData, String[] description, int coins, YearMonth yearMonth)
|
||||||
|
{
|
||||||
|
super(name, material, displayData, description, coins);
|
||||||
|
|
||||||
|
Manager = manager;
|
||||||
|
|
||||||
|
_yearMonth = yearMonth;
|
||||||
|
|
||||||
|
Manager.getPlugin().getServer().getPluginManager().registerEvents(this, Manager.getPlugin());
|
||||||
|
}
|
||||||
|
|
||||||
public final void enable(Player player)
|
public final void enable(Player player)
|
||||||
{
|
{
|
||||||
MountActivateEvent gadgetEvent = new MountActivateEvent(player, this);
|
MountActivateEvent gadgetEvent = new MountActivateEvent(player, this);
|
||||||
@ -99,4 +114,9 @@ public abstract class Mount<T extends MountData> extends SalesPackageBase implem
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public YearMonth getYearMonth()
|
||||||
|
{
|
||||||
|
return _yearMonth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package mineplex.core.mount;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mineplex.core.mount.types.*;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -24,6 +23,19 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.disguise.DisguiseManager;
|
import mineplex.core.disguise.DisguiseManager;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.mount.types.MountBabyReindeer;
|
||||||
|
import mineplex.core.mount.types.MountCart;
|
||||||
|
import mineplex.core.mount.types.MountDragon;
|
||||||
|
import mineplex.core.mount.types.MountFreedomHorse;
|
||||||
|
import mineplex.core.mount.types.MountFrost;
|
||||||
|
import mineplex.core.mount.types.MountMule;
|
||||||
|
import mineplex.core.mount.types.MountNightmareSteed;
|
||||||
|
import mineplex.core.mount.types.MountSlime;
|
||||||
|
import mineplex.core.mount.types.MountSpider;
|
||||||
|
import mineplex.core.mount.types.MountTitan;
|
||||||
|
import mineplex.core.mount.types.MountUndead;
|
||||||
|
import mineplex.core.mount.types.MountValentinesSheep;
|
||||||
|
import mineplex.core.mount.types.MountZombie;
|
||||||
|
|
||||||
public class MountManager extends MiniPlugin
|
public class MountManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
@ -49,7 +61,7 @@ public class MountManager extends MiniPlugin
|
|||||||
|
|
||||||
private void CreateGadgets()
|
private void CreateGadgets()
|
||||||
{
|
{
|
||||||
_types = new ArrayList<Mount<?>>();
|
_types = new ArrayList<>();
|
||||||
|
|
||||||
_types.add(new MountUndead(this));
|
_types.add(new MountUndead(this));
|
||||||
_types.add(new MountFrost(this));
|
_types.add(new MountFrost(this));
|
||||||
@ -64,6 +76,8 @@ public class MountManager extends MiniPlugin
|
|||||||
_types.add(new MountValentinesSheep(this));
|
_types.add(new MountValentinesSheep(this));
|
||||||
_types.add(new MountFreedomHorse(this));
|
_types.add(new MountFreedomHorse(this));
|
||||||
_types.add(new MountNightmareSteed(this));
|
_types.add(new MountNightmareSteed(this));
|
||||||
|
// Hidden in this update
|
||||||
|
//_types.add(new MountChicken(this));
|
||||||
//_types.add(new MountSheep(this));
|
//_types.add(new MountSheep(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,149 @@
|
|||||||
|
package mineplex.core.mount.types;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Horse;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||||
|
import mineplex.core.mount.HorseMount;
|
||||||
|
import mineplex.core.mount.MountManager;
|
||||||
|
import mineplex.core.mount.SingleEntityMountData;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class MountChicken extends HorseMount
|
||||||
|
{
|
||||||
|
|
||||||
|
private static Field _jumpField;
|
||||||
|
|
||||||
|
public MountChicken(MountManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Chicken Mount",
|
||||||
|
UtilText.splitLinesToArray(new String[]
|
||||||
|
{
|
||||||
|
"This isn't flying! It is falling with style."
|
||||||
|
}, LineFormat.LORE),
|
||||||
|
Material.FEATHER, (byte) 0, -1, Horse.Color.BLACK, Horse.Style.NONE, Horse.Variant.HORSE, 2.0, Material.AIR, YearMonth.of(2017, Month.JANUARY));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_jumpField = EntityLiving.class.getDeclaredField("aY");
|
||||||
|
_jumpField.setAccessible(false);
|
||||||
|
} catch (NoSuchFieldException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableCustom(Player player)
|
||||||
|
{
|
||||||
|
player.leaveVehicle();
|
||||||
|
player.eject();
|
||||||
|
|
||||||
|
//Remove other mounts
|
||||||
|
Manager.DeregisterAll(player);
|
||||||
|
|
||||||
|
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
||||||
|
horse.setAdult();
|
||||||
|
horse.setAgeLock(true);
|
||||||
|
horse.setColor(_color);
|
||||||
|
horse.setStyle(_style);
|
||||||
|
horse.setVariant(_variant);
|
||||||
|
horse.setOwner(player);
|
||||||
|
horse.setMaxDomestication(1);
|
||||||
|
horse.setJumpStrength(_jump);
|
||||||
|
horse.setMaxHealth(20);
|
||||||
|
horse.setHealth(horse.getMaxHealth());
|
||||||
|
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
|
||||||
|
|
||||||
|
if (horse.getVariant() == Horse.Variant.MULE)
|
||||||
|
horse.setCarryingChest(true);
|
||||||
|
|
||||||
|
if (_armor != null)
|
||||||
|
horse.getInventory().setArmor(new ItemStack(_armor));
|
||||||
|
|
||||||
|
horse.setCustomName(player.getName() + "'s " + getName());
|
||||||
|
|
||||||
|
//Inform
|
||||||
|
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(getName()) + "."));
|
||||||
|
|
||||||
|
//Store
|
||||||
|
SingleEntityMountData<Horse> mount = new SingleEntityMountData<>(player, horse);
|
||||||
|
_active.put(player, mount);
|
||||||
|
|
||||||
|
DisguiseChicken chicken = new DisguiseChicken(horse);
|
||||||
|
chicken.setName(player.getName() + "'s Chicken Mount");
|
||||||
|
Manager.getDisguiseManager().disguise(chicken);
|
||||||
|
|
||||||
|
UtilEnt.silence(horse, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void jump(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (Player player : getActive().keySet())
|
||||||
|
{
|
||||||
|
final Horse horse = getActive().get(player).getEntity();
|
||||||
|
|
||||||
|
// Slows down falling
|
||||||
|
if (!horse.isOnGround() && horse.getVelocity().getY() < 0)
|
||||||
|
{
|
||||||
|
Vector velocity = horse.getVelocity();
|
||||||
|
velocity.setY(velocity.getY() * 0.6);
|
||||||
|
horse.setVelocity(velocity);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (horse.getPassenger() != player)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!UtilEnt.isGrounded(horse))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(player, "Chicken Mount Jump", 100, false, false))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boolean isJumping = _jumpField.getBoolean(((CraftPlayer) player).getHandle());
|
||||||
|
|
||||||
|
if (!isJumping)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Not jumping anymore
|
||||||
|
((CraftPlayer) player).getHandle().i(false);
|
||||||
|
|
||||||
|
//Velocity
|
||||||
|
UtilAction.velocity(horse, 1.4, 0.38, .8, true);
|
||||||
|
|
||||||
|
//Sound
|
||||||
|
player.playSound(horse.getLocation(), Sound.CHICKEN_IDLE, .4F, 1.0F);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -4,6 +4,8 @@ import java.lang.reflect.Field;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -33,13 +35,14 @@ import mineplex.core.mount.SingleEntityMountData;
|
|||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
|
||||||
|
|
||||||
public class MountSpider extends HorseMount
|
public class MountSpider extends HorseMount
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @author Mysticate
|
* @author Mysticate
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
private static Field _jumpField;
|
||||||
|
|
||||||
public MountSpider(MountManager manager)
|
public MountSpider(MountManager manager)
|
||||||
{
|
{
|
||||||
@ -54,6 +57,14 @@ public class MountSpider extends HorseMount
|
|||||||
C.cBlue + "Only buyable during Halloween 2015"
|
C.cBlue + "Only buyable during Halloween 2015"
|
||||||
}, LineFormat.LORE),
|
}, LineFormat.LORE),
|
||||||
Material.WEB, (byte) 0, -1, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR);
|
Material.WEB, (byte) 0, -1, Color.BLACK, Style.NONE, Variant.HORSE, 2.0, Material.AIR);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_jumpField = EntityLiving.class.getDeclaredField("aY");
|
||||||
|
_jumpField.setAccessible(true);
|
||||||
|
} catch (NoSuchFieldException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -152,43 +163,6 @@ public class MountSpider extends HorseMount
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @EventHandler(priority = EventPriority.LOW)
|
|
||||||
// public void doubleJump(PlayerToggleFlightEvent event)
|
|
||||||
// {
|
|
||||||
// Player player = event.getPlayer();
|
|
||||||
//
|
|
||||||
// if (player.getGameMode() == GameMode.CREATIVE)
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// if (!getActive().containsKey(player))
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// if (getActive().get(player).getPassenger() != event.getPlayer())
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// //Chicken Cancel
|
|
||||||
// DisguiseBase disguise = Manager.getDisguiseManager().getDisguise(player);
|
|
||||||
// if (disguise != null && ((disguise instanceof DisguiseChicken && !((DisguiseChicken)disguise).isBaby()) || disguise instanceof DisguiseBat || disguise instanceof DisguiseEnderman || disguise instanceof DisguiseWither))
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// Horse horse = getActive().get(event.getPlayer());
|
|
||||||
//
|
|
||||||
// if (!UtilEnt.isGrounded(horse))
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// event.setCancelled(true);
|
|
||||||
// player.setFlying(false);
|
|
||||||
//
|
|
||||||
// //Disable Flight
|
|
||||||
// player.setAllowFlight(false);
|
|
||||||
//
|
|
||||||
// //Velocity
|
|
||||||
// UtilAction.velocity(horse, 1.4, 0.38, 1, true);
|
|
||||||
//
|
|
||||||
// //Sound
|
|
||||||
// player.playSound(horse.getLocation(), Sound.SPIDER_IDLE, .4F, 1.0F);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void jump(UpdateEvent event)
|
public void jump(UpdateEvent event)
|
||||||
@ -211,13 +185,7 @@ public class MountSpider extends HorseMount
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Field jump = EntityLiving.class.getDeclaredField("aY");
|
boolean isJumping = _jumpField.getBoolean(((CraftPlayer) player).getHandle());
|
||||||
final boolean accessable = jump.isAccessible();
|
|
||||||
|
|
||||||
jump.setAccessible(true);
|
|
||||||
boolean isJumping = jump.getBoolean(((CraftPlayer) player).getHandle());
|
|
||||||
|
|
||||||
jump.setAccessible(accessable);
|
|
||||||
|
|
||||||
if (!isJumping)
|
if (!isJumping)
|
||||||
continue;
|
continue;
|
||||||
|
@ -3,6 +3,7 @@ package mineplex.core.playwire;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -20,7 +21,14 @@ public class PlayWireCommand implements CommandExecutor
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args)
|
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args)
|
||||||
{
|
{
|
||||||
_manager.onCommand(args);
|
if (commandSender instanceof Player)
|
||||||
|
{
|
||||||
|
commandSender.sendMessage("Unknown command. Type \"/help\" for help.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_manager.onCommand(args);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,27 @@
|
|||||||
package mineplex.core.playwire;
|
package mineplex.core.playwire;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.Managers;
|
import mineplex.core.Managers;
|
||||||
import mineplex.core.MiniDbClientPlugin;
|
import mineplex.core.MiniDbClientPlugin;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.bonuses.BonusManager;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.Callback;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.treasure.TreasureType;
|
import mineplex.core.treasure.TreasureType;
|
||||||
import org.bukkit.Bukkit;
|
import mineplex.serverdata.database.DBPool;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -24,13 +31,15 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData>
|
|||||||
|
|
||||||
private final long COOL_DOWN = TimeUnit.HOURS.getMilliseconds();
|
private final long COOL_DOWN = TimeUnit.HOURS.getMilliseconds();
|
||||||
private static final int REWARD_MESSAGE_DELAY_SECONDS = 10;
|
private static final int REWARD_MESSAGE_DELAY_SECONDS = 10;
|
||||||
|
|
||||||
|
private final CoreClientManager _clientManager;
|
||||||
private final DonationManager _donationManager;
|
private final DonationManager _donationManager;
|
||||||
private final PlayWireRepository _repository;
|
private final PlayWireRepository _repository;
|
||||||
|
|
||||||
public PlayWireManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
public PlayWireManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager)
|
||||||
{
|
{
|
||||||
super("PlayWire", plugin, clientManager);
|
super("PlayWire", plugin, clientManager);
|
||||||
|
_clientManager = clientManager;
|
||||||
_donationManager = donationManager;
|
_donationManager = donationManager;
|
||||||
_repository = new PlayWireRepository(this);
|
_repository = new PlayWireRepository(this);
|
||||||
getPlugin().getCommand("playwire").setExecutor(new PlayWireCommand(this));
|
getPlugin().getCommand("playwire").setExecutor(new PlayWireCommand(this));
|
||||||
@ -73,6 +82,42 @@ public class PlayWireManager extends MiniDbClientPlugin<PlayWireClientData>
|
|||||||
_repository.attemptPlayWire(player, client, () ->
|
_repository.attemptPlayWire(player, client, () ->
|
||||||
{
|
{
|
||||||
_donationManager.RewardCoinsLater("Watching Ad", player, 100);
|
_donationManager.RewardCoinsLater("Watching Ad", player, 100);
|
||||||
|
final int accountId = _clientManager.Get(player).getAccountId();
|
||||||
|
final Callback<Integer> ticketCallback = new Callback<Integer>()
|
||||||
|
{
|
||||||
|
public void run(Integer newTickets)
|
||||||
|
{
|
||||||
|
Managers.get(BonusManager.class).Get(player).setTickets(newTickets);
|
||||||
|
Managers.get(BonusManager.class).updateCreeperVisual(player, true, C.cAqua);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
runAsync(() ->
|
||||||
|
{
|
||||||
|
try (Connection c = DBPool.getAccount().getConnection(); Statement statement = c.createStatement())
|
||||||
|
{
|
||||||
|
final String query = "UPDATE bonus SET tickets = tickets + 1 WHERE accountId = " + accountId + ";SELECT tickets FROM bonus WHERE accountId = " + accountId;
|
||||||
|
|
||||||
|
statement.execute(query);
|
||||||
|
statement.getUpdateCount();
|
||||||
|
statement.getMoreResults();
|
||||||
|
|
||||||
|
ResultSet rs = statement.getResultSet();
|
||||||
|
if (rs.next())
|
||||||
|
{
|
||||||
|
final int newTickets = rs.getInt(1);
|
||||||
|
runSync(() ->
|
||||||
|
{
|
||||||
|
ticketCallback.run(newTickets);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.out.println("Failed to award ticket to player: " + player);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Managers.get(BonusManager.class).addPendingExplosion(player, player.getName());
|
||||||
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage()), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
Bukkit.getScheduler().runTaskLater(getClientManager().getPlugin(), () -> UtilPlayer.message(player, ResponseType.COUNTED.getMessage()), REWARD_MESSAGE_DELAY_SECONDS * 20L);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@ import mineplex.core.common.util.F;
|
|||||||
public enum ResponseType
|
public enum ResponseType
|
||||||
{
|
{
|
||||||
|
|
||||||
COUNTED(F.main("Carl", "Rewarded " + F.elem("250 Treasure Shards") + " for watching the Ad")),
|
COUNTED(F.main("Carl", "Rewarded " + F.elem("100 Treasure Shards") + " and " + F.elem("1 Carl Spin Ticket") + " for watching the Ad")),
|
||||||
UNCOUNTED(F.main("Carl", "You already watched the Ad within the past 12 hours!")),
|
UNCOUNTED(F.main("Carl", "You already watched the Ad within the past hour!")),
|
||||||
BLOCKED(F.main("Carl", "You have an AdBlocker on, but tried to watch the Ad! Ssssssslight problem there!")),
|
BLOCKED(F.main("Carl", "You have an AdBlocker on, but tried to watch the Ad! Ssssssslight problem there!")),
|
||||||
UNFILLED(F.main("Carl", "Ssssomething went wrong with the Ad, we'll get it sorted ASAP.")),;
|
UNFILLED(F.main("Carl", "Ssssomething went wrong with the Ad, we'll get it sorted ASAP.")),;
|
||||||
|
|
||||||
|
@ -2,22 +2,24 @@ package mineplex.core.powerplayclub;
|
|||||||
|
|
||||||
import java.time.Month;
|
import java.time.Month;
|
||||||
import java.time.YearMonth;
|
import java.time.YearMonth;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import mineplex.core.common.currency.GlobalCurrency;
|
|
||||||
import mineplex.core.common.skin.SkinData;
|
import mineplex.core.common.skin.SkinData;
|
||||||
import mineplex.core.common.util.BukkitFuture;
|
import mineplex.core.common.util.BukkitFuture;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.inventory.data.Item;
|
import mineplex.core.inventory.data.Item;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
public class PowerPlayClubRewards
|
public class PowerPlayClubRewards
|
||||||
{
|
{
|
||||||
@ -27,6 +29,8 @@ public class PowerPlayClubRewards
|
|||||||
private static final Map<YearMonth, PowerPlayClubItem> rewards = ImmutableMap.<YearMonth, PowerPlayClubItem>builder()
|
private static final Map<YearMonth, PowerPlayClubItem> rewards = ImmutableMap.<YearMonth, PowerPlayClubItem>builder()
|
||||||
.put(YearMonth.of(2016, Month.SEPTEMBER), new PowerPlayClubItem("Squid Morph", new ItemStack(Material.INK_SACK)))
|
.put(YearMonth.of(2016, Month.SEPTEMBER), new PowerPlayClubItem("Squid Morph", new ItemStack(Material.INK_SACK)))
|
||||||
.put(YearMonth.of(2016, Month.OCTOBER), new PowerPlayClubItem("Witch Morph", SkinData.WITCH.getSkull()))
|
.put(YearMonth.of(2016, Month.OCTOBER), new PowerPlayClubItem("Witch Morph", SkinData.WITCH.getSkull()))
|
||||||
|
.put(YearMonth.of(2016, Month.NOVEMBER), new PowerPlayClubItem("Turkey Morph", SkinData.TURKEY.getSkull()))
|
||||||
|
.put(YearMonth.of(2017, Month.JANUARY), new PowerPlayClubItem("Chicken Mount", new ItemStack(Material.GLASS)))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static class PowerPlayClubItem
|
public static class PowerPlayClubItem
|
||||||
|
@ -36,6 +36,9 @@ public class PowerPlayData
|
|||||||
return new PowerPlayData(Optional.empty(), Collections.emptySet(), Collections.emptySet());
|
return new PowerPlayData(Optional.empty(), Collections.emptySet(), Collections.emptySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final LocalDate today = LocalDate.now();
|
||||||
|
final YearMonth thisMonth = YearMonth.now();
|
||||||
|
|
||||||
// Build the list of potential claim dates from subscriptions
|
// Build the list of potential claim dates from subscriptions
|
||||||
// Note that it's a LinkedList with dates in ascending order
|
// Note that it's a LinkedList with dates in ascending order
|
||||||
List<LocalDate> claimDates = subscriptions.stream()
|
List<LocalDate> claimDates = subscriptions.stream()
|
||||||
@ -49,7 +52,7 @@ public class PowerPlayData
|
|||||||
|
|
||||||
// In the case of a yearly subscription, they're likely to have a claim date scheduled
|
// In the case of a yearly subscription, they're likely to have a claim date scheduled
|
||||||
// (this is not the case for the last month)
|
// (this is not the case for the last month)
|
||||||
Optional<LocalDate> nextSubClaim = claimDates.stream().filter(date -> date.isAfter(LocalDate.now())).findFirst();
|
Optional<LocalDate> nextSubClaim = claimDates.stream().filter(date -> date.isAfter(today)).findFirst();
|
||||||
if (nextSubClaim.isPresent())
|
if (nextSubClaim.isPresent())
|
||||||
{
|
{
|
||||||
nextClaimDate = nextSubClaim;
|
nextClaimDate = nextSubClaim;
|
||||||
@ -59,14 +62,14 @@ public class PowerPlayData
|
|||||||
// In the case of a monthly subscription, we need to extrapolate the next claim date
|
// In the case of a monthly subscription, we need to extrapolate the next claim date
|
||||||
nextClaimDate = Optional.of(claimDates.get(claimDates.size() - 1))
|
nextClaimDate = Optional.of(claimDates.get(claimDates.size() - 1))
|
||||||
.map(date -> date.plusMonths(1))
|
.map(date -> date.plusMonths(1))
|
||||||
.filter(date -> date.isAfter(LocalDate.now())); // and make sure it's after today
|
.filter(date -> date.equals(today) || date.isAfter(today)); // and make sure it's today or later
|
||||||
nextClaimDate.ifPresent(claimDates::add);
|
nextClaimDate.ifPresent(claimDates::add);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine the months whose cosmetics can be used by this player
|
// Determine the months whose cosmetics can be used by this player
|
||||||
Set<YearMonth> cosmeticMonths = claimDates.stream()
|
Set<YearMonth> cosmeticMonths = claimDates.stream()
|
||||||
.map(YearMonth::from)
|
.map(YearMonth::from)
|
||||||
.filter(yearMonth -> yearMonth.isBefore(YearMonth.now()) || yearMonth.equals(YearMonth.now()))
|
.filter(yearMonth -> yearMonth.isBefore(thisMonth) || yearMonth.equals(thisMonth))
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
// Remove already-claimed months
|
// Remove already-claimed months
|
||||||
@ -89,7 +92,7 @@ public class PowerPlayData
|
|||||||
});
|
});
|
||||||
|
|
||||||
Set<YearMonth> unclaimedMonths = claimDates.stream()
|
Set<YearMonth> unclaimedMonths = claimDates.stream()
|
||||||
.filter(date -> date.isBefore(LocalDate.now()) || date.equals(LocalDate.now())) // Filter dates yet to come
|
.filter(date -> date.isBefore(today) || date.equals(today)) // Filter dates yet to come
|
||||||
.map(YearMonth::from)
|
.map(YearMonth::from)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
|
@ -243,13 +243,7 @@ public class Recharge extends MiniPlugin
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void clearPlayer(final ClientUnloadEvent event)
|
public void clearPlayer(final ClientUnloadEvent event)
|
||||||
{
|
{
|
||||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable() {
|
_recharge.remove(event.GetName());
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
_recharge.remove(event.GetName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
, 20 * 60 * 2); // Retain info for 2 minutes
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDisplayForce(Player player, String ability, boolean displayForce)
|
public void setDisplayForce(Player player, String ability, boolean displayForce)
|
||||||
|
@ -10,27 +10,27 @@ public enum ReportCategory
|
|||||||
/**
|
/**
|
||||||
* Global category, used for representing values which aren't tied to a specific category (such as abusive report statistics).
|
* Global category, used for representing values which aren't tied to a specific category (such as abusive report statistics).
|
||||||
*/
|
*/
|
||||||
GLOBAL(0),
|
GLOBAL((short) 0),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hacking category, for reports involving cheats of any sort.
|
* Hacking category, for reports involving cheats of any sort.
|
||||||
*/
|
*/
|
||||||
HACKING(1),
|
HACKING((short) 1),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Chat Abuse category, for reports involving offensive comments made in chat.
|
* Chat Abuse category, for reports involving offensive comments made in chat.
|
||||||
*/
|
*/
|
||||||
CHAT_ABUSE(2),
|
CHAT_ABUSE((short) 2),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gameplay category, for reports specific to gameplay (such as bug exploits or issues with the map).
|
* Gameplay category, for reports specific to gameplay (such as bug exploits or issues with the map).
|
||||||
*/
|
*/
|
||||||
GAMEPLAY(3);
|
GAMEPLAY((short) 3);
|
||||||
|
|
||||||
private final int _id;
|
private final short _id;
|
||||||
private final String _name;
|
private final String _name;
|
||||||
|
|
||||||
ReportCategory(int id)
|
ReportCategory(short id)
|
||||||
{
|
{
|
||||||
_id = id;
|
_id = id;
|
||||||
_name = WordUtils.capitalizeFully(name().replace('_', ' '));
|
_name = WordUtils.capitalizeFully(name().replace('_', ' '));
|
||||||
@ -41,7 +41,7 @@ public enum ReportCategory
|
|||||||
*
|
*
|
||||||
* @return the id
|
* @return the id
|
||||||
*/
|
*/
|
||||||
public int getId()
|
public short getId()
|
||||||
{
|
{
|
||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import mineplex.core.chatsnap.SnapshotMetadata;
|
||||||
import mineplex.core.chatsnap.SnapshotRepository;
|
import mineplex.core.chatsnap.SnapshotRepository;
|
||||||
import mineplex.core.common.jsonchat.ChildJsonMessage;
|
import mineplex.core.common.jsonchat.ChildJsonMessage;
|
||||||
import mineplex.core.common.jsonchat.ClickEvent;
|
import mineplex.core.common.jsonchat.ClickEvent;
|
||||||
@ -80,19 +81,31 @@ public class ReportHandlerTask extends BukkitRunnable
|
|||||||
.add(prefix + C.cAqua + "Suspect - " + C.cGold + suspectName)
|
.add(prefix + C.cAqua + "Suspect - " + C.cGold + suspectName)
|
||||||
.add("\n")
|
.add("\n")
|
||||||
.add(prefix + C.cAqua + "Type - " + C.cGold + report.getCategory().getName())
|
.add(prefix + C.cAqua + "Type - " + C.cGold + report.getCategory().getName())
|
||||||
|
.add("\n")
|
||||||
|
.add(prefix + C.cAqua + "Team - " + C.cGold + report.getAssignedTeam().map(ReportTeam::getName).orElse("None"))
|
||||||
.add("\n" + prefix + "\n")
|
.add("\n" + prefix + "\n")
|
||||||
.add(prefix + C.cGold + report.getMessages().size() + C.cAqua + " total reports")
|
.add(prefix + C.cGold + report.getMessages().size() + C.cAqua + " total reports")
|
||||||
.add("\n")
|
.add("\n")
|
||||||
.add(Arrays.stream(getReportReasons(report)).map(s -> prefix + s).collect(Collectors.joining("\n")))
|
.add(Arrays.stream(getReportReasons(report)).map(s -> prefix + s).collect(Collectors.joining("\n")))
|
||||||
.add("\n" + prefix + "\n");
|
.add("\n" + prefix + "\n");
|
||||||
|
|
||||||
if (report.getCategory() == ReportCategory.CHAT_ABUSE)
|
Optional<SnapshotMetadata> snapshotMetadataOptional = report.getSnapshotMetadata();
|
||||||
|
|
||||||
|
if (snapshotMetadataOptional.isPresent())
|
||||||
{
|
{
|
||||||
jsonMessage = jsonMessage
|
SnapshotMetadata snapshotMetadata = snapshotMetadataOptional.get();
|
||||||
.add(prefix + C.cAqua + "View chat log")
|
Optional<String> tokenOptional = snapshotMetadata.getToken();
|
||||||
.hover(HoverEvent.SHOW_TEXT, C.cGray + "Opens the chat log in your default browser")
|
|
||||||
.click(ClickEvent.OPEN_URL, SnapshotRepository.getURL(reportId))
|
if (tokenOptional.isPresent())
|
||||||
.add("\n");
|
{
|
||||||
|
String token = tokenOptional.get();
|
||||||
|
|
||||||
|
jsonMessage = jsonMessage
|
||||||
|
.add(prefix + C.cAqua + "View chat log")
|
||||||
|
.hover(HoverEvent.SHOW_TEXT, C.cGray + "Opens the chat log in your default browser")
|
||||||
|
.click(ClickEvent.OPEN_URL, SnapshotRepository.getURL(token))
|
||||||
|
.add("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonMessage = jsonMessage
|
jsonMessage = jsonMessage
|
||||||
|
@ -19,6 +19,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import mineplex.core.account.CoreClient;
|
import mineplex.core.account.CoreClient;
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.chatsnap.SnapshotManager;
|
import mineplex.core.chatsnap.SnapshotManager;
|
||||||
|
import mineplex.core.chatsnap.SnapshotMetadata;
|
||||||
import mineplex.core.chatsnap.command.PushSnapshotsCommand;
|
import mineplex.core.chatsnap.command.PushSnapshotsCommand;
|
||||||
import mineplex.core.chatsnap.command.PushSnapshotsHandler;
|
import mineplex.core.chatsnap.command.PushSnapshotsHandler;
|
||||||
import mineplex.core.command.CommandCenter;
|
import mineplex.core.command.CommandCenter;
|
||||||
@ -148,8 +149,8 @@ public class ReportManager
|
|||||||
// create snapshot id ahead of time
|
// create snapshot id ahead of time
|
||||||
if (category == ReportCategory.CHAT_ABUSE)
|
if (category == ReportCategory.CHAT_ABUSE)
|
||||||
{
|
{
|
||||||
int snapshotId = _snapshotManager.getSnapshotRepository().createSnapshot(null).join();
|
SnapshotMetadata snapshotMetadata = _snapshotManager.getSnapshotRepository().createSnapshot(null).join();
|
||||||
report.setSnapshotId(snapshotId);
|
report.setSnapshotMetadata(snapshotMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
saveReport(report).join();
|
saveReport(report).join();
|
||||||
|
@ -6,7 +6,6 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.report.command.ReportAbortCommand;
|
|
||||||
import mineplex.core.report.command.ReportCloseCommand;
|
import mineplex.core.report.command.ReportCloseCommand;
|
||||||
import mineplex.core.report.command.ReportCommand;
|
import mineplex.core.report.command.ReportCommand;
|
||||||
import mineplex.core.report.command.ReportHandleCommand;
|
import mineplex.core.report.command.ReportHandleCommand;
|
||||||
@ -38,7 +37,6 @@ public class ReportPlugin extends MiniPlugin
|
|||||||
addCommand(new ReportHandleCommand(this));
|
addCommand(new ReportHandleCommand(this));
|
||||||
addCommand(new ReportCloseCommand(this));
|
addCommand(new ReportCloseCommand(this));
|
||||||
addCommand(new ReportStatsCommand(this));
|
addCommand(new ReportStatsCommand(this));
|
||||||
addCommand(new ReportAbortCommand(this));
|
|
||||||
addCommand(new ReportInfoCommand(this));
|
addCommand(new ReportInfoCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,11 @@ public enum ReportTeam
|
|||||||
_initialPriority = initialPriority;
|
_initialPriority = initialPriority;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return name();
|
||||||
|
}
|
||||||
|
|
||||||
public short getDatabaseId()
|
public short getDatabaseId()
|
||||||
{
|
{
|
||||||
return _databaseId;
|
return _databaseId;
|
||||||
|
@ -1,64 +0,0 @@
|
|||||||
package mineplex.core.report.command;
|
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.command.CommandBase;
|
|
||||||
import mineplex.core.common.Rank;
|
|
||||||
import mineplex.core.common.util.BukkitFuture;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.report.ReportManager;
|
|
||||||
import mineplex.core.report.ReportPlugin;
|
|
||||||
import mineplex.core.report.data.Report;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A command which allows a staff member to abort the report which they are currently handling.
|
|
||||||
* Another staff member may be given this report when executing {@link ReportHandleCommand}.
|
|
||||||
*/
|
|
||||||
public class ReportAbortCommand extends CommandBase<ReportPlugin>
|
|
||||||
{
|
|
||||||
public ReportAbortCommand(ReportPlugin plugin)
|
|
||||||
{
|
|
||||||
super(plugin, Rank.MODERATOR, "reportabort");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Execute(Player player, String[] args)
|
|
||||||
{
|
|
||||||
if (args == null || args.length == 0)
|
|
||||||
{
|
|
||||||
ReportManager reportManager = Plugin.getReportManager();
|
|
||||||
|
|
||||||
reportManager.getReportHandling(player).whenComplete(BukkitFuture.complete((reportOptional, throwable) ->
|
|
||||||
{
|
|
||||||
if (throwable == null)
|
|
||||||
{
|
|
||||||
if (reportOptional.isPresent())
|
|
||||||
{
|
|
||||||
Report report = reportOptional.get();
|
|
||||||
|
|
||||||
reportManager.abortReport(report).thenApply(BukkitFuture.accept(voidValue ->
|
|
||||||
UtilPlayer.message(player, F.main(ReportManager.getReportPrefix(report),
|
|
||||||
"Report has been aborted and may be handled by another staff member."))));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main(Plugin.getName(), "You aren't currently handling a report."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "An error occurred, please try again later."));
|
|
||||||
Plugin.getPlugin().getLogger().log(Level.SEVERE, "Error whilst aborting report for player " + player.getName(), throwable);
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main(Plugin.getName(), C.cRed + "Invalid Usage: " + F.elem("/" + _aliasUsed)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user