Leveling and General Cosmetic update (#584)
This commit is contained in:
parent
ccd3f747fd
commit
09b8f2fd98
@ -1,10 +1,13 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
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;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
||||||
import net.minecraft.server.v1_8_R3.EntityBat;
|
import net.minecraft.server.v1_8_R3.EntityBat;
|
||||||
@ -14,6 +17,7 @@ import net.minecraft.server.v1_8_R3.EntityHuman;
|
|||||||
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
import net.minecraft.server.v1_8_R3.EntityInsentient;
|
||||||
import net.minecraft.server.v1_8_R3.EntityLiving;
|
import net.minecraft.server.v1_8_R3.EntityLiving;
|
||||||
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
|
||||||
|
import net.minecraft.server.v1_8_R3.EntityTypes;
|
||||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
import net.minecraft.server.v1_8_R3.NavigationAbstract;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
|
||||||
@ -43,6 +47,7 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.Giant;
|
import org.bukkit.entity.Giant;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -1062,4 +1067,26 @@ public class UtilEnt
|
|||||||
{
|
{
|
||||||
return ((CraftEntity) entity).getHandle().inWater;
|
return ((CraftEntity) entity).getHandle().inWater;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void registerEntityType(Class<? extends net.minecraft.server.v1_8_R3.Entity> customClass, EntityType entityType, String name) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException
|
||||||
|
{
|
||||||
|
Field cField = EntityTypes.class.getDeclaredField("c");
|
||||||
|
Field eField = EntityTypes.class.getDeclaredField("e");
|
||||||
|
|
||||||
|
cField.setAccessible(true);
|
||||||
|
eField.setAccessible(true);
|
||||||
|
|
||||||
|
((Map) cField.get(null)).remove(name);
|
||||||
|
((Map) eField.get(null)).remove((int) entityType.getTypeId());
|
||||||
|
|
||||||
|
Method method = EntityTypes.class.getDeclaredMethod("a", Class.class, String.class, int.class);
|
||||||
|
method.setAccessible(true);
|
||||||
|
method.invoke(null, customClass, name, entityType.getTypeId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void spawnEntity(net.minecraft.server.v1_8_R3.Entity entity, Location location)
|
||||||
|
{
|
||||||
|
entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||||
|
((CraftWorld) location.getWorld()).getHandle().addEntity(entity, SpawnReason.CUSTOM);
|
||||||
|
}
|
||||||
}
|
}
|
@ -66,6 +66,14 @@ public enum CountryFlag
|
|||||||
new Pattern(BLUE, CURLY_BORDER),
|
new Pattern(BLUE, CURLY_BORDER),
|
||||||
new Pattern(WHITE, FLOWER)),
|
new Pattern(WHITE, FLOWER)),
|
||||||
|
|
||||||
|
HEART("Heart", "Heart", RED,
|
||||||
|
new Pattern(BLACK, CURLY_BORDER),
|
||||||
|
new Pattern(BLACK, STRIPE_BOTTOM),
|
||||||
|
new Pattern(RED, RHOMBUS_MIDDLE),
|
||||||
|
new Pattern(RED, CIRCLE_MIDDLE),
|
||||||
|
new Pattern(BLACK, TRIANGLE_TOP),
|
||||||
|
new Pattern(BLACK, STRIPE_TOP)),
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
AFGHANISTAN("Afghanistan", "Afghanistani", RED,
|
AFGHANISTAN("Afghanistan", "Afghanistani", RED,
|
||||||
new Pattern(BLACK, STRIPE_TOP),
|
new Pattern(BLACK, STRIPE_TOP),
|
||||||
|
@ -1474,15 +1474,15 @@ public enum Achievement
|
|||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private String _name;
|
private final String _name;
|
||||||
private String[] _desc;
|
private final String[] _desc;
|
||||||
private String[] _stats;
|
private final String[] _stats;
|
||||||
private int[][] _levelUpRewards;
|
private final int[][] _levelUpRewards;
|
||||||
private int[] _levels;
|
private final int[] _levels;
|
||||||
private String _defaultLevelName;
|
private final String _defaultLevelName;
|
||||||
private String[] _levelNames;
|
private final String[] _levelNames;
|
||||||
private int _gems;
|
private final int _gems;
|
||||||
private AchievementCategory _category;
|
private final AchievementCategory _category;
|
||||||
|
|
||||||
Achievement(String name, int gems, String[] stats, String[] desc, int[][] levelUpRewards, int[] levels, String defaultLevelName, String[] levelNames, AchievementCategory category)
|
Achievement(String name, int gems, String[] stats, String[] desc, int[][] levelUpRewards, int[] levels, String defaultLevelName, String[] levelNames, AchievementCategory category)
|
||||||
{
|
{
|
||||||
@ -1552,11 +1552,6 @@ public enum Achievement
|
|||||||
levels[i] = expReq;
|
levels[i] = expReq;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (int i=100 ; i<levels.length ; i++)
|
|
||||||
// {
|
|
||||||
// levels[i] = expReq;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return levels;
|
return levels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package mineplex.core.achievement;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
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.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -14,9 +13,14 @@ import mineplex.core.account.permissions.Permission;
|
|||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
import mineplex.core.achievement.command.StatsCommand;
|
import mineplex.core.achievement.command.StatsCommand;
|
||||||
import mineplex.core.achievement.ui.AchievementShop;
|
import mineplex.core.achievement.ui.AchievementShop;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.NautHashMap;
|
import mineplex.core.common.util.NautHashMap;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.elo.EloManager;
|
import mineplex.core.elo.EloManager;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
|
import mineplex.core.gadget.types.LevelPrefixGadget;
|
||||||
import mineplex.core.incognito.IncognitoManager;
|
import mineplex.core.incognito.IncognitoManager;
|
||||||
import mineplex.core.stats.PlayerStats;
|
import mineplex.core.stats.PlayerStats;
|
||||||
import mineplex.core.stats.StatsManager;
|
import mineplex.core.stats.StatsManager;
|
||||||
@ -38,6 +42,7 @@ public class AchievementManager extends MiniPlugin
|
|||||||
private final IncognitoManager _incognitoManager;
|
private final IncognitoManager _incognitoManager;
|
||||||
private final StatsManager _statsManager;
|
private final StatsManager _statsManager;
|
||||||
private final EloManager _eloManager;
|
private final EloManager _eloManager;
|
||||||
|
private GadgetManager _gadgetManager;
|
||||||
|
|
||||||
private final AchievementShop _shop;
|
private final AchievementShop _shop;
|
||||||
|
|
||||||
@ -53,8 +58,6 @@ public class AchievementManager extends MiniPlugin
|
|||||||
_clientManager = clientManager;
|
_clientManager = clientManager;
|
||||||
_shop = new AchievementShop(this, _statsManager, clientManager, donationManager, "Achievement");
|
_shop = new AchievementShop(this, _statsManager, clientManager, donationManager, "Achievement");
|
||||||
|
|
||||||
//new LevelingManager(this);
|
|
||||||
|
|
||||||
generatePermissions();
|
generatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +93,13 @@ public class AchievementManager extends MiniPlugin
|
|||||||
return type.getLevelData(exp);
|
return type.getLevelData(exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AchievementManager and GadgetManager depend on each other (which is a nightmare)
|
||||||
|
// In theory once everything can be created reflectively this can go
|
||||||
|
public void setGadgetManager(GadgetManager gadgetManager)
|
||||||
|
{
|
||||||
|
_gadgetManager = gadgetManager;
|
||||||
|
}
|
||||||
|
|
||||||
public EloManager getEloManager()
|
public EloManager getEloManager()
|
||||||
{
|
{
|
||||||
return _eloManager;
|
return _eloManager;
|
||||||
@ -236,7 +246,20 @@ public class AchievementManager extends MiniPlugin
|
|||||||
|
|
||||||
public String getMineplexLevel(Player sender)
|
public String getMineplexLevel(Player sender)
|
||||||
{
|
{
|
||||||
return Achievement.getExperienceString(getMineplexLevelNumber(sender)) + " " + ChatColor.RESET;
|
Gadget gadget = _gadgetManager == null ? null : _gadgetManager.getActive(sender, GadgetType.LEVEL_PREFIX);
|
||||||
|
String prefix;
|
||||||
|
int level = getMineplexLevelNumber(sender);
|
||||||
|
|
||||||
|
if (gadget != null)
|
||||||
|
{
|
||||||
|
prefix = ((LevelPrefixGadget) gadget).getPrefixType().getChatColor().toString() + level;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prefix = Achievement.getExperienceString(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
return prefix + C.Reset + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreClientManager getClientManager()
|
public CoreClientManager getClientManager()
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package mineplex.core.achievement.leveling;
|
||||||
|
|
||||||
|
import mineplex.serverdata.commands.ServerCommand;
|
||||||
|
|
||||||
|
public class LevelBroadcastServerCommand extends ServerCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
private final String _player;
|
||||||
|
|
||||||
|
LevelBroadcastServerCommand(String player)
|
||||||
|
{
|
||||||
|
_player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlayer()
|
||||||
|
{
|
||||||
|
return _player;
|
||||||
|
}
|
||||||
|
}
|
@ -2,85 +2,89 @@ package mineplex.core.achievement.leveling;
|
|||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.AbstractMap.SimpleEntry;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
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.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.MiniDbClientPlugin;
|
import mineplex.core.MiniDbClientPlugin;
|
||||||
import mineplex.core.account.permissions.Permission;
|
import mineplex.core.ReflectivelyCreateMiniPlugin;
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
|
||||||
import mineplex.core.achievement.Achievement;
|
import mineplex.core.achievement.Achievement;
|
||||||
import mineplex.core.achievement.AchievementManager;
|
import mineplex.core.achievement.AchievementManager;
|
||||||
|
import mineplex.core.achievement.leveling.rewards.LevelCallbackReward;
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelChestReward;
|
import mineplex.core.achievement.leveling.rewards.LevelChestReward;
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelCurrencyReward;
|
import mineplex.core.achievement.leveling.rewards.LevelCurrencyReward;
|
||||||
|
import mineplex.core.achievement.leveling.rewards.LevelDummyReward;
|
||||||
|
import mineplex.core.achievement.leveling.rewards.LevelGadgetReward;
|
||||||
|
import mineplex.core.achievement.leveling.rewards.LevelGameAmplifierReward;
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
||||||
import mineplex.core.achievement.leveling.ui.LevelRewardShop;
|
import mineplex.core.achievement.leveling.ui.LevelRewardShop;
|
||||||
import mineplex.core.command.CommandBase;
|
|
||||||
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.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.MorphOcelot;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleChickenWings;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleEnderDragonWings;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleMacawWings;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleWitchsCure;
|
||||||
|
import mineplex.core.gadget.gadgets.taunts.EasyModeTaunt;
|
||||||
|
import mineplex.core.gadget.types.Gadget;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.treasure.types.TreasureType;
|
import mineplex.core.treasure.types.TreasureType;
|
||||||
|
import mineplex.serverdata.commands.CommandCallback;
|
||||||
|
import mineplex.serverdata.commands.ServerCommandManager;
|
||||||
|
|
||||||
public class LevelingManager extends MiniDbClientPlugin<List<Integer>>
|
@ReflectivelyCreateMiniPlugin
|
||||||
|
public class LevelingManager extends MiniDbClientPlugin<List<Integer>> implements CommandCallback<LevelBroadcastServerCommand>
|
||||||
{
|
{
|
||||||
|
|
||||||
public enum Perm implements Permission
|
|
||||||
{
|
|
||||||
|
|
||||||
VIEW_LEVEL_MENU
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// That is a big old number
|
|
||||||
private static final int MAX_LEVEL = 100;
|
private static final int MAX_LEVEL = 100;
|
||||||
|
private static final int EXCLUSIVE_REWARDS_LEVEL = 80;
|
||||||
|
|
||||||
public static int getMaxLevel()
|
public static int getMaxLevel()
|
||||||
{
|
{
|
||||||
return MAX_LEVEL;
|
return MAX_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final AchievementManager _achievement;
|
private final AchievementManager _achievementManager;
|
||||||
|
private final GadgetManager _gadgetManager;
|
||||||
private final LevelingRepository _repository;
|
private final LevelingRepository _repository;
|
||||||
private final LevelRewardShop _shop;
|
private final LevelRewardShop _shop;
|
||||||
|
|
||||||
private final List<Entry<Integer, LevelReward>> _rewards;
|
private final Map<Integer, List<LevelReward>> _rewards;
|
||||||
|
|
||||||
public LevelingManager(AchievementManager achievementManager)
|
public LevelingManager()
|
||||||
{
|
{
|
||||||
super("Level Rewards");
|
super("Level Rewards");
|
||||||
|
|
||||||
_achievement = achievementManager;
|
_achievementManager = require(AchievementManager.class);
|
||||||
|
_gadgetManager = require(GadgetManager.class);
|
||||||
_repository = new LevelingRepository();
|
_repository = new LevelingRepository();
|
||||||
_shop = new LevelRewardShop(this, ClientManager, require(DonationManager.class));
|
_shop = new LevelRewardShop(this, ClientManager, require(DonationManager.class));
|
||||||
|
|
||||||
_rewards = new ArrayList<>(120);
|
_rewards = new HashMap<>(getMaxLevel());
|
||||||
|
|
||||||
|
ServerCommandManager.getInstance().registerCommandType(LevelBroadcastServerCommand.class, this);
|
||||||
|
|
||||||
populateRewards();
|
populateRewards();
|
||||||
generatePermissions();
|
|
||||||
|
|
||||||
addCommand(new CommandBase<LevelingManager>(this, Perm.VIEW_LEVEL_MENU,"level")
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void Execute(Player caller, String[] args)
|
|
||||||
{
|
|
||||||
_shop.attemptShopOpen(caller);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generatePermissions()
|
|
||||||
{
|
|
||||||
PermissionGroup.PLAYER.setPermission(Perm.VIEW_LEVEL_MENU, true, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateRewards()
|
private void populateRewards()
|
||||||
{
|
{
|
||||||
|
// 1-9
|
||||||
addCurrencyReward(1, GlobalCurrency.GEM, 100);
|
addCurrencyReward(1, GlobalCurrency.GEM, 100);
|
||||||
addCurrencyReward(2, GlobalCurrency.GEM, 200);
|
addCurrencyReward(2, GlobalCurrency.GEM, 200);
|
||||||
addChestReward(3, TreasureType.OLD, 1);
|
addChestReward(3, TreasureType.OLD, 1);
|
||||||
@ -90,17 +94,193 @@ public class LevelingManager extends MiniDbClientPlugin<List<Integer>>
|
|||||||
addCurrencyReward(7, GlobalCurrency.GEM, 250);
|
addCurrencyReward(7, GlobalCurrency.GEM, 250);
|
||||||
addCurrencyReward(8, GlobalCurrency.GEM, 250);
|
addCurrencyReward(8, GlobalCurrency.GEM, 250);
|
||||||
addCurrencyReward(9, GlobalCurrency.GEM, 500);
|
addCurrencyReward(9, GlobalCurrency.GEM, 500);
|
||||||
addChestReward(10, TreasureType.OLD, 2);
|
// 10-19
|
||||||
|
addChestReward(10, TreasureType.OLD, 5);
|
||||||
|
addCurrencyReward(11, GlobalCurrency.GEM, 750);
|
||||||
|
addCurrencyReward(12, GlobalCurrency.GEM, 250);
|
||||||
|
addCurrencyReward(12, GlobalCurrency.TREASURE_SHARD, 500);
|
||||||
|
addCurrencyReward(13, GlobalCurrency.GEM, 250);
|
||||||
|
addCurrencyReward(13, GlobalCurrency.TREASURE_SHARD, 500);
|
||||||
|
addCurrencyReward(14, GlobalCurrency.GEM, 1000);
|
||||||
|
addChestReward(15, TreasureType.OLD, 7);
|
||||||
|
addCurrencyReward(16, GlobalCurrency.GEM, 2000);
|
||||||
|
addCurrencyReward(17, GlobalCurrency.GEM, 500);
|
||||||
|
addCurrencyReward(17, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addCurrencyReward(18, GlobalCurrency.GEM, 500);
|
||||||
|
addCurrencyReward(18, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(18, TreasureType.OLD, 8);
|
||||||
|
addCurrencyReward(19, GlobalCurrency.GEM, 5000);
|
||||||
|
// 20-29
|
||||||
|
addGadgetReward(20, MorphOcelot.class);
|
||||||
|
addChestReward(20, TreasureType.OLD, 10);
|
||||||
|
addCurrencyReward(21, GlobalCurrency.GEM, 5000);
|
||||||
|
addCurrencyReward(22, GlobalCurrency.GEM, 500);
|
||||||
|
addCurrencyReward(22, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(23, TreasureType.ANCIENT, 1);
|
||||||
|
addCurrencyReward(24, GlobalCurrency.GEM, 500);
|
||||||
|
addCurrencyReward(24, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(25, TreasureType.ANCIENT, 5);
|
||||||
|
addCurrencyReward(26, GlobalCurrency.GEM, 10000);
|
||||||
|
addCurrencyReward(27, GlobalCurrency.GEM, 1000);
|
||||||
|
addCurrencyReward(27, GlobalCurrency.TREASURE_SHARD, 2000);
|
||||||
|
addCurrencyReward(28, GlobalCurrency.TREASURE_SHARD, 2000);
|
||||||
|
addChestReward(28, TreasureType.OLD, 2);
|
||||||
|
addChestReward(29, TreasureType.ANCIENT, 3);
|
||||||
|
// 30-39
|
||||||
|
addCurrencyReward(30, GlobalCurrency.GEM, 20000);
|
||||||
|
addCurrencyReward(31, GlobalCurrency.GEM, 1000);
|
||||||
|
addCurrencyReward(32, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addChestReward(33, TreasureType.ANCIENT, 1);
|
||||||
|
addCurrencyReward(34, GlobalCurrency.GEM, 2000);
|
||||||
|
addCurrencyReward(34, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addCurrencyReward(35, GlobalCurrency.GEM, 30000);
|
||||||
|
addCurrencyReward(36, GlobalCurrency.TREASURE_SHARD, 500);
|
||||||
|
addChestReward(37, TreasureType.ANCIENT, 5);
|
||||||
|
addCurrencyReward(38, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addCurrencyReward(39, GlobalCurrency.TREASURE_SHARD, 500);
|
||||||
|
addChestReward(39, TreasureType.OLD, 5);
|
||||||
|
// 40-49
|
||||||
|
addGadgetReward(40, ParticleWitchsCure.class);
|
||||||
|
addCurrencyReward(41, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addCurrencyReward(42, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(42, TreasureType.OLD, 5);
|
||||||
|
addChestReward(43, TreasureType.ANCIENT, 6);
|
||||||
|
addCurrencyReward(44, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(45, TreasureType.ANCIENT, 10);
|
||||||
|
addCurrencyReward(46, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addCurrencyReward(47, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(48, TreasureType.OLD, 5);
|
||||||
|
addChestReward(48, TreasureType.ANCIENT, 7);
|
||||||
|
addCurrencyReward(49, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
// 50-59
|
||||||
|
addChestReward(50, TreasureType.OMEGA, 1);
|
||||||
|
addChestReward(51, TreasureType.ANCIENT, 10);
|
||||||
|
addCurrencyReward(52, GlobalCurrency.TREASURE_SHARD, 1500);
|
||||||
|
addCurrencyReward(53, GlobalCurrency.TREASURE_SHARD, 1500);
|
||||||
|
addChestReward(53, TreasureType.OLD, 10);
|
||||||
|
addChestReward(54, TreasureType.ANCIENT, 5);
|
||||||
|
addCurrencyReward(55, GlobalCurrency.TREASURE_SHARD, 1500);
|
||||||
|
addCurrencyReward(56, GlobalCurrency.TREASURE_SHARD, 1500);
|
||||||
|
addChestReward(57, TreasureType.ANCIENT, 10);
|
||||||
|
addCurrencyReward(58, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addChestReward(59, TreasureType.ANCIENT, 10);
|
||||||
|
// 60-69
|
||||||
|
addGadgetReward(60, ParticleChickenWings.class);
|
||||||
|
addChestReward(60, TreasureType.MYTHICAL, 1);
|
||||||
|
addCurrencyReward(61, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addCurrencyReward(62, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(62, TreasureType.ANCIENT, 1);
|
||||||
|
addChestReward(63, TreasureType.MYTHICAL, 2);
|
||||||
|
addCurrencyReward(64, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addCurrencyReward(65, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(65, TreasureType.ANCIENT, 1);
|
||||||
|
addChestReward(66, TreasureType.MYTHICAL, 3);
|
||||||
|
addCurrencyReward(67, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(67, TreasureType.ANCIENT, 1);
|
||||||
|
addCurrencyReward(68, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(68, TreasureType.ANCIENT, 5);
|
||||||
|
addCurrencyReward(69, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
// 70-79
|
||||||
|
addChestReward(70, TreasureType.MYTHICAL, 6);
|
||||||
|
addCurrencyReward(71, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addCurrencyReward(72, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(72, TreasureType.ANCIENT, 5);
|
||||||
|
addCurrencyReward(73, GlobalCurrency.TREASURE_SHARD, 1000);
|
||||||
|
addChestReward(74, TreasureType.MYTHICAL, 5);
|
||||||
|
addGameAmplifierReward(75, 1);
|
||||||
|
addCurrencyReward(75, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addCurrencyReward(76, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addChestReward(77, TreasureType.MYTHICAL, 10);
|
||||||
|
addCurrencyReward(78, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addCurrencyReward(79, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addChestReward(79, TreasureType.ANCIENT, 10);
|
||||||
|
// 80-89
|
||||||
|
addGadgetReward(80, EasyModeTaunt.class);
|
||||||
|
addChestReward(80, TreasureType.ILLUMINATED, 1);
|
||||||
|
addChestReward(80, TreasureType.OMEGA, 1);
|
||||||
|
addChestReward(81, TreasureType.MYTHICAL, 5);
|
||||||
|
addCurrencyReward(82, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addCurrencyReward(83, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addCurrencyReward(84, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addChestReward(85, TreasureType.ILLUMINATED, 1);
|
||||||
|
addChestReward(85, TreasureType.MYTHICAL, 10);
|
||||||
|
addCurrencyReward(86, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addCurrencyReward(87, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addChestReward(87, TreasureType.MYTHICAL, 3);
|
||||||
|
addCurrencyReward(88, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addCurrencyReward(89, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
// 90-99
|
||||||
|
addGadgetReward(90, ParticleMacawWings.class);
|
||||||
|
addChestReward(90, TreasureType.ILLUMINATED, 1);
|
||||||
|
addChestReward(90, TreasureType.MYTHICAL, 10);
|
||||||
|
addCurrencyReward(91, GlobalCurrency.TREASURE_SHARD, 5000);
|
||||||
|
addCurrencyReward(92, GlobalCurrency.TREASURE_SHARD, 5000);
|
||||||
|
addChestReward(92, TreasureType.MYTHICAL, 3);
|
||||||
|
addCurrencyReward(93, GlobalCurrency.TREASURE_SHARD, 5000);
|
||||||
|
addChestReward(93, TreasureType.MYTHICAL, 5);
|
||||||
|
addCurrencyReward(94, GlobalCurrency.TREASURE_SHARD, 2500);
|
||||||
|
addChestReward(95, TreasureType.ILLUMINATED, 5);
|
||||||
|
addCurrencyReward(96, GlobalCurrency.TREASURE_SHARD, 10000);
|
||||||
|
addCurrencyReward(97, GlobalCurrency.TREASURE_SHARD, 10000);
|
||||||
|
addChestReward(97, TreasureType.MYTHICAL, 10);
|
||||||
|
addCurrencyReward(98, GlobalCurrency.TREASURE_SHARD, 10000);
|
||||||
|
addChestReward(98, TreasureType.MYTHICAL, 20);
|
||||||
|
addCurrencyReward(99, GlobalCurrency.TREASURE_SHARD, 15000);
|
||||||
|
// 100
|
||||||
|
addGadgetReward(100, ParticleEnderDragonWings.class);
|
||||||
|
addChestReward(100, TreasureType.OMEGA, 5);
|
||||||
|
addDummyReward(100, C.cWhite + "10" + C.cPurple + " Different Level Colors");
|
||||||
|
addCallbackReward(100, C.cRed + "Server Announcement", player ->
|
||||||
|
{
|
||||||
|
player.closeInventory();
|
||||||
|
new LevelBroadcastServerCommand(player.getName()).publish();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCurrencyReward(int level, GlobalCurrency type, int amount)
|
private void addCurrencyReward(int level, GlobalCurrency type, int amount)
|
||||||
{
|
{
|
||||||
_rewards.add(new SimpleEntry<>(level, new LevelCurrencyReward(type, amount)));
|
addReward(level, new LevelCurrencyReward(type, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addChestReward(int level, TreasureType type, int amount)
|
private void addChestReward(int level, TreasureType type, int amount)
|
||||||
{
|
{
|
||||||
_rewards.add(new SimpleEntry<>(level, new LevelChestReward(type, amount)));
|
addReward(level, new LevelChestReward(type, amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addGameAmplifierReward(int level, int amount)
|
||||||
|
{
|
||||||
|
addReward(level, new LevelGameAmplifierReward(amount));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addGadgetReward(int level, Class<? extends Gadget> clazz)
|
||||||
|
{
|
||||||
|
addReward(level, new LevelGadgetReward(_gadgetManager.getGadget(clazz)));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addDummyReward(int level, String description)
|
||||||
|
{
|
||||||
|
addReward(level, new LevelDummyReward(description));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addCallbackReward(int level, String description, Consumer<Player> callback)
|
||||||
|
{
|
||||||
|
addReward(level, new LevelCallbackReward(description, callback));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addReward(int level, LevelReward reward)
|
||||||
|
{
|
||||||
|
_rewards.computeIfAbsent(level, k -> new ArrayList<>(2)).add(reward);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(LevelBroadcastServerCommand command)
|
||||||
|
{
|
||||||
|
UtilTextMiddle.display(C.cRedB + command.getPlayer(), C.cGold + C.Scramble + "!!!" + C.cWhite + " Reached Level " + C.cRedB + "100 " + C.cGold + C.Scramble + "!!!",10, 60, 20, UtilServer.getPlayers());
|
||||||
|
|
||||||
|
for (Player player : UtilServer.getPlayersCollection())
|
||||||
|
{
|
||||||
|
player.playSound(player.getLocation(), Sound.FIREWORK_TWINKLE, 1, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -137,44 +317,26 @@ public class LevelingManager extends MiniDbClientPlugin<List<Integer>>
|
|||||||
|
|
||||||
public int getLevel(Player player)
|
public int getLevel(Player player)
|
||||||
{
|
{
|
||||||
return _achievement.getMineplexLevelNumber(player, false);
|
return _achievementManager.getMineplexLevelNumber(player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFirstUnclaimedLevel(Player player)
|
public int getFirstUnclaimedLevel(Player player)
|
||||||
{
|
{
|
||||||
List<Integer> claimed = Get(player);
|
List<Integer> claimed = Get(player);
|
||||||
|
|
||||||
for (Entry<Integer, LevelReward> entry : _rewards)
|
return _rewards.keySet().stream()
|
||||||
{
|
.filter(level -> !claimed.contains(level))
|
||||||
int level = entry.getKey();
|
.sorted()
|
||||||
|
.findFirst()
|
||||||
if (!claimed.contains(level))
|
.orElse(-1);
|
||||||
{
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LevelReward> getLevelRewards(int level)
|
public List<LevelReward> getLevelRewards(int level)
|
||||||
{
|
{
|
||||||
List<LevelReward> rewards = new ArrayList<>();
|
return _rewards.get(level);
|
||||||
|
|
||||||
for (Entry<Integer, LevelReward> entry : _rewards)
|
|
||||||
{
|
|
||||||
int rewardLevel = entry.getKey();
|
|
||||||
|
|
||||||
if (level == rewardLevel)
|
|
||||||
{
|
|
||||||
rewards.add(entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rewards;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Entry<Integer, LevelReward>> getLevelRewards()
|
public Map<Integer, List<LevelReward>> getLevelRewards()
|
||||||
{
|
{
|
||||||
return _rewards;
|
return _rewards;
|
||||||
}
|
}
|
||||||
@ -183,7 +345,7 @@ public class LevelingManager extends MiniDbClientPlugin<List<Integer>>
|
|||||||
{
|
{
|
||||||
boolean claimed = hasClaimed(player, level);
|
boolean claimed = hasClaimed(player, level);
|
||||||
boolean canClaim = canClaim(player, level);
|
boolean canClaim = canClaim(player, level);
|
||||||
boolean exclusive = level > 100;
|
boolean exclusive = level >= EXCLUSIVE_REWARDS_LEVEL;
|
||||||
|
|
||||||
Material material;
|
Material material;
|
||||||
byte data = 0;
|
byte data = 0;
|
||||||
@ -220,9 +382,22 @@ public class LevelingManager extends MiniDbClientPlugin<List<Integer>>
|
|||||||
builder.setTitle(title);
|
builder.setTitle(title);
|
||||||
builder.addLore("");
|
builder.addLore("");
|
||||||
|
|
||||||
|
boolean hide = !canClaim && exclusive;
|
||||||
|
|
||||||
for (LevelReward reward : rewards)
|
for (LevelReward reward : rewards)
|
||||||
{
|
{
|
||||||
builder.addLore(" " + reward.getDescription());
|
String lore = C.cWhite + " - ";
|
||||||
|
|
||||||
|
if (hide)
|
||||||
|
{
|
||||||
|
lore += C.cRed + C.Scramble + "?????";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lore += reward.getDescription();
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.addLore(lore);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.addLore("", bottomLine);
|
builder.addLore("", bottomLine);
|
||||||
@ -233,7 +408,7 @@ public class LevelingManager extends MiniDbClientPlugin<List<Integer>>
|
|||||||
public void claim(Player player, int level)
|
public void claim(Player player, int level)
|
||||||
{
|
{
|
||||||
Get(player).add(level);
|
Get(player).add(level);
|
||||||
_repository.claimReward(ClientManager.Get(player), level);
|
_repository.claimReward(ClientManager.getAccountId(player), level);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasClaimed(Player player, int level)
|
public boolean hasClaimed(Player player, int level)
|
||||||
@ -245,4 +420,23 @@ public class LevelingManager extends MiniDbClientPlugin<List<Integer>>
|
|||||||
{
|
{
|
||||||
return getLevel(player) >= level;
|
return getLevel(player) >= level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getUnclaimedLevels(Player player)
|
||||||
|
{
|
||||||
|
return _rewards.keySet().stream()
|
||||||
|
.filter(level -> !hasClaimed(player, level) && canClaim(player, level))
|
||||||
|
.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Entry<Integer, List<LevelReward>>> getSortedRewards()
|
||||||
|
{
|
||||||
|
return _rewards.entrySet().stream()
|
||||||
|
.sorted(Comparator.comparingInt(Entry::getKey))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public LevelRewardShop getShop()
|
||||||
|
{
|
||||||
|
return _shop;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.achievement.leveling;
|
package mineplex.core.achievement.leveling;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClient;
|
|
||||||
import mineplex.serverdata.database.DBPool;
|
import mineplex.serverdata.database.DBPool;
|
||||||
import mineplex.serverdata.database.RepositoryBase;
|
import mineplex.serverdata.database.RepositoryBase;
|
||||||
import mineplex.serverdata.database.column.ColumnInt;
|
import mineplex.serverdata.database.column.ColumnInt;
|
||||||
@ -15,10 +14,8 @@ public class LevelingRepository extends RepositoryBase
|
|||||||
super(DBPool.getAccount());
|
super(DBPool.getAccount());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void claimReward(CoreClient client, int level)
|
public void claimReward(int accountId, int level)
|
||||||
{
|
{
|
||||||
int accountId = client.getAccountId();
|
|
||||||
|
|
||||||
executeInsert(CLAIM_REWARD, null,
|
executeInsert(CLAIM_REWARD, null,
|
||||||
new ColumnInt("accountId", accountId),
|
new ColumnInt("accountId", accountId),
|
||||||
new ColumnInt("level", level)
|
new ColumnInt("level", level)
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package mineplex.core.achievement.leveling.rewards;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class LevelCallbackReward extends LevelDummyReward
|
||||||
|
{
|
||||||
|
|
||||||
|
private final Consumer<Player> _callback;
|
||||||
|
|
||||||
|
public LevelCallbackReward(String description, Consumer<Player> callback)
|
||||||
|
{
|
||||||
|
super(description);
|
||||||
|
|
||||||
|
_callback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void claim(Player player)
|
||||||
|
{
|
||||||
|
_callback.accept(player);
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,6 @@ package mineplex.core.achievement.leveling.rewards;
|
|||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.treasure.types.TreasureType;
|
import mineplex.core.treasure.types.TreasureType;
|
||||||
|
|
||||||
public class LevelChestReward implements LevelReward
|
public class LevelChestReward implements LevelReward
|
||||||
@ -26,6 +25,6 @@ public class LevelChestReward implements LevelReward
|
|||||||
@Override
|
@Override
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return C.cWhite + "- " + _amount + " " + _chest.getName();
|
return _amount + " " + _chest.getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,6 @@ public class LevelCurrencyReward implements LevelReward
|
|||||||
@Override
|
@Override
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return C.cWhite + "- " + F.currency(_type, _amount);
|
return F.currency(_type, _amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package mineplex.core.achievement.leveling.rewards;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class LevelDummyReward implements LevelReward
|
||||||
|
{
|
||||||
|
|
||||||
|
private final String _description;
|
||||||
|
|
||||||
|
public LevelDummyReward(String description)
|
||||||
|
{
|
||||||
|
_description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void claim(Player player)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription()
|
||||||
|
{
|
||||||
|
return _description;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package mineplex.core.achievement.leveling.rewards;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.currency.GlobalCurrency;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
|
||||||
|
public class LevelGadgetReward implements LevelReward
|
||||||
|
{
|
||||||
|
|
||||||
|
private final Gadget _gadget;
|
||||||
|
|
||||||
|
public LevelGadgetReward(Gadget gadget)
|
||||||
|
{
|
||||||
|
_gadget = gadget;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void claim(Player player)
|
||||||
|
{
|
||||||
|
DONATION.purchaseUnknownSalesPackage(player, _gadget.getName(), GlobalCurrency.TREASURE_SHARD, 0, true, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription()
|
||||||
|
{
|
||||||
|
return C.cGreen + _gadget.getName() + C.cWhite + " (" + C.cGreen + _gadget.getGadgetType().getCategoryType() + C.cWhite + ")";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package mineplex.core.achievement.leveling.rewards;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.boosters.BoosterManager;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
|
||||||
|
public class LevelGameAmplifierReward implements LevelReward
|
||||||
|
{
|
||||||
|
|
||||||
|
private final int _amount;
|
||||||
|
|
||||||
|
public LevelGameAmplifierReward(int amount)
|
||||||
|
{
|
||||||
|
_amount = amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void claim(Player player)
|
||||||
|
{
|
||||||
|
INVENTORY.addItemToInventory(player, BoosterManager.BOOSTER_ITEM, _amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription()
|
||||||
|
{
|
||||||
|
return C.cGreen + _amount + " Game Amplifer" + (_amount != 1 ? "s" : "");
|
||||||
|
}
|
||||||
|
}
|
@ -5,12 +5,10 @@ import java.util.Map.Entry;
|
|||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
import mineplex.core.account.repository.token.Rank;
|
|
||||||
import mineplex.core.achievement.leveling.LevelingManager;
|
import mineplex.core.achievement.leveling.LevelingManager;
|
||||||
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
import mineplex.core.achievement.leveling.rewards.LevelReward;
|
||||||
import mineplex.core.achievement.leveling.ui.LevelRewardShop;
|
import mineplex.core.achievement.leveling.ui.LevelRewardShop;
|
||||||
@ -19,7 +17,6 @@ import mineplex.core.common.util.C;
|
|||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.shop.item.IButton;
|
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
|
|
||||||
public class LevelRewardMainPage extends ShopPageBase<LevelingManager, LevelRewardShop>
|
public class LevelRewardMainPage extends ShopPageBase<LevelingManager, LevelRewardShop>
|
||||||
@ -54,6 +51,26 @@ public class LevelRewardMainPage extends ShopPageBase<LevelingManager, LevelRewa
|
|||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
int current = _plugin.getFirstUnclaimedLevel(_player);
|
int current = _plugin.getFirstUnclaimedLevel(_player);
|
||||||
|
|
||||||
|
// Claimed all the rewards
|
||||||
|
if (current == -1)
|
||||||
|
{
|
||||||
|
addButtonNoAction(13, MAX_LEVEL);
|
||||||
|
|
||||||
|
for (int i = 0; i < getSize(); i++)
|
||||||
|
{
|
||||||
|
if (i == 13 || i == VIEW_ALL_INDEX)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
addButtonNoAction(i, new ItemBuilder(Material.STAINED_GLASS_PANE, (byte) UtilMath.r(15))
|
||||||
|
.setTitle(C.cBlack)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int previousA = getPreviousLevel(current);
|
int previousA = getPreviousLevel(current);
|
||||||
int previousB = getPreviousLevel(previousA);
|
int previousB = getPreviousLevel(previousA);
|
||||||
int nextA = getNextLevel(current);
|
int nextA = getNextLevel(current);
|
||||||
@ -74,30 +91,12 @@ public class LevelRewardMainPage extends ShopPageBase<LevelingManager, LevelRewa
|
|||||||
addButton(14, nextA, nextARewards);
|
addButton(14, nextA, nextARewards);
|
||||||
addButton(15, nextB, nextBRewards);
|
addButton(15, nextB, nextBRewards);
|
||||||
|
|
||||||
addButton(VIEW_ALL_INDEX, VIEW_ALL, new ViewAllRewardsButton());
|
addButton(VIEW_ALL_INDEX, VIEW_ALL, (player, clickType) -> _shop.openPageForPlayer(player, new LevelRewardViewAllPage(getPlugin(), getShop(), this, getClientManager(), getDonationManager(), player)));
|
||||||
|
|
||||||
// Claimed all the rewards
|
|
||||||
if (current == -1)
|
|
||||||
{
|
|
||||||
addButtonNoAction(13, MAX_LEVEL);
|
|
||||||
|
|
||||||
for (int i = 0; i < getSize(); i++)
|
|
||||||
{
|
|
||||||
if (i == 13 || i == VIEW_ALL_INDEX)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
addButtonNoAction(i, new ItemBuilder(Material.STAINED_GLASS_PANE, (byte) UtilMath.r(15))
|
|
||||||
.setTitle(C.cBlack)
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addButton(int slot, int level, List<LevelReward> rewards)
|
private void addButton(int slot, int level, List<LevelReward> rewards)
|
||||||
{
|
{
|
||||||
if (level < 0 || rewards.isEmpty())
|
if (level < 0 || rewards == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -109,7 +108,7 @@ public class LevelRewardMainPage extends ShopPageBase<LevelingManager, LevelRewa
|
|||||||
{
|
{
|
||||||
int previous = 0;
|
int previous = 0;
|
||||||
|
|
||||||
for (Entry<Integer, LevelReward> entry : _plugin.getLevelRewards())
|
for (Entry<Integer, List<LevelReward>> entry : _plugin.getLevelRewards().entrySet())
|
||||||
{
|
{
|
||||||
int currentLevel = entry.getKey();
|
int currentLevel = entry.getKey();
|
||||||
|
|
||||||
@ -126,17 +125,17 @@ public class LevelRewardMainPage extends ShopPageBase<LevelingManager, LevelRewa
|
|||||||
|
|
||||||
private int getNextLevel(int level)
|
private int getNextLevel(int level)
|
||||||
{
|
{
|
||||||
boolean foundSearch = false;
|
boolean found = false;
|
||||||
|
|
||||||
for (Entry<Integer, LevelReward> entry : _plugin.getLevelRewards())
|
for (Entry<Integer, List<LevelReward>> entry : _plugin.getLevelRewards().entrySet())
|
||||||
{
|
{
|
||||||
int currentLevel = entry.getKey();
|
int currentLevel = entry.getKey();
|
||||||
|
|
||||||
if (currentLevel == level)
|
if (currentLevel == level)
|
||||||
{
|
{
|
||||||
foundSearch = true;
|
found = true;
|
||||||
}
|
}
|
||||||
else if (foundSearch)
|
else if (found)
|
||||||
{
|
{
|
||||||
return currentLevel;
|
return currentLevel;
|
||||||
}
|
}
|
||||||
@ -144,14 +143,4 @@ public class LevelRewardMainPage extends ShopPageBase<LevelingManager, LevelRewa
|
|||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ViewAllRewardsButton implements IButton
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
_shop.openPageForPlayer(player, new LevelRewardViewAllPage(getPlugin(), getShop(), LevelRewardMainPage.this, getClientManager(), getDonationManager(), player, 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package mineplex.core.achievement.leveling.ui.page;
|
package mineplex.core.achievement.leveling.ui.page;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
@ -15,30 +15,25 @@ import mineplex.core.achievement.leveling.ui.button.LevelRewardButton;
|
|||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.shop.item.IButton;
|
import mineplex.core.shop.page.MultiPageManager;
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
import mineplex.core.shop.page.ShopPageBase;
|
||||||
|
|
||||||
public class LevelRewardViewAllPage extends ShopPageBase<LevelingManager, LevelRewardShop>
|
public class LevelRewardViewAllPage extends ShopPageBase<LevelingManager, LevelRewardShop>
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final int DISPLAY_SIZE = 45;
|
|
||||||
private static final ItemStack UNKNOWN_REWARD = new ItemBuilder(Material.OBSIDIAN)
|
|
||||||
.setTitle(C.cRed + "???")
|
|
||||||
.addLore("", C.cRed + "You aren't a high enough level to claim this reward.")
|
|
||||||
.build();
|
|
||||||
private static final ItemStack GO_BACK = new ItemBuilder(Material.BED)
|
private static final ItemStack GO_BACK = new ItemBuilder(Material.BED)
|
||||||
.setTitle(C.cGreen + "Click to go back.")
|
.setTitle(C.cGreen + "Go back")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
private final ShopPageBase<LevelingManager, LevelRewardShop> _menu;
|
private final ShopPageBase<LevelingManager, LevelRewardShop> _menu;
|
||||||
private int _startingLevel;
|
private final MultiPageManager<Entry<Integer, List<LevelReward>>> _pageManager;
|
||||||
|
|
||||||
LevelRewardViewAllPage(LevelingManager plugin, LevelRewardShop shop, ShopPageBase<LevelingManager, LevelRewardShop> menu, CoreClientManager clientManager, DonationManager donationManager, Player player, int startingLevel)
|
LevelRewardViewAllPage(LevelingManager plugin, LevelRewardShop shop, ShopPageBase<LevelingManager, LevelRewardShop> menu, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||||
{
|
{
|
||||||
super(plugin, shop, clientManager, donationManager, "All Level Rewards", player);
|
super(plugin, shop, clientManager, donationManager, "All Level Rewards", player);
|
||||||
|
|
||||||
_menu = menu;
|
_menu = menu;
|
||||||
_startingLevel = startingLevel;
|
_pageManager = new MultiPageManager<>(this, plugin::getSortedRewards, this::buildItem);
|
||||||
|
|
||||||
buildPage();
|
buildPage();
|
||||||
}
|
}
|
||||||
@ -46,90 +41,22 @@ public class LevelRewardViewAllPage extends ShopPageBase<LevelingManager, LevelR
|
|||||||
@Override
|
@Override
|
||||||
protected void buildPage()
|
protected void buildPage()
|
||||||
{
|
{
|
||||||
int level = _startingLevel;
|
_pageManager.buildPage();
|
||||||
int playerLevel = _plugin.getLevel(_player);
|
|
||||||
boolean lastPage = false;
|
|
||||||
|
|
||||||
// No i++ ?! look down
|
addButton(4, GO_BACK, (player, clickType) ->
|
||||||
for (int i = 0; i < DISPLAY_SIZE; )
|
|
||||||
{
|
|
||||||
if (level >= LevelingManager.getMaxLevel())
|
|
||||||
{
|
|
||||||
lastPage = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<LevelReward> rewards = _plugin.getLevelRewards(level);
|
|
||||||
|
|
||||||
// No reward for that level
|
|
||||||
if (rewards.isEmpty())
|
|
||||||
{
|
|
||||||
level++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemStack itemStack;
|
|
||||||
|
|
||||||
if (level > 100 && playerLevel < level)
|
|
||||||
{
|
|
||||||
itemStack = UNKNOWN_REWARD;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
itemStack = _plugin.getLevelItem(_player, rewards, level);
|
|
||||||
}
|
|
||||||
|
|
||||||
addButton(i++, itemStack, new LevelRewardButton(this, rewards, level));
|
|
||||||
level++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not the first page
|
|
||||||
if (_startingLevel > 1)
|
|
||||||
{
|
|
||||||
addButton(46, getChangePageItem(true), new LevelRewardChangePageButton(_startingLevel - DISPLAY_SIZE));
|
|
||||||
}
|
|
||||||
// Not the last page
|
|
||||||
else if (!lastPage)
|
|
||||||
{
|
|
||||||
addButton(53, getChangePageItem(false), new LevelRewardChangePageButton(_startingLevel + DISPLAY_SIZE));
|
|
||||||
}
|
|
||||||
|
|
||||||
addButton(49, GO_BACK, new GoBackButton());
|
|
||||||
}
|
|
||||||
|
|
||||||
private ItemStack getChangePageItem(boolean previous)
|
|
||||||
{
|
|
||||||
return new ItemBuilder(Material.ARROW)
|
|
||||||
.setTitle(previous ? "Previous Page" : "Next Page")
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
private class LevelRewardChangePageButton implements IButton
|
|
||||||
{
|
|
||||||
|
|
||||||
private int _newStartingIndex;
|
|
||||||
|
|
||||||
LevelRewardChangePageButton(int newStartingIndex)
|
|
||||||
{
|
|
||||||
_newStartingIndex = newStartingIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
// Update the starting index and rebuild the page
|
|
||||||
_startingLevel = _newStartingIndex;
|
|
||||||
refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class GoBackButton implements IButton
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
{
|
||||||
|
_menu.refresh();
|
||||||
_shop.openPageForPlayer(player, _menu);
|
_shop.openPageForPlayer(player, _menu);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buildItem(Entry<Integer, List<LevelReward>> entry, int slot)
|
||||||
|
{
|
||||||
|
int level = entry.getKey();
|
||||||
|
List<LevelReward> rewards = entry.getValue();
|
||||||
|
ItemStack itemStack = _plugin.getLevelItem(_player, rewards, level);
|
||||||
|
|
||||||
|
addButton(slot, itemStack, new LevelRewardButton(this, rewards, level));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,7 @@ import mineplex.core.account.ILoginProcessor;
|
|||||||
import mineplex.core.account.event.ClientUnloadEvent;
|
import mineplex.core.account.event.ClientUnloadEvent;
|
||||||
import mineplex.core.account.permissions.Permission;
|
import mineplex.core.account.permissions.Permission;
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
|
import mineplex.core.achievement.leveling.LevelingManager;
|
||||||
import mineplex.core.bonuses.animations.AnimationCarl;
|
import mineplex.core.bonuses.animations.AnimationCarl;
|
||||||
import mineplex.core.bonuses.commands.AnimationCommand;
|
import mineplex.core.bonuses.commands.AnimationCommand;
|
||||||
import mineplex.core.bonuses.commands.GuiCommand;
|
import mineplex.core.bonuses.commands.GuiCommand;
|
||||||
@ -152,6 +153,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
private YoutubeManager _youtubeManager;
|
private YoutubeManager _youtubeManager;
|
||||||
private PowerPlayClubRepository _powerPlayClubRepository;
|
private PowerPlayClubRepository _powerPlayClubRepository;
|
||||||
private ThankManager _thankManager;
|
private ThankManager _thankManager;
|
||||||
|
private LevelingManager _levelingManager;
|
||||||
public boolean _enabled;
|
public boolean _enabled;
|
||||||
private Npc _carlNpc;
|
private Npc _carlNpc;
|
||||||
private Location _carlLocation;
|
private Location _carlLocation;
|
||||||
@ -210,6 +212,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
_hologramManager = hologramManager;
|
_hologramManager = hologramManager;
|
||||||
_inventoryManager = inventoryManager;
|
_inventoryManager = inventoryManager;
|
||||||
_thankManager = thankManager;
|
_thankManager = thankManager;
|
||||||
|
_levelingManager = require(LevelingManager.class);
|
||||||
_creeperName = creeperName;
|
_creeperName = creeperName;
|
||||||
|
|
||||||
if (gadgetManager == null)
|
if (gadgetManager == null)
|
||||||
@ -1012,6 +1015,7 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).getPrimaryGroup()) != null) availableRewards++;
|
if (getPollManager().getNextPoll(_pollManager.Get(player), _clientManager.Get(player).getPrimaryGroup()) != null) availableRewards++;
|
||||||
if (_thankManager.Get(player).getThankToClaim() > 0) availableRewards++;
|
if (_thankManager.Get(player).getThankToClaim() > 0) availableRewards++;
|
||||||
if (PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) availableRewards++;
|
if (PowerPlayClubButton.isAvailable(player, _powerPlayClubRepository)) availableRewards++;
|
||||||
|
availableRewards += _levelingManager.getUnclaimedLevels(player);
|
||||||
|
|
||||||
Hologram hologram;
|
Hologram hologram;
|
||||||
|
|
||||||
@ -1228,6 +1232,11 @@ public class BonusManager extends MiniClientPlugin<BonusClientData> implements I
|
|||||||
return _inventoryManager;
|
return _inventoryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LevelingManager getLevelingManager()
|
||||||
|
{
|
||||||
|
return _levelingManager;
|
||||||
|
}
|
||||||
|
|
||||||
public Location getCarlLocation()
|
public Location getCarlLocation()
|
||||||
{
|
{
|
||||||
return _carlLocation;
|
return _carlLocation;
|
||||||
|
@ -8,6 +8,7 @@ import mineplex.core.bonuses.gui.buttons.CarlSpinButton;
|
|||||||
import mineplex.core.bonuses.gui.buttons.ClaimTipsButton;
|
import mineplex.core.bonuses.gui.buttons.ClaimTipsButton;
|
||||||
import mineplex.core.bonuses.gui.buttons.DailyBonusButton;
|
import mineplex.core.bonuses.gui.buttons.DailyBonusButton;
|
||||||
import mineplex.core.bonuses.gui.buttons.FacebookButton;
|
import mineplex.core.bonuses.gui.buttons.FacebookButton;
|
||||||
|
import mineplex.core.bonuses.gui.buttons.LevelRewardsButton;
|
||||||
import mineplex.core.bonuses.gui.buttons.PlayWireButton;
|
import mineplex.core.bonuses.gui.buttons.PlayWireButton;
|
||||||
import mineplex.core.bonuses.gui.buttons.PollButton;
|
import mineplex.core.bonuses.gui.buttons.PollButton;
|
||||||
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
|
import mineplex.core.bonuses.gui.buttons.PowerPlayClubButton;
|
||||||
@ -22,16 +23,17 @@ import mineplex.core.youtube.YoutubeManager;
|
|||||||
|
|
||||||
public class BonusGui extends SimpleGui
|
public class BonusGui extends SimpleGui
|
||||||
{
|
{
|
||||||
private final int VOTE_SLOT = 32;
|
private static final int VOTE_SLOT = 32;
|
||||||
private final int RANK_BONUS_SLOT = 10;
|
private static final int RANK_BONUS_SLOT = 10;
|
||||||
private final int DAILY_BONUS_SLOT = 12;
|
private static final int DAILY_BONUS_SLOT = 12;
|
||||||
private final int POLL_SLOT = 28;
|
private static final int POLL_SLOT = 28;
|
||||||
private final int FACEBOOK_SLOT = 20;
|
private static final int FACEBOOK_SLOT = 20;
|
||||||
private final int CLAIM_TIPS_SLOT = 30;
|
private static final int CLAIM_TIPS_SLOT = 30;
|
||||||
private final int POWER_PLAY_SLOT = 16;
|
private static final int POWER_PLAY_SLOT = 16;
|
||||||
private final int CARL_SPINNER_SLOT = 14;
|
private static final int CARL_SPINNER_SLOT = 14;
|
||||||
private final int YOUTUBE_SLOT = 24;
|
private static final int YOUTUBE_SLOT = 24;
|
||||||
private final int TWITTER_SLOT = 34;
|
private static final int TWITTER_SLOT = 34;
|
||||||
|
private static final int LEVEL_REWARDS_SLOT = 22;
|
||||||
|
|
||||||
private static final int INV_SIZE = 45;
|
private static final int INV_SIZE = 45;
|
||||||
|
|
||||||
@ -58,6 +60,8 @@ public class BonusGui extends SimpleGui
|
|||||||
setItem(POWER_PLAY_SLOT, new PowerPlayClubButton(player, manager));
|
setItem(POWER_PLAY_SLOT, new PowerPlayClubButton(player, manager));
|
||||||
|
|
||||||
setItem(CARL_SPINNER_SLOT, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
|
setItem(CARL_SPINNER_SLOT, new CarlSpinButton(getPlugin(), player, manager, rewardManager));
|
||||||
|
|
||||||
|
setItem(LEVEL_REWARDS_SLOT, new LevelRewardsButton(manager.getLevelingManager(), player));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -0,0 +1,56 @@
|
|||||||
|
package mineplex.core.bonuses.gui.buttons;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.inventory.ClickType;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.achievement.leveling.LevelingManager;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.gui.GuiItem;
|
||||||
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
|
||||||
|
public class LevelRewardsButton implements GuiItem
|
||||||
|
{
|
||||||
|
|
||||||
|
private final LevelingManager _manager;
|
||||||
|
private final Player _player;
|
||||||
|
private final ItemStack _itemStack;
|
||||||
|
|
||||||
|
public LevelRewardsButton(LevelingManager manager, Player player)
|
||||||
|
{
|
||||||
|
_manager = manager;
|
||||||
|
_player = player;
|
||||||
|
long levelsToClaim = manager.getUnclaimedLevels(player);
|
||||||
|
boolean anyToClaim = levelsToClaim > 0;
|
||||||
|
_itemStack = new ItemBuilder(anyToClaim ? Material.EMERALD_BLOCK : Material.REDSTONE_BLOCK)
|
||||||
|
.setTitle((anyToClaim ? C.cGreenB : C.cRedB) + "Level Rewards")
|
||||||
|
.addLore("", "Earn rewards every time you", "level up your Mineplex Level!", "Unclaimed Rewards: " + C.cYellow + levelsToClaim, "", C.cGreen + "Click here to view rewards")
|
||||||
|
.setGlow(anyToClaim)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void click(ClickType clickType)
|
||||||
|
{
|
||||||
|
_manager.getShop().attemptShopOpen(_player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getObject()
|
||||||
|
{
|
||||||
|
return _itemStack;
|
||||||
|
}
|
||||||
|
}
|
@ -33,9 +33,9 @@ import mineplex.core.gadget.types.Gadget;
|
|||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
import mineplex.core.inventory.InventoryManager;
|
import mineplex.core.inventory.InventoryManager;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.treasure.TreasureManager;
|
|
||||||
import mineplex.core.pet.PetManager;
|
import mineplex.core.pet.PetManager;
|
||||||
import mineplex.core.punish.Punish;
|
import mineplex.core.punish.Punish;
|
||||||
|
import mineplex.core.treasure.TreasureManager;
|
||||||
import mineplex.core.twofactor.TwoFactorAuth;
|
import mineplex.core.twofactor.TwoFactorAuth;
|
||||||
|
|
||||||
public class CosmeticManager extends MiniPlugin
|
public class CosmeticManager extends MiniPlugin
|
||||||
|
@ -6,11 +6,9 @@ import org.bukkit.plugin.messaging.PluginMessageListener;
|
|||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.cosmetic.ui.page.ItemGadgetPage;
|
import mineplex.core.cosmetic.ui.page.ItemGadgetPage;
|
||||||
import mineplex.core.cosmetic.ui.page.Menu;
|
import mineplex.core.cosmetic.ui.page.Menu;
|
||||||
import mineplex.core.cosmetic.ui.page.PetTagPage;
|
import mineplex.core.cosmetic.ui.page.PetTagPage;
|
||||||
import mineplex.core.cosmetic.ui.page.custompet.name.CustomPetTagPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
|
import mineplex.core.gadget.event.ItemGadgetOutOfAmmoEvent;
|
||||||
import mineplex.core.shop.ShopBase;
|
import mineplex.core.shop.ShopBase;
|
||||||
@ -46,16 +44,6 @@ public class CosmeticShop extends ShopBase<CosmeticManager> implements PluginMes
|
|||||||
((PetTagPage) getPlayerPageMap().get(player.getUniqueId())).SetTagName(tagName);
|
((PetTagPage) getPlayerPageMap().get(player.getUniqueId())).SetTagName(tagName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getPlayerPageMap().containsKey(player.getUniqueId()) && getPlayerPageMap().get(player.getUniqueId()) instanceof CustomPetTagPage)
|
|
||||||
{
|
|
||||||
if (message != null && message.length >= 1)
|
|
||||||
{
|
|
||||||
String tagName = new String(message);
|
|
||||||
|
|
||||||
((CustomPetTagPage) getPlayerPageMap().get(player.getUniqueId())).setTagName(tagName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package mineplex.core.cosmetic.ui.button.open;
|
package mineplex.core.cosmetic.ui.button.open;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import mineplex.core.cosmetic.ui.page.Menu;
|
import mineplex.core.cosmetic.ui.page.Menu;
|
||||||
import mineplex.core.cosmetic.ui.page.gamemodifiers.GameCosmeticsPage;
|
import mineplex.core.cosmetic.ui.page.gamemodifiers.GameCosmeticsPage;
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
|
|
||||||
public class OpenGameModifiers extends OpenPageButton
|
public class OpenGameModifiers extends OpenPageButton
|
||||||
{
|
{
|
||||||
@ -14,15 +14,6 @@ public class OpenGameModifiers extends OpenPageButton
|
|||||||
super(menu, active);
|
super(menu, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
if (clickType.isLeftClick())
|
|
||||||
{
|
|
||||||
leftClick(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void leftClick(Player player)
|
protected void leftClick(Player player)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package mineplex.core.cosmetic.ui.button.open;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.cosmetic.ui.page.Menu;
|
||||||
|
import mineplex.core.cosmetic.ui.page.WeaponNamePage;
|
||||||
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
|
||||||
|
public class OpenWeaponNames extends OpenPageButton
|
||||||
|
{
|
||||||
|
|
||||||
|
public OpenWeaponNames(Menu menu, Gadget active)
|
||||||
|
{
|
||||||
|
super(menu, active);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void leftClick(Player player)
|
||||||
|
{
|
||||||
|
getMenu().getShop().openPageForPlayer(player, new WeaponNamePage(getMenu().getPlugin(), getMenu().getShop(), getMenu().getClientManager(), getMenu().getDonationManager(), player));
|
||||||
|
}
|
||||||
|
}
|
@ -6,9 +6,12 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
import mineplex.core.account.CoreClientManager;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
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.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||||
|
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
import mineplex.core.gadget.types.OutfitGadget;
|
import mineplex.core.gadget.types.OutfitGadget;
|
||||||
@ -78,6 +81,7 @@ public class CostumePage extends GadgetPage
|
|||||||
{
|
{
|
||||||
gadgetDisabled = true;
|
gadgetDisabled = true;
|
||||||
gadget.disable(player);
|
gadget.disable(player);
|
||||||
|
UtilServer.CallEvent(new GadgetChangeEvent(player, gadget, GadgetState.DISABLED));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ import mineplex.core.cosmetic.ui.CosmeticShop;
|
|||||||
import mineplex.core.cosmetic.ui.button.GadgetButton;
|
import mineplex.core.cosmetic.ui.button.GadgetButton;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||||
|
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
import mineplex.core.gadget.types.GadgetSet;
|
import mineplex.core.gadget.types.GadgetSet;
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
@ -243,6 +244,12 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
itemLore.add(C.cBlue + "Found in Trick or Treat Treasure");
|
itemLore.add(C.cBlue + "Found in Trick or Treat Treasure");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CostConstants.FOUND_IN_MINESTRIKE_CHESTS:
|
||||||
|
itemLore.add(C.cBlack);
|
||||||
|
itemLore.add(C.cBlue + "Found in MineStrike Chests");
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
// Ranks
|
// Ranks
|
||||||
case CostConstants.UNLOCKED_WITH_ULTRA:
|
case CostConstants.UNLOCKED_WITH_ULTRA:
|
||||||
itemLore.add(C.cBlack);
|
itemLore.add(C.cBlack);
|
||||||
@ -293,6 +300,11 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
itemLore.add(C.cBlue + "Purchased from mineplex.com/shop");
|
itemLore.add(C.cBlue + "Purchased from mineplex.com/shop");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CostConstants.LEVEL_REWARDS:
|
||||||
|
itemLore.add(C.cBlack);
|
||||||
|
itemLore.add(C.cBlue + "Unlocked in Level Rewards");
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -326,14 +338,26 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
itemLore.add(C.cGreen + "Left-Click to Enable");
|
itemLore.add(C.cGreen + "Left-Click to Enable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (set != null)
|
||||||
|
{
|
||||||
|
if (set.isActive(getPlayer()))
|
||||||
|
{
|
||||||
|
itemLore.add(C.cGreen + "Shift-Click to Disable Set");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
itemLore.add(C.cGreen + "Shift-Click to Enable Set");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
meta.setLore(itemLore);
|
meta.setLore(itemLore);
|
||||||
gadgetItemStack.setItemMeta(meta);
|
gadgetItemStack.setItemMeta(meta);
|
||||||
|
|
||||||
addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), (player, clickType) ->
|
addButton(slot, new ShopItem(gadgetItemStack, false, false).hideInfo(), (player, clickType) ->
|
||||||
{
|
{
|
||||||
if (clickType.isRightClick())
|
if (clickType.isShiftClick())
|
||||||
{
|
{
|
||||||
handleRightClick(player, gadget);
|
toggleSet(player, gadget);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -397,8 +421,10 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleGadget(Player player, Gadget gadget)
|
private void toggleGadget(Player player, Gadget gadget)
|
||||||
{
|
{
|
||||||
|
playAcceptSound(player);
|
||||||
|
|
||||||
if (gadget.isActive(player))
|
if (gadget.isActive(player))
|
||||||
{
|
{
|
||||||
deactivateGadget(player, gadget);
|
deactivateGadget(player, gadget);
|
||||||
@ -409,26 +435,47 @@ public class GadgetPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void activateGadget(Player player, Gadget gadget)
|
private void toggleSet(Player player, Gadget gadget)
|
||||||
{
|
{
|
||||||
playAcceptSound(player);
|
GadgetSet set = gadget.getSet();
|
||||||
gadget.enable(player);
|
|
||||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget, GadgetChangeEvent.GadgetState.ENABLED);
|
|
||||||
UtilServer.CallEvent(gadgetChangeEvent);
|
|
||||||
|
|
||||||
|
if (set == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (set.isActive(player))
|
||||||
|
{
|
||||||
|
for (Gadget setGadget : set.getGadgets())
|
||||||
|
{
|
||||||
|
deactivateGadget(player, setGadget);
|
||||||
|
}
|
||||||
|
|
||||||
|
playAcceptSound(player);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (Gadget setGadget : set.getGadgets())
|
||||||
|
{
|
||||||
|
if (setGadget.ownsGadget(player))
|
||||||
|
{
|
||||||
|
activateGadget(player, setGadget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void activateGadget(Player player, Gadget gadget)
|
||||||
|
{
|
||||||
|
gadget.enable(player);
|
||||||
|
UtilServer.CallEvent(new GadgetChangeEvent(player, gadget, GadgetState.ENABLED));
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleRightClick(Player player, Gadget gadget)
|
private void deactivateGadget(Player player, Gadget gadget)
|
||||||
{
|
{
|
||||||
}
|
|
||||||
|
|
||||||
public void deactivateGadget(Player player, Gadget gadget)
|
|
||||||
{
|
|
||||||
playAcceptSound(player);
|
|
||||||
gadget.disable(player);
|
gadget.disable(player);
|
||||||
GadgetChangeEvent gadgetChangeEvent = new GadgetChangeEvent(player, gadget, GadgetChangeEvent.GadgetState.DISABLED);
|
UtilServer.CallEvent(new GadgetChangeEvent(player, gadget, GadgetState.DISABLED));
|
||||||
UtilServer.CallEvent(gadgetChangeEvent);
|
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
package mineplex.core.cosmetic.ui.page;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
|
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||||
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
|
||||||
|
public class ListGadgetPage extends GadgetPage
|
||||||
|
{
|
||||||
|
|
||||||
|
private final List<Gadget> _gadgetList;
|
||||||
|
|
||||||
|
ListGadgetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, List<Gadget> gadgetList)
|
||||||
|
{
|
||||||
|
super(plugin, shop, clientManager, donationManager, name, player);
|
||||||
|
|
||||||
|
_gadgetList = gadgetList;
|
||||||
|
buildPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Gadget> getGadgetsToDisplay()
|
||||||
|
{
|
||||||
|
return _gadgetList;
|
||||||
|
}
|
||||||
|
}
|
@ -23,6 +23,7 @@ import mineplex.core.cosmetic.ui.button.open.OpenCostumes;
|
|||||||
import mineplex.core.cosmetic.ui.button.open.OpenGameModifiers;
|
import mineplex.core.cosmetic.ui.button.open.OpenGameModifiers;
|
||||||
import mineplex.core.cosmetic.ui.button.open.OpenItems;
|
import mineplex.core.cosmetic.ui.button.open.OpenItems;
|
||||||
import mineplex.core.cosmetic.ui.button.open.OpenPets;
|
import mineplex.core.cosmetic.ui.button.open.OpenPets;
|
||||||
|
import mineplex.core.cosmetic.ui.button.open.OpenWeaponNames;
|
||||||
import mineplex.core.donation.DonationManager;
|
import mineplex.core.donation.DonationManager;
|
||||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||||
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
|
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
|
||||||
@ -72,7 +73,9 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
int flagSlot = 34;
|
int flagSlot = 34;
|
||||||
int morphSlot = 25;
|
int morphSlot = 25;
|
||||||
int costumeSlot = 16;
|
int costumeSlot = 16;
|
||||||
|
int weaponNameSlot = 4;
|
||||||
int powerPlaySlot = 22;
|
int powerPlaySlot = 22;
|
||||||
|
int chatColourSlot = 40;
|
||||||
|
|
||||||
EnumMap<GadgetType, Integer> ownedCount = new EnumMap<>(GadgetType.class);
|
EnumMap<GadgetType, Integer> ownedCount = new EnumMap<>(GadgetType.class);
|
||||||
EnumMap<GadgetType, Integer> maxCount = new EnumMap<>(GadgetType.class);
|
EnumMap<GadgetType, Integer> maxCount = new EnumMap<>(GadgetType.class);
|
||||||
@ -200,6 +203,16 @@ public class Menu extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|||||||
addButton(flagSlot, new ShopItem(Material.BANNER, "Flags", lore, 1, false), generateButton(type, enabled.get(type)));
|
addButton(flagSlot, new ShopItem(Material.BANNER, "Flags", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||||
if (enabled.containsKey(type)) addGlow(flagSlot);
|
if (enabled.containsKey(type)) addGlow(flagSlot);
|
||||||
|
|
||||||
|
type = GadgetType.WEAPON_NAME;
|
||||||
|
lore = getLore(ownedCount.get(type), maxCount.get(type), "Something something", VISIBILITY_GAMES, null);
|
||||||
|
addButton(weaponNameSlot, new ShopItem(Material.DIAMOND_SWORD, "Weapon Names", lore, 1, false), new OpenWeaponNames(this, null));
|
||||||
|
if (enabled.containsKey(type)) addGlow(weaponNameSlot);
|
||||||
|
|
||||||
|
type = GadgetType.LEVEL_PREFIX;
|
||||||
|
lore = getLore(ownedCount.get(type), maxCount.get(type), "Something something", VISIBILITY_HUB, enabled.get(type));
|
||||||
|
addButton(chatColourSlot, new ShopItem(Material.PAPER, "Level Colors", lore, 1, false), generateButton(type, enabled.get(type)));
|
||||||
|
if (enabled.containsKey(type)) addGlow(weaponNameSlot);
|
||||||
|
|
||||||
// Copy over banner design
|
// Copy over banner design
|
||||||
BannerMeta banner = (BannerMeta) CountryFlag.MINEPLEX.getBanner().getItemMeta();
|
BannerMeta banner = (BannerMeta) CountryFlag.MINEPLEX.getBanner().getItemMeta();
|
||||||
BannerMeta meta = ((BannerMeta) getItem(flagSlot).getItemMeta());
|
BannerMeta meta = ((BannerMeta) getItem(flagSlot).getItemMeta());
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package mineplex.core.cosmetic.ui.page;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.account.CoreClientManager;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilUI;
|
||||||
|
import mineplex.core.cosmetic.CosmeticManager;
|
||||||
|
import mineplex.core.cosmetic.ui.CosmeticShop;
|
||||||
|
import mineplex.core.donation.DonationManager;
|
||||||
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
|
import mineplex.core.gadget.types.WeaponNameGadget;
|
||||||
|
import mineplex.core.gadget.types.WeaponNameGadget.WeaponType;
|
||||||
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
|
||||||
|
public class WeaponNamePage extends GadgetPage
|
||||||
|
{
|
||||||
|
|
||||||
|
public WeaponNamePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, Player player)
|
||||||
|
{
|
||||||
|
super(plugin, shop, clientManager, donationManager, "Weapon Names", player);
|
||||||
|
|
||||||
|
buildPage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildPage()
|
||||||
|
{
|
||||||
|
WeaponType[] types = WeaponType.values();
|
||||||
|
int[] slots = UtilUI.getIndicesFor(types.length, 2);
|
||||||
|
int index = 0;
|
||||||
|
Map<WeaponType, List<Gadget>> gadgets = new HashMap<>(types.length);
|
||||||
|
|
||||||
|
for (Gadget gadget : _plugin.getGadgetManager().getGadgets(GadgetType.WEAPON_NAME))
|
||||||
|
{
|
||||||
|
gadgets.computeIfAbsent(((WeaponNameGadget) gadget).getWeaponNameType().getWeaponType(), k -> new ArrayList<>()).add(gadget);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (WeaponType type : types)
|
||||||
|
{
|
||||||
|
int own = 0, total = 0;
|
||||||
|
List<Gadget> gadgetList = gadgets.get(type);
|
||||||
|
|
||||||
|
for (Gadget gadget : gadgetList)
|
||||||
|
{
|
||||||
|
if (gadget.ownsGadget(getPlayer()))
|
||||||
|
{
|
||||||
|
own++;
|
||||||
|
}
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemBuilder builder = new ItemBuilder(type.getMaterial());
|
||||||
|
String name = ItemStackFactory.Instance.GetName(builder.getType(), (byte) 0, false);
|
||||||
|
|
||||||
|
builder.setTitle(C.cGreenB + name);
|
||||||
|
builder.addLore(
|
||||||
|
"",
|
||||||
|
C.cWhite + "You own " + own + "/" + total,
|
||||||
|
"",
|
||||||
|
C.cGreen + "Left-Click to view " + name + " cosmetics"
|
||||||
|
);
|
||||||
|
|
||||||
|
addButton(slots[index++], builder.build(), (player, clickType) -> getShop().openPageForPlayer(player, new ListGadgetPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), name, player, gadgetList)));
|
||||||
|
}
|
||||||
|
|
||||||
|
addBackButton();
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.shop.item.IButton;
|
|
||||||
|
|
||||||
public class ActivateCustomPetButton implements IButton
|
|
||||||
{
|
|
||||||
private GadgetPage _page;
|
|
||||||
|
|
||||||
public ActivateCustomPetButton(GadgetPage page)
|
|
||||||
{
|
|
||||||
_page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
/*_page.playAcceptSound(player);
|
|
||||||
_page.getPlugin().getPetManager().addPetOwner(player, PetType.CUSTOM, player.getLocation());
|
|
||||||
_page.getShop().openPageForPlayer(player, new Menu(_page.getPlugin(), _page.getShop(), _page.getClientManager(), _page.getDonationManager(), player));*/
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.cosmetic.ui.page.Menu;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
public class CustomPetBasePage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetBasePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
// EDIT PET
|
|
||||||
// DISABLE PET
|
|
||||||
// RENAME PET
|
|
||||||
// RESET PET
|
|
||||||
|
|
||||||
int slot = 10;
|
|
||||||
|
|
||||||
for (CustomPet.CustomPetType customPetType : CustomPet.CustomPetType.values())
|
|
||||||
{
|
|
||||||
|
|
||||||
addButton(slot, new ShopItem(customPetType.getMaterial(), customPetType.getData(), customPetType.getName(), new String[]{}, 1, false, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(player);
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
customPet = customPetType.getCustomPet(getPlugin().getPetManager(), player);
|
|
||||||
}
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
slot++;
|
|
||||||
|
|
||||||
if (slot == 17)
|
|
||||||
slot += 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), player));
|
|
||||||
CustomPet.removeCustomPet(player);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
public class CustomPetConfirmPage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetConfirmPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int[] confirm = {19, 20, 21, 28, 29, 30, 37, 38, 39};
|
|
||||||
int[] cancel = {23, 24, 25, 32, 33, 34, 41, 42, 43};
|
|
||||||
|
|
||||||
ShopItem confirmItem = new ShopItem(Material.WOOL, (byte) 5, "Confirm", new String[]{}, 1, false, false);
|
|
||||||
ShopItem cancelItem = new ShopItem(Material.WOOL, (byte) 14, "Cancel", new String[]{}, 1, false, false);
|
|
||||||
|
|
||||||
for (int aConfirm : confirm)
|
|
||||||
{
|
|
||||||
addButton(aConfirm, confirmItem, new ActivateCustomPetButton(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int aCancel : cancel)
|
|
||||||
{
|
|
||||||
addButton(aCancel, cancelItem, (player, clickType) ->
|
|
||||||
{
|
|
||||||
player.closeInventory();
|
|
||||||
CustomPet.removeCustomPet(player);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.age;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.pet.custom.CustomPetAgeable;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
public class CustomPetAgePage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetAgePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(customPet instanceof CustomPetAgeable))
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomPetAgeable customPetAgeable = (CustomPetAgeable) customPet;
|
|
||||||
|
|
||||||
addButton(29, new ShopItem(Material.SEEDS, "Baby", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetAgeable.setBaby(true);
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(33, new ShopItem(Material.WHEAT, "Adult", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetAgeable.setBaby(false);
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,89 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.equipment;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.pet.custom.CustomPetEquipment;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
public class CustomPetBootsPage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetBootsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(customPet instanceof CustomPetEquipment))
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet;
|
|
||||||
|
|
||||||
// Leather helmet
|
|
||||||
addButton(19, new ShopItem(Material.LEATHER_BOOTS, "Leather", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
// TODO COLORED ARMOR
|
|
||||||
customPetEquipment.setBoots(new ItemStack(Material.LEATHER_BOOTS));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(22, new ShopItem(Material.CHAINMAIL_BOOTS, "Chain", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(25, new ShopItem(Material.IRON_BOOTS, "Iron", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setBoots(new ItemStack(Material.IRON_HELMET));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(38, new ShopItem(Material.GOLD_BOOTS, "Gold", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setBoots(new ItemStack(Material.GOLD_BOOTS));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setBoots(new ItemStack(Material.AIR));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(42, new ShopItem(Material.DIAMOND_BOOTS, "Diamond", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setBoots(new ItemStack(Material.DIAMOND_BOOTS));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.equipment;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.pet.custom.CustomPetEquipment;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
public class CustomPetChestplatePage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetChestplatePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(customPet instanceof CustomPetEquipment))
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet;
|
|
||||||
|
|
||||||
// Leather helmet
|
|
||||||
addButton(19, new ShopItem(Material.LEATHER_CHESTPLATE, "Leather", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
// TODO COLORED ARMOR
|
|
||||||
customPetEquipment.setChestplate(new ItemStack(Material.LEATHER_CHESTPLATE));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(22, new ShopItem(Material.CHAINMAIL_CHESTPLATE, "Chain", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(25, new ShopItem(Material.IRON_CHESTPLATE, "Iron", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setChestplate(new ItemStack(Material.IRON_HELMET));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(38, new ShopItem(Material.GOLD_CHESTPLATE, "Gold", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setChestplate(new ItemStack(Material.GOLD_CHESTPLATE));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setChestplate(new ItemStack(Material.AIR));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(42, new ShopItem(Material.DIAMOND_CHESTPLATE, "Diamond", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.equipment;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.pet.custom.CustomPetEquipment;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
public class CustomPetHelmetPage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetHelmetPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(customPet instanceof CustomPetEquipment))
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet;
|
|
||||||
|
|
||||||
// Leather helmet
|
|
||||||
addButton(19, new ShopItem(Material.LEATHER_HELMET, "Leather", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
// TODO COLORED ARMOR
|
|
||||||
customPetEquipment.setHelmet(new ItemStack(Material.LEATHER_HELMET));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(22, new ShopItem(Material.CHAINMAIL_HELMET, "Chain", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(25, new ShopItem(Material.IRON_HELMET, "Iron", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setHelmet(new ItemStack(Material.IRON_HELMET));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(38, new ShopItem(Material.GOLD_HELMET, "Gold", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setHelmet(new ItemStack(Material.GOLD_HELMET));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setHelmet(new ItemStack(Material.AIR));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(42, new ShopItem(Material.DIAMOND_HELMET, "Diamond", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setHelmet(new ItemStack(Material.DIAMOND_HELMET));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,88 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.equipment;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.pet.custom.CustomPetEquipment;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
public class CustomPetLeggingsPage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetLeggingsPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(customPet instanceof CustomPetEquipment))
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomPetEquipment customPetEquipment = (CustomPetEquipment) customPet;
|
|
||||||
|
|
||||||
// Leather helmet
|
|
||||||
addButton(19, new ShopItem(Material.LEATHER_LEGGINGS, "Leather", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
// TODO COLORED ARMOR
|
|
||||||
customPetEquipment.setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(22, new ShopItem(Material.CHAINMAIL_LEGGINGS, "Chain", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(25, new ShopItem(Material.IRON_LEGGINGS, "Iron", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setLeggings(new ItemStack(Material.IRON_HELMET));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(38, new ShopItem(Material.GOLD_LEGGINGS, "Gold", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setLeggings(new ItemStack(Material.GOLD_LEGGINGS));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(40, new ShopItem(Material.BARRIER, "None", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setLeggings(new ItemStack(Material.AIR));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(42, new ShopItem(Material.DIAMOND_LEGGINGS, "Diamond", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetEquipment.setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.name;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.shop.item.IButton;
|
|
||||||
|
|
||||||
public class CloseCustomPetButton implements IButton
|
|
||||||
{
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
player.closeInventory();
|
|
||||||
CustomPet.removeCustomPet(player);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.name;
|
|
||||||
|
|
||||||
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.Player;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
import mineplex.core.shop.page.AnvilContainer;
|
|
||||||
|
|
||||||
public class CustomPetNamePage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetNamePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
addButton(31, new ShopItem(Material.NAME_TAG, "Name", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
CustomPetTagPage customPetTagPage = new CustomPetTagPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), "Pet Name", getPlayer());
|
|
||||||
EntityPlayer entityPlayer = ((CraftPlayer) getPlayer()).getHandle();
|
|
||||||
int containerCounter = entityPlayer.nextContainerCounter();
|
|
||||||
UtilPlayer.sendPacket(player, new PacketPlayOutOpenWindow(containerCounter, "minecraft:anvil", new ChatMessage(Blocks.ANVIL.a() + ".name", new Object[0])));
|
|
||||||
entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, customPetTagPage.getInventory());
|
|
||||||
entityPlayer.activeContainer.windowId = containerCounter;
|
|
||||||
entityPlayer.activeContainer.addSlotListener(entityPlayer);
|
|
||||||
UtilPlayer.sendPacket(player, new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_8_R3.ItemStack(Items.NAME_TAG)));
|
|
||||||
|
|
||||||
getShop().setCurrentPageForPlayer(getPlayer(), customPetTagPage);
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,101 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.name;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.UtilItem;
|
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
|
||||||
import mineplex.core.punish.PunishClient;
|
|
||||||
import net.minecraft.server.v1_8_R3.ItemStack;
|
|
||||||
import net.minecraft.server.v1_8_R3.Items;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.shop.page.ShopPageBase;
|
|
||||||
|
|
||||||
public class CustomPetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
|
||||||
{
|
|
||||||
private String _tagName = "Pet Name";
|
|
||||||
|
|
||||||
public CustomPetTagPage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player, 3);
|
|
||||||
|
|
||||||
buildPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
inventory.setItem(0, new ItemStack(Items.NAME_TAG));
|
|
||||||
|
|
||||||
getButtonMap().put(0, new CloseCustomPetButton());
|
|
||||||
getButtonMap().put(1, new CloseCustomPetButton());
|
|
||||||
getButtonMap().put(2, new SelectCustomPetTagButton(this));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void playerClosed()
|
|
||||||
{
|
|
||||||
super.playerClosed();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void selectTag()
|
|
||||||
{
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(_player);
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
_player.closeInventory();
|
|
||||||
CustomPet.removeCustomPet(_player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_tagName = ChatColor.stripColor(_tagName);
|
|
||||||
_tagName = _tagName.replaceAll("[^A-Za-z0-9]", "");
|
|
||||||
System.out.println("Pet name: " + _tagName + ".");
|
|
||||||
if (_tagName.length() == 0)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Supplied pet name contains invalid characters."));
|
|
||||||
playDenySound(getPlayer());
|
|
||||||
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_tagName.length() > 16)
|
|
||||||
{
|
|
||||||
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + "Pet name cannot be longer than 16 characters."));
|
|
||||||
playDenySound(getPlayer());
|
|
||||||
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_tagName.toLowerCase().contains("ultra"))
|
|
||||||
{
|
|
||||||
UtilPlayer.message(getPlayer(), F.main(getPlugin().getName(), ChatColor.RED + _tagName + " is a restricted name."));
|
|
||||||
playDenySound(getPlayer());
|
|
||||||
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
customPet.setName(_tagName);
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTagName(String tagName)
|
|
||||||
{
|
|
||||||
_tagName = tagName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.name;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
|
|
||||||
import mineplex.core.shop.item.IButton;
|
|
||||||
|
|
||||||
public class SelectCustomPetTagButton implements IButton
|
|
||||||
{
|
|
||||||
private CustomPetTagPage _page;
|
|
||||||
|
|
||||||
public SelectCustomPetTagButton(CustomPetTagPage page)
|
|
||||||
{
|
|
||||||
_page = page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onClick(Player player, ClickType clickType)
|
|
||||||
{
|
|
||||||
_page.selectTag();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
package mineplex.core.cosmetic.ui.page.custompet.zombie;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mineplex.core.account.CoreClientManager;
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.cosmetic.CosmeticManager;
|
|
||||||
import mineplex.core.cosmetic.ui.CosmeticShop;
|
|
||||||
import mineplex.core.cosmetic.ui.page.GadgetPage;
|
|
||||||
import mineplex.core.donation.DonationManager;
|
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.pet.custom.CustomPetZombie;
|
|
||||||
import mineplex.core.shop.item.ShopItem;
|
|
||||||
|
|
||||||
public class CustomPetZombieTypePage extends GadgetPage
|
|
||||||
{
|
|
||||||
|
|
||||||
public CustomPetZombieTypePage(CosmeticManager plugin, CosmeticShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player)
|
|
||||||
{
|
|
||||||
super(plugin, shop, clientManager, donationManager, name, player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void buildPage()
|
|
||||||
{
|
|
||||||
|
|
||||||
CustomPet customPet = CustomPet.getCustomPet(getPlayer());
|
|
||||||
if (customPet == null)
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(customPet instanceof CustomPetZombie))
|
|
||||||
{
|
|
||||||
CustomPet.removeCustomPet(getPlayer());
|
|
||||||
getPlayer().closeInventory();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomPetZombie customPetZombie = (CustomPetZombie) customPet;
|
|
||||||
|
|
||||||
addButton(29, new ShopItem(Material.BARRIER, "Zombie", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetZombie.setVillager(false);
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(33, new ShopItem(Material.WHEAT, "Zombie Villager", 1, false), (player, clickType) ->
|
|
||||||
{
|
|
||||||
customPetZombie.setVillager(true);
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getNextStep(getPlugin(), getShop(), getClientManager(), getDonationManager()));
|
|
||||||
});
|
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGray + " \u21FD Go Back", new String[]{}, 1, false), (player, clickType) ->
|
|
||||||
getShop().openPageForPlayer(getPlayer(), customPet.getPreviousStep(getPlugin(), getShop(), getClientManager(), getDonationManager())));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -70,8 +70,8 @@ public class GameCosmeticCategoryPage extends GadgetPage
|
|||||||
getShop().openPageForPlayer(player, page);
|
getShop().openPageForPlayer(player, page);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new GameCosmeticsPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addButton(4, new ShopItem(Material.BED, C.cGreen + "Go Back", new String[0], 1, false), (player, clickType) -> getShop().openPageForPlayer(getPlayer(), new GameCosmeticsPage(getPlugin(), getShop(), getClientManager(), getDonationManager(), player)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package mineplex.core.disguise.disguises;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
|
public class DisguiseSilverFish extends DisguiseMonster
|
||||||
|
{
|
||||||
|
|
||||||
|
public DisguiseSilverFish(Entity entity)
|
||||||
|
{
|
||||||
|
super(EntityType.SILVERFISH, entity);
|
||||||
|
}
|
||||||
|
}
|
@ -2,25 +2,31 @@ package mineplex.core.gadget;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
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.block.Block;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
|
import org.bukkit.inventory.AnvilInventory;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
@ -29,11 +35,12 @@ import mineplex.core.account.CoreClientManager;
|
|||||||
import mineplex.core.account.permissions.Permission;
|
import mineplex.core.account.permissions.Permission;
|
||||||
import mineplex.core.account.permissions.PermissionGroup;
|
import mineplex.core.account.permissions.PermissionGroup;
|
||||||
import mineplex.core.achievement.AchievementManager;
|
import mineplex.core.achievement.AchievementManager;
|
||||||
|
import mineplex.core.arcadeevents.CoreGameStartEvent;
|
||||||
|
import mineplex.core.arcadeevents.CoreGameStopEvent;
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
import mineplex.core.blockrestore.BlockRestore;
|
||||||
import mineplex.core.common.skin.SkinData;
|
import mineplex.core.common.skin.SkinData;
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
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.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
@ -44,14 +51,18 @@ import mineplex.core.disguise.DisguiseManager;
|
|||||||
import mineplex.core.donation.DonationManager;
|
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.TestTauntCommand;
|
||||||
import mineplex.core.gadget.commands.UnlockCosmeticCommand;
|
import mineplex.core.gadget.commands.UnlockCosmeticCommand;
|
||||||
import mineplex.core.gadget.commands.UnlockCosmeticsCommand;
|
import mineplex.core.gadget.commands.UnlockCosmeticsCommand;
|
||||||
|
import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||||
import mineplex.core.gadget.event.GadgetChangeEvent;
|
import mineplex.core.gadget.event.GadgetChangeEvent;
|
||||||
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
|
import mineplex.core.gadget.event.GadgetChangeEvent.GadgetState;
|
||||||
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
import mineplex.core.gadget.event.GadgetCollideEntityEvent;
|
||||||
import mineplex.core.gadget.event.GadgetEnableEvent;
|
import mineplex.core.gadget.event.GadgetEnableEvent;
|
||||||
|
import mineplex.core.gadget.event.GadgetSelectLocationEvent;
|
||||||
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
|
import mineplex.core.gadget.event.PlayerToggleSwimEvent;
|
||||||
import mineplex.core.gadget.event.TauntCommandEvent;
|
import mineplex.core.gadget.event.TauntCommandEvent;
|
||||||
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBalance;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailBlood;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailCandyCane;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailConfetti;
|
||||||
@ -61,6 +72,7 @@ import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailEnchant;
|
|||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFreedom;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFreedom;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailFrostLord;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailHalloween;
|
||||||
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailLegend;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailMusic;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailPresent;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailPresent;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailRainbow;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailRainbow;
|
||||||
@ -69,8 +81,9 @@ import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailShadow;
|
|||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailSpring;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailSpring;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailStorm;
|
||||||
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan;
|
import mineplex.core.gadget.gadgets.arrowtrail.ArrowTrailTitan;
|
||||||
import mineplex.core.gadget.gadgets.balloons.BalloonItem;
|
|
||||||
import mineplex.core.gadget.gadgets.balloons.BalloonType;
|
import mineplex.core.gadget.gadgets.balloons.BalloonType;
|
||||||
|
import mineplex.core.gadget.gadgets.chat.LevelPrefixType;
|
||||||
|
import mineplex.core.gadget.gadgets.death.DeathBalance;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathBlood;
|
import mineplex.core.gadget.gadgets.death.DeathBlood;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathCandyCane;
|
import mineplex.core.gadget.gadgets.death.DeathCandyCane;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart;
|
import mineplex.core.gadget.gadgets.death.DeathCupidsBrokenHeart;
|
||||||
@ -79,6 +92,7 @@ import mineplex.core.gadget.gadgets.death.DeathEnchant;
|
|||||||
import mineplex.core.gadget.gadgets.death.DeathFreedom;
|
import mineplex.core.gadget.gadgets.death.DeathFreedom;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathFrostLord;
|
import mineplex.core.gadget.gadgets.death.DeathFrostLord;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathHalloween;
|
import mineplex.core.gadget.gadgets.death.DeathHalloween;
|
||||||
|
import mineplex.core.gadget.gadgets.death.DeathLegend;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathMapleLeaf;
|
import mineplex.core.gadget.gadgets.death.DeathMapleLeaf;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathMusic;
|
import mineplex.core.gadget.gadgets.death.DeathMusic;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathPinataBurst;
|
import mineplex.core.gadget.gadgets.death.DeathPinataBurst;
|
||||||
@ -88,6 +102,7 @@ import mineplex.core.gadget.gadgets.death.DeathShadow;
|
|||||||
import mineplex.core.gadget.gadgets.death.DeathSpring;
|
import mineplex.core.gadget.gadgets.death.DeathSpring;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathStorm;
|
import mineplex.core.gadget.gadgets.death.DeathStorm;
|
||||||
import mineplex.core.gadget.gadgets.death.DeathTitan;
|
import mineplex.core.gadget.gadgets.death.DeathTitan;
|
||||||
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBalance;
|
||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpBlood;
|
||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCandyCane;
|
||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpCupidsWings;
|
||||||
@ -97,6 +112,7 @@ import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFirecracker;
|
|||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFreedom;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFreedom;
|
||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpFrostLord;
|
||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpHalloween;
|
||||||
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpLegend;
|
||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMaple;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMaple;
|
||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpMusic;
|
||||||
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpPresent;
|
import mineplex.core.gadget.gadgets.doublejump.DoubleJumpPresent;
|
||||||
@ -109,8 +125,6 @@ import mineplex.core.gadget.gadgets.flag.FlagType;
|
|||||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
|
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticCategory;
|
||||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticManager;
|
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticManager;
|
||||||
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticType;
|
import mineplex.core.gadget.gadgets.gamemodifiers.GameCosmeticType;
|
||||||
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GemHuntersMountGadget;
|
|
||||||
import mineplex.core.gadget.gadgets.gamemodifiers.gemhunters.GemHuntersMountType;
|
|
||||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.GameModifierMineStrikeSkin;
|
||||||
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
import mineplex.core.gadget.gadgets.gamemodifiers.minestrike.MineStrikeSkin;
|
||||||
import mineplex.core.gadget.gadgets.gamemodifiers.moba.shopmorph.ShopMorphGadget;
|
import mineplex.core.gadget.gadgets.gamemodifiers.moba.shopmorph.ShopMorphGadget;
|
||||||
@ -124,6 +138,7 @@ import mineplex.core.gadget.gadgets.item.ItemBow;
|
|||||||
import mineplex.core.gadget.gadgets.item.ItemCandy;
|
import mineplex.core.gadget.gadgets.item.ItemCandy;
|
||||||
import mineplex.core.gadget.gadgets.item.ItemCoal;
|
import mineplex.core.gadget.gadgets.item.ItemCoal;
|
||||||
import mineplex.core.gadget.gadgets.item.ItemCoinBomb;
|
import mineplex.core.gadget.gadgets.item.ItemCoinBomb;
|
||||||
|
import mineplex.core.gadget.gadgets.item.ItemConnect4;
|
||||||
import mineplex.core.gadget.gadgets.item.ItemDuelingSword;
|
import mineplex.core.gadget.gadgets.item.ItemDuelingSword;
|
||||||
import mineplex.core.gadget.gadgets.item.ItemEtherealPearl;
|
import mineplex.core.gadget.gadgets.item.ItemEtherealPearl;
|
||||||
import mineplex.core.gadget.gadgets.item.ItemFirework;
|
import mineplex.core.gadget.gadgets.item.ItemFirework;
|
||||||
@ -139,6 +154,7 @@ import mineplex.core.gadget.gadgets.item.ItemPaintbrush;
|
|||||||
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
|
import mineplex.core.gadget.gadgets.item.ItemPartyPopper;
|
||||||
import mineplex.core.gadget.gadgets.item.ItemSnowball;
|
import mineplex.core.gadget.gadgets.item.ItemSnowball;
|
||||||
import mineplex.core.gadget.gadgets.item.ItemTNT;
|
import mineplex.core.gadget.gadgets.item.ItemTNT;
|
||||||
|
import mineplex.core.gadget.gadgets.item.ItemTrampoline;
|
||||||
import mineplex.core.gadget.gadgets.kitselector.HalloweenKitSelector;
|
import mineplex.core.gadget.gadgets.kitselector.HalloweenKitSelector;
|
||||||
import mineplex.core.gadget.gadgets.kitselector.HaloKitSelector;
|
import mineplex.core.gadget.gadgets.kitselector.HaloKitSelector;
|
||||||
import mineplex.core.gadget.gadgets.kitselector.RainCloudKitSelector;
|
import mineplex.core.gadget.gadgets.kitselector.RainCloudKitSelector;
|
||||||
@ -166,9 +182,11 @@ import mineplex.core.gadget.gadgets.morph.MorphGrimReaper;
|
|||||||
import mineplex.core.gadget.gadgets.morph.MorphLoveDoctor;
|
import mineplex.core.gadget.gadgets.morph.MorphLoveDoctor;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphMelonHead;
|
import mineplex.core.gadget.gadgets.morph.MorphMelonHead;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphMetalMan;
|
import mineplex.core.gadget.gadgets.morph.MorphMetalMan;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.MorphOcelot;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphPig;
|
import mineplex.core.gadget.gadgets.morph.MorphPig;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing;
|
import mineplex.core.gadget.gadgets.morph.MorphPumpkinKing;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphSanta;
|
import mineplex.core.gadget.gadgets.morph.MorphSanta;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.MorphSkeleton;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphSlime;
|
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;
|
||||||
@ -178,14 +196,15 @@ 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;
|
||||||
import mineplex.core.gadget.gadgets.morph.MorphWither;
|
import mineplex.core.gadget.gadgets.morph.MorphWither;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.MorphWolf;
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.SoulManager;
|
import mineplex.core.gadget.gadgets.morph.managers.SoulManager;
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphAnath;
|
import mineplex.core.gadget.gadgets.morph.moba.MorphAnath;
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphBardolf;
|
import mineplex.core.gadget.gadgets.morph.moba.MorphBardolf;
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphBiff;
|
import mineplex.core.gadget.gadgets.morph.moba.MorphBiff;
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphIvy;
|
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphDana;
|
import mineplex.core.gadget.gadgets.morph.moba.MorphDana;
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphDevon;
|
import mineplex.core.gadget.gadgets.morph.moba.MorphDevon;
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphHattori;
|
import mineplex.core.gadget.gadgets.morph.moba.MorphHattori;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.moba.MorphIvy;
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphLarissa;
|
import mineplex.core.gadget.gadgets.morph.moba.MorphLarissa;
|
||||||
import mineplex.core.gadget.gadgets.morph.moba.MorphRowena;
|
import mineplex.core.gadget.gadgets.morph.moba.MorphRowena;
|
||||||
import mineplex.core.gadget.gadgets.mount.types.MountBabyReindeer;
|
import mineplex.core.gadget.gadgets.mount.types.MountBabyReindeer;
|
||||||
@ -228,36 +247,47 @@ import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksBoots;
|
|||||||
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksChestplate;
|
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksChestplate;
|
||||||
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat;
|
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksHat;
|
||||||
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings;
|
import mineplex.core.gadget.gadgets.outfit.stpatricks.OutfitStPatricksLeggings;
|
||||||
import mineplex.core.gadget.gadgets.outfit.windupsuit.OutfitWindUpSuitBoosterManager;
|
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleBlood;
|
import mineplex.core.gadget.gadgets.particle.ParticleBlood;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
|
import mineplex.core.gadget.gadgets.particle.ParticleCandyCane;
|
||||||
import mineplex.core.gadget.gadgets.particle.christmas.ParticleBlizzard;
|
|
||||||
import mineplex.core.gadget.gadgets.particle.christmas.ParticleChristmasTree;
|
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
|
import mineplex.core.gadget.gadgets.particle.ParticleCoalFumes;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleDeepSeaSwirl;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleInfused;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleEmerald;
|
import mineplex.core.gadget.gadgets.particle.ParticleEmerald;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
|
import mineplex.core.gadget.gadgets.particle.ParticleEnchant;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleWitchsCure;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
|
import mineplex.core.gadget.gadgets.particle.ParticleFairy;
|
||||||
import mineplex.core.gadget.gadgets.particle.christmas.ParticleFidgetSpinner;
|
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
|
import mineplex.core.gadget.gadgets.particle.ParticleFireRings;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleFoot;
|
import mineplex.core.gadget.gadgets.particle.ParticleFoot;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleFrostLord;
|
import mineplex.core.gadget.gadgets.particle.ParticleFrostLord;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleHalloween;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleHeart;
|
import mineplex.core.gadget.gadgets.particle.ParticleHeart;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleMacawWings;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleChickenWings;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleEnderDragonWings;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleFoxTail;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleJetPack;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleCape;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleLegendaryHero;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleWolfTail;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
|
import mineplex.core.gadget.gadgets.particle.ParticleLegend;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleMusic;
|
import mineplex.core.gadget.gadgets.particle.ParticleMusic;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticlePartyTime;
|
import mineplex.core.gadget.gadgets.particle.ParticlePartyTime;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleHalloween;
|
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleRain;
|
import mineplex.core.gadget.gadgets.particle.ParticleRain;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleRainbow;
|
import mineplex.core.gadget.gadgets.particle.ParticleRainbow;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.ParticleRainbowTrail;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
|
import mineplex.core.gadget.gadgets.particle.ParticleTitan;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
|
import mineplex.core.gadget.gadgets.particle.ParticleWingsAngel;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsBee;
|
import mineplex.core.gadget.gadgets.particle.ParticleWingsBee;
|
||||||
import mineplex.core.gadget.gadgets.particle.christmas.ParticlePumpkinShield;
|
|
||||||
import mineplex.core.gadget.gadgets.particle.christmas.ParticleWingsChristmas;
|
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
|
import mineplex.core.gadget.gadgets.particle.ParticleWingsDemons;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
|
import mineplex.core.gadget.gadgets.particle.ParticleWingsInfernal;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsLove;
|
import mineplex.core.gadget.gadgets.particle.ParticleWingsLove;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
|
import mineplex.core.gadget.gadgets.particle.ParticleWingsPixie;
|
||||||
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
|
import mineplex.core.gadget.gadgets.particle.ParticleYinYang;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.christmas.ParticleBlizzard;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.christmas.ParticleChristmasTree;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.christmas.ParticleFidgetSpinner;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.christmas.ParticlePumpkinShield;
|
||||||
|
import mineplex.core.gadget.gadgets.particle.christmas.ParticleWingsChristmas;
|
||||||
import mineplex.core.gadget.gadgets.particle.freedom.ParticleAuraNiceness;
|
import mineplex.core.gadget.gadgets.particle.freedom.ParticleAuraNiceness;
|
||||||
import mineplex.core.gadget.gadgets.particle.freedom.ParticleCanadian;
|
import mineplex.core.gadget.gadgets.particle.freedom.ParticleCanadian;
|
||||||
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
|
import mineplex.core.gadget.gadgets.particle.freedom.ParticleFreedom;
|
||||||
@ -267,17 +297,22 @@ import mineplex.core.gadget.gadgets.particle.king.CastleManager;
|
|||||||
import mineplex.core.gadget.gadgets.particle.king.ParticleKing;
|
import mineplex.core.gadget.gadgets.particle.king.ParticleKing;
|
||||||
import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo;
|
import mineplex.core.gadget.gadgets.particle.spring.ParticleSpringHalo;
|
||||||
import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt;
|
import mineplex.core.gadget.gadgets.taunts.BlowAKissTaunt;
|
||||||
|
import mineplex.core.gadget.gadgets.taunts.EasyModeTaunt;
|
||||||
|
import mineplex.core.gadget.gadgets.taunts.EmojiTaunt;
|
||||||
import mineplex.core.gadget.gadgets.taunts.EternalTaunt;
|
import mineplex.core.gadget.gadgets.taunts.EternalTaunt;
|
||||||
import mineplex.core.gadget.gadgets.taunts.FrostBreathTaunt;
|
import mineplex.core.gadget.gadgets.taunts.FrostBreathTaunt;
|
||||||
import mineplex.core.gadget.gadgets.taunts.InfernalTaunt;
|
import mineplex.core.gadget.gadgets.taunts.InfernalTaunt;
|
||||||
import mineplex.core.gadget.gadgets.taunts.RainbowTaunt;
|
import mineplex.core.gadget.gadgets.taunts.RainbowTaunt;
|
||||||
|
import mineplex.core.gadget.gadgets.weaponname.WeaponNameType;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectBabyChicken;
|
||||||
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectEarthquake;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectFlames;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectHalloween;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectLavaTrap;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectLightningStrike;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectLoveIsABattlefield;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectLoveIsABattlefield;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectMrPunchMan;
|
||||||
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectPartyAnimal;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectPodium;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectRiseOfTheElderGuardian;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails;
|
import mineplex.core.gadget.gadgets.wineffect.WinEffectSnowTrails;
|
||||||
@ -289,6 +324,7 @@ import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffect
|
|||||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankTitan;
|
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankTitan;
|
||||||
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankUltra;
|
import mineplex.core.gadget.gadgets.wineffect.rankrooms.rankwineffects.WinEffectRankUltra;
|
||||||
import mineplex.core.gadget.persistence.UserGadgetPersistence;
|
import mineplex.core.gadget.persistence.UserGadgetPersistence;
|
||||||
|
import mineplex.core.gadget.set.SetBalance;
|
||||||
import mineplex.core.gadget.set.SetCanadian;
|
import mineplex.core.gadget.set.SetCanadian;
|
||||||
import mineplex.core.gadget.set.SetCandyCane;
|
import mineplex.core.gadget.set.SetCandyCane;
|
||||||
import mineplex.core.gadget.set.SetCupidsLove;
|
import mineplex.core.gadget.set.SetCupidsLove;
|
||||||
@ -297,6 +333,7 @@ import mineplex.core.gadget.set.SetFreedom;
|
|||||||
import mineplex.core.gadget.set.SetFrostLord;
|
import mineplex.core.gadget.set.SetFrostLord;
|
||||||
import mineplex.core.gadget.set.SetHalloween;
|
import mineplex.core.gadget.set.SetHalloween;
|
||||||
import mineplex.core.gadget.set.SetHowlingWinds;
|
import mineplex.core.gadget.set.SetHowlingWinds;
|
||||||
|
import mineplex.core.gadget.set.SetLegend;
|
||||||
import mineplex.core.gadget.set.SetMusic;
|
import mineplex.core.gadget.set.SetMusic;
|
||||||
import mineplex.core.gadget.set.SetParty;
|
import mineplex.core.gadget.set.SetParty;
|
||||||
import mineplex.core.gadget.set.SetRainbow;
|
import mineplex.core.gadget.set.SetRainbow;
|
||||||
@ -310,24 +347,21 @@ import mineplex.core.gadget.set.suits.SetRaveSuit;
|
|||||||
import mineplex.core.gadget.set.suits.SetReindeerSuit;
|
import mineplex.core.gadget.set.suits.SetReindeerSuit;
|
||||||
import mineplex.core.gadget.set.suits.SetSpaceSuit;
|
import mineplex.core.gadget.set.suits.SetSpaceSuit;
|
||||||
import mineplex.core.gadget.set.suits.SetStPatricksSuit;
|
import mineplex.core.gadget.set.suits.SetStPatricksSuit;
|
||||||
import mineplex.core.gadget.types.ArrowEffectGadget;
|
|
||||||
import mineplex.core.gadget.types.BalloonGadget;
|
import mineplex.core.gadget.types.BalloonGadget;
|
||||||
import mineplex.core.gadget.types.DeathEffectGadget;
|
|
||||||
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
||||||
import mineplex.core.gadget.types.FlagGadget;
|
import mineplex.core.gadget.types.FlagGadget;
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
import mineplex.core.gadget.types.GadgetSet;
|
import mineplex.core.gadget.types.GadgetSet;
|
||||||
import mineplex.core.gadget.types.GadgetType;
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
import mineplex.core.gadget.types.GameModifierGadget;
|
|
||||||
import mineplex.core.gadget.types.HatGadget;
|
import mineplex.core.gadget.types.HatGadget;
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
import mineplex.core.gadget.types.KitSelectorGadget;
|
import mineplex.core.gadget.types.LevelPrefixGadget;
|
||||||
import mineplex.core.gadget.types.MusicGadget;
|
import mineplex.core.gadget.types.MusicGadget;
|
||||||
import mineplex.core.gadget.types.OutfitGadget;
|
import mineplex.core.gadget.types.OutfitGadget;
|
||||||
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
|
import mineplex.core.gadget.types.OutfitGadget.ArmorSlot;
|
||||||
import mineplex.core.gadget.types.ParticleGadget;
|
|
||||||
import mineplex.core.gadget.types.TauntGadget;
|
import mineplex.core.gadget.types.TauntGadget;
|
||||||
import mineplex.core.gadget.types.WinEffectGadget;
|
import mineplex.core.gadget.types.WeaponNameGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
import mineplex.core.game.GameDisplay;
|
import mineplex.core.game.GameDisplay;
|
||||||
import mineplex.core.hologram.HologramManager;
|
import mineplex.core.hologram.HologramManager;
|
||||||
import mineplex.core.incognito.IncognitoManager;
|
import mineplex.core.incognito.IncognitoManager;
|
||||||
@ -336,7 +370,6 @@ import mineplex.core.inventory.InventoryManager;
|
|||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
import mineplex.core.packethandler.PacketHandler;
|
import mineplex.core.packethandler.PacketHandler;
|
||||||
import mineplex.core.pet.PetManager;
|
import mineplex.core.pet.PetManager;
|
||||||
import mineplex.core.pet.custom.CustomPet;
|
|
||||||
import mineplex.core.preferences.PreferencesManager;
|
import mineplex.core.preferences.PreferencesManager;
|
||||||
import mineplex.core.projectile.ProjectileManager;
|
import mineplex.core.projectile.ProjectileManager;
|
||||||
|
|
||||||
@ -364,6 +397,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
LOCK_COSMETICS_COMMAND,
|
LOCK_COSMETICS_COMMAND,
|
||||||
UNLOCK_COSMETIC_COMMAND,
|
UNLOCK_COSMETIC_COMMAND,
|
||||||
UNLOCK_COSMETICS_COMMAND,
|
UNLOCK_COSMETICS_COMMAND,
|
||||||
|
TEST_TAUNT_COMMAND
|
||||||
}
|
}
|
||||||
|
|
||||||
private final CoreClientManager _clientManager;
|
private final CoreClientManager _clientManager;
|
||||||
@ -377,7 +411,6 @@ public class GadgetManager extends MiniPlugin
|
|||||||
private final AchievementManager _achievementManager;
|
private final AchievementManager _achievementManager;
|
||||||
private final PacketHandler _packetManager;
|
private final PacketHandler _packetManager;
|
||||||
private final HologramManager _hologramManager;
|
private final HologramManager _hologramManager;
|
||||||
private final OutfitWindUpSuitBoosterManager _boosterManager;
|
|
||||||
private final IncognitoManager _incognitoManager;
|
private final IncognitoManager _incognitoManager;
|
||||||
private final GameCosmeticManager _gameCosmeticManager;
|
private final GameCosmeticManager _gameCosmeticManager;
|
||||||
private SoulManager _soulManager;
|
private SoulManager _soulManager;
|
||||||
@ -394,11 +427,10 @@ public class GadgetManager extends MiniPlugin
|
|||||||
|
|
||||||
private UserGadgetPersistence _userGadgetPersistence;
|
private UserGadgetPersistence _userGadgetPersistence;
|
||||||
|
|
||||||
private boolean _hideParticles = false;
|
private boolean _hideParticles, _showWeaponNames = true;
|
||||||
private int _activeItemSlot = 3;
|
private int _activeItemSlot = 3;
|
||||||
private boolean _gadgetsEnabled = true;
|
private boolean _gadgetsEnabled = true, _gameIsLive = false;
|
||||||
|
|
||||||
private final Set<Entity> _gadgetCollideWhitelist = new HashSet<>();
|
|
||||||
private final Set<Player> _swimmingPlayers = new HashSet<>();
|
private final Set<Player> _swimmingPlayers = new HashSet<>();
|
||||||
|
|
||||||
private GadgetManager()
|
private GadgetManager()
|
||||||
@ -417,7 +449,6 @@ public class GadgetManager extends MiniPlugin
|
|||||||
_packetManager = require(PacketHandler.class);
|
_packetManager = require(PacketHandler.class);
|
||||||
_hologramManager = require(HologramManager.class);
|
_hologramManager = require(HologramManager.class);
|
||||||
_userGadgetPersistence = new UserGadgetPersistence(this);
|
_userGadgetPersistence = new UserGadgetPersistence(this);
|
||||||
_boosterManager = new OutfitWindUpSuitBoosterManager(this);
|
|
||||||
_incognitoManager = require(IncognitoManager.class);
|
_incognitoManager = require(IncognitoManager.class);
|
||||||
_gameCosmeticManager = require(GameCosmeticManager.class);
|
_gameCosmeticManager = require(GameCosmeticManager.class);
|
||||||
_soulManager = new SoulManager();
|
_soulManager = new SoulManager();
|
||||||
@ -450,6 +481,12 @@ public class GadgetManager extends MiniPlugin
|
|||||||
PermissionGroup.QA.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
|
PermissionGroup.QA.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.LOCK_COSMETICS_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.LOCK_COSMETICS_COMMAND, true, true);
|
||||||
PermissionGroup.ADMIN.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
|
PermissionGroup.ADMIN.setPermission(Perm.UNLOCK_COSMETICS_COMMAND, true, true);
|
||||||
|
PermissionGroup.ADMIN.setPermission(Perm.TEST_TAUNT_COMMAND, true, true);
|
||||||
|
|
||||||
|
if (UtilServer.isTestServer())
|
||||||
|
{
|
||||||
|
PermissionGroup.QA.setPermission(Perm.TEST_TAUNT_COMMAND, true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -459,25 +496,22 @@ 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 TestTauntCommand(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSets()
|
private void createSets()
|
||||||
{
|
{
|
||||||
//Particles
|
|
||||||
addSet(new SetFrostLord(this));
|
|
||||||
addSet(new SetCandyCane(this));
|
|
||||||
addSet(new SetTitan(this));
|
|
||||||
|
|
||||||
//Costumes
|
//Costumes
|
||||||
addSet(new SetRaveSuit(this));
|
addSet(new SetRaveSuit(this));
|
||||||
addSet(new SetSpaceSuit(this));
|
addSet(new SetSpaceSuit(this));
|
||||||
addSet(new SetFreezeSuit(this));
|
addSet(new SetFreezeSuit(this));
|
||||||
addSet(new SetStPatricksSuit(this));
|
addSet(new SetStPatricksSuit(this));
|
||||||
addSet(new SetReindeerSuit(this));
|
addSet(new SetReindeerSuit(this));
|
||||||
// Hidden in this update
|
|
||||||
//addSet(new SetWindUpSuit(this));
|
|
||||||
|
|
||||||
// Sets
|
// Sets
|
||||||
|
addSet(new SetFrostLord(this));
|
||||||
|
addSet(new SetCandyCane(this));
|
||||||
|
addSet(new SetTitan(this));
|
||||||
addSet(new SetParty(this));
|
addSet(new SetParty(this));
|
||||||
addSet(new SetCupidsLove(this));
|
addSet(new SetCupidsLove(this));
|
||||||
addSet(new SetEmerald(this));
|
addSet(new SetEmerald(this));
|
||||||
@ -491,6 +525,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addSet(new SetCanadian(this));
|
addSet(new SetCanadian(this));
|
||||||
addSet(new SetHalloween(this));
|
addSet(new SetHalloween(this));
|
||||||
addSet(new SetRainbow(this));
|
addSet(new SetRainbow(this));
|
||||||
|
addSet(new SetLegend(this));
|
||||||
|
addSet(new SetBalance(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createGadgets()
|
private void createGadgets()
|
||||||
@ -521,6 +557,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new ItemOAndX(this));
|
addGadget(new ItemOAndX(this));
|
||||||
addGadget(new ItemMobBomb(this));
|
addGadget(new ItemMobBomb(this));
|
||||||
addGadget(new ItemBallCatch(this));
|
addGadget(new ItemBallCatch(this));
|
||||||
|
addGadget(new ItemTrampoline(this));
|
||||||
|
addGadget(new ItemConnect4(this));
|
||||||
|
|
||||||
// Costume
|
// Costume
|
||||||
addGadget(new OutfitRaveSuitHelmet(this));
|
addGadget(new OutfitRaveSuitHelmet(this));
|
||||||
@ -533,12 +571,6 @@ 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 OutfitWindUpSuitChestplate(this));
|
|
||||||
addGadget(new OutfitWindUpSuitLeggings(this));
|
|
||||||
addGadget(new OutfitWindUpSuitBoots(this));*/
|
|
||||||
|
|
||||||
addGadget(new OutfitFreezeSuitHelmet(this));
|
addGadget(new OutfitFreezeSuitHelmet(this));
|
||||||
addGadget(new OutfitFreezeSuitChestplate(this));
|
addGadget(new OutfitFreezeSuitChestplate(this));
|
||||||
addGadget(new OutfitFreezeSuitLeggings(this));
|
addGadget(new OutfitFreezeSuitLeggings(this));
|
||||||
@ -582,8 +614,6 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new MorphMetalMan(this));
|
addGadget(new MorphMetalMan(this));
|
||||||
addGadget(new MorphTurkey(this));
|
addGadget(new MorphTurkey(this));
|
||||||
addGadget(new MorphChristmasKing(this));
|
addGadget(new MorphChristmasKing(this));
|
||||||
// Not in this update
|
|
||||||
//addGadget(new MorphStray(this));
|
|
||||||
addGadget(new MorphSanta(this));
|
addGadget(new MorphSanta(this));
|
||||||
addGadget(new MorphDinnerbone(this));
|
addGadget(new MorphDinnerbone(this));
|
||||||
addGadget(new MorphLoveDoctor(this));
|
addGadget(new MorphLoveDoctor(this));
|
||||||
@ -603,6 +633,9 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new MorphIvy(this));
|
addGadget(new MorphIvy(this));
|
||||||
addGadget(new MorphGhast(this));
|
addGadget(new MorphGhast(this));
|
||||||
addGadget(new MorphFrostGolem(this));
|
addGadget(new MorphFrostGolem(this));
|
||||||
|
addGadget(new MorphSkeleton(this));
|
||||||
|
addGadget(new MorphOcelot(this));
|
||||||
|
addGadget(new MorphWolf(this));
|
||||||
|
|
||||||
// Mounts
|
// Mounts
|
||||||
addGadget(new MountUndead(this));
|
addGadget(new MountUndead(this));
|
||||||
@ -667,6 +700,18 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new ParticleFidgetSpinner(this));
|
addGadget(new ParticleFidgetSpinner(this));
|
||||||
addGadget(new ParticlePumpkinShield(this));
|
addGadget(new ParticlePumpkinShield(this));
|
||||||
addGadget(new ParticleRainbow(this, _achievementManager));
|
addGadget(new ParticleRainbow(this, _achievementManager));
|
||||||
|
addGadget(new ParticleMacawWings(this));
|
||||||
|
addGadget(new ParticleChickenWings(this));
|
||||||
|
addGadget(new ParticleEnderDragonWings(this));
|
||||||
|
addGadget(new ParticleFoxTail(this));
|
||||||
|
addGadget(new ParticleJetPack(this));
|
||||||
|
addGadget(new ParticleCape(this));
|
||||||
|
addGadget(new ParticleLegendaryHero(this));
|
||||||
|
addGadget(new ParticleWolfTail(this));
|
||||||
|
addGadget(new ParticleWitchsCure(this));
|
||||||
|
addGadget(new ParticleRainbowTrail(this));
|
||||||
|
addGadget(new ParticleDeepSeaSwirl(this));
|
||||||
|
addGadget(new ParticleInfused(this));
|
||||||
|
|
||||||
// Arrow Trails
|
// Arrow Trails
|
||||||
addGadget(new ArrowTrailFrostLord(this));
|
addGadget(new ArrowTrailFrostLord(this));
|
||||||
@ -686,6 +731,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new ArrowTrailRedWhite(this));
|
addGadget(new ArrowTrailRedWhite(this));
|
||||||
addGadget(new ArrowTrailPresent(this));
|
addGadget(new ArrowTrailPresent(this));
|
||||||
addGadget(new ArrowTrailRainbow(this, _achievementManager));
|
addGadget(new ArrowTrailRainbow(this, _achievementManager));
|
||||||
|
addGadget(new ArrowTrailLegend(this));
|
||||||
|
addGadget(new ArrowTrailBalance(this));
|
||||||
|
|
||||||
// Death Effect
|
// Death Effect
|
||||||
addGadget(new DeathFrostLord(this));
|
addGadget(new DeathFrostLord(this));
|
||||||
@ -705,6 +752,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new DeathMapleLeaf(this));
|
addGadget(new DeathMapleLeaf(this));
|
||||||
addGadget(new DeathHalloween(this));
|
addGadget(new DeathHalloween(this));
|
||||||
addGadget(new DeathRainbow(this, _achievementManager));
|
addGadget(new DeathRainbow(this, _achievementManager));
|
||||||
|
addGadget(new DeathLegend(this));
|
||||||
|
addGadget(new DeathBalance(this));
|
||||||
|
|
||||||
// Double Jump
|
// Double Jump
|
||||||
addGadget(new DoubleJumpFrostLord(this));
|
addGadget(new DoubleJumpFrostLord(this));
|
||||||
@ -724,6 +773,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new DoubleJumpMaple(this));
|
addGadget(new DoubleJumpMaple(this));
|
||||||
addGadget(new DoubleJumpPresent(this));
|
addGadget(new DoubleJumpPresent(this));
|
||||||
addGadget(new DoubleJumpRainbow(this, _achievementManager));
|
addGadget(new DoubleJumpRainbow(this, _achievementManager));
|
||||||
|
addGadget(new DoubleJumpLegend(this));
|
||||||
|
addGadget(new DoubleJumpBalance(this));
|
||||||
|
|
||||||
// Hat
|
// Hat
|
||||||
for (HatType hatType : HatType.values())
|
for (HatType hatType : HatType.values())
|
||||||
@ -734,10 +785,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
//Win Effects
|
//Win Effects
|
||||||
addGadget(new WinEffectPodium(this));
|
addGadget(new WinEffectPodium(this));
|
||||||
addGadget(new WinEffectMrPunchMan(this));
|
addGadget(new WinEffectMrPunchMan(this));
|
||||||
//addGadget(new WinEffectFireworks(this));
|
|
||||||
addGadget(new WinEffectFlames(this));
|
addGadget(new WinEffectFlames(this));
|
||||||
addGadget(new WinEffectSnowTrails(this));
|
addGadget(new WinEffectSnowTrails(this));
|
||||||
//addGadget(new WinEffectDragonRider(this));
|
|
||||||
addGadget(new WinEffectBabyChicken(this));
|
addGadget(new WinEffectBabyChicken(this));
|
||||||
addGadget(new WinEffectLightningStrike(this));
|
addGadget(new WinEffectLightningStrike(this));
|
||||||
addGadget(new WinEffectRiseOfTheElderGuardian(this));
|
addGadget(new WinEffectRiseOfTheElderGuardian(this));
|
||||||
@ -746,6 +795,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new WinEffectWinterWarfare(this));
|
addGadget(new WinEffectWinterWarfare(this));
|
||||||
addGadget(new WinEffectLoveIsABattlefield(this));
|
addGadget(new WinEffectLoveIsABattlefield(this));
|
||||||
addGadget(new WinEffectTornado(this));
|
addGadget(new WinEffectTornado(this));
|
||||||
|
addGadget(new WinEffectEarthquake(this));
|
||||||
|
addGadget(new WinEffectPartyAnimal(this));
|
||||||
|
|
||||||
// Rank based win effects
|
// Rank based win effects
|
||||||
addGadget(new WinEffectRankUltra(this));
|
addGadget(new WinEffectRankUltra(this));
|
||||||
@ -770,7 +821,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
// Balloons
|
// Balloons
|
||||||
for (BalloonType balloonType : BalloonType.values())
|
for (BalloonType balloonType : BalloonType.values())
|
||||||
{
|
{
|
||||||
addGadget(new BalloonItem(this, balloonType));
|
addGadget(new BalloonGadget(this, balloonType));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TAUNTS!!!
|
// TAUNTS!!!
|
||||||
@ -779,6 +830,8 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new RainbowTaunt(this));
|
addGadget(new RainbowTaunt(this));
|
||||||
addGadget(new InfernalTaunt(this));
|
addGadget(new InfernalTaunt(this));
|
||||||
addGadget(new FrostBreathTaunt(this));
|
addGadget(new FrostBreathTaunt(this));
|
||||||
|
addGadget(new EmojiTaunt(this));
|
||||||
|
addGadget(new EasyModeTaunt(this));
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
addGadget(new FlagGadget(this, FlagType.CANADA));
|
addGadget(new FlagGadget(this, FlagType.CANADA));
|
||||||
@ -789,6 +842,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
addGadget(new FlagGadget(this, FlagType.PRESENT));
|
addGadget(new FlagGadget(this, FlagType.PRESENT));
|
||||||
addGadget(new FlagGadget(this, FlagType.WREATH));
|
addGadget(new FlagGadget(this, FlagType.WREATH));
|
||||||
addGadget(new FlagGadget(this, FlagType.SNOW_FLAKE));
|
addGadget(new FlagGadget(this, FlagType.SNOW_FLAKE));
|
||||||
|
addGadget(new FlagGadget(this, FlagType.HEART));
|
||||||
|
|
||||||
// Kit Selectors
|
// Kit Selectors
|
||||||
addGadget(new WaterWingsKitSelector(this));
|
addGadget(new WaterWingsKitSelector(this));
|
||||||
@ -805,6 +859,16 @@ public class GadgetManager extends MiniPlugin
|
|||||||
_singleParticleSelectors.put(singleParticleSelectors, gadget);
|
_singleParticleSelectors.put(singleParticleSelectors, gadget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (WeaponNameType weaponNameType : WeaponNameType.values())
|
||||||
|
{
|
||||||
|
addGadget(new WeaponNameGadget(this, weaponNameType));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (LevelPrefixType prefixType : LevelPrefixType.values())
|
||||||
|
{
|
||||||
|
addGadget(new LevelPrefixGadget(this, prefixType));
|
||||||
|
}
|
||||||
|
|
||||||
new GameCosmeticType(this, GameDisplay.MineStrike)
|
new GameCosmeticType(this, GameDisplay.MineStrike)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@ -817,7 +881,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(1))
|
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(1))
|
||||||
{
|
{
|
||||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, CostConstants.FOUND_IN_MINESTRIKE_CHESTS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -828,7 +892,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(2))
|
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(2))
|
||||||
{
|
{
|
||||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, CostConstants.FOUND_IN_MINESTRIKE_CHESTS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -839,7 +903,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(3))
|
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(3))
|
||||||
{
|
{
|
||||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, CostConstants.FOUND_IN_MINESTRIKE_CHESTS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -850,7 +914,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(4))
|
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(4))
|
||||||
{
|
{
|
||||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, CostConstants.FOUND_IN_MINESTRIKE_CHESTS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -861,7 +925,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(5))
|
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(5))
|
||||||
{
|
{
|
||||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, CostConstants.FOUND_IN_MINESTRIKE_CHESTS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -872,7 +936,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(6))
|
for (MineStrikeSkin mineStrikeSkin : MineStrikeSkin.getByCategory(6))
|
||||||
{
|
{
|
||||||
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, -2));
|
addGameGadget(new GameModifierMineStrikeSkin(getManager(), this, mineStrikeSkin, CostConstants.FOUND_IN_MINESTRIKE_CHESTS));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -956,16 +1020,6 @@ public class GadgetManager extends MiniPlugin
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<GadgetSet> getSets(Gadget gadget)
|
|
||||||
{
|
|
||||||
HashSet<GadgetSet> hset = new HashSet<>();
|
|
||||||
for (GadgetSet set : _sets)
|
|
||||||
{
|
|
||||||
if (set.isPartOfSet(gadget)) hset.add(set);
|
|
||||||
}
|
|
||||||
return hset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GadgetSet getGadgetSet(Class<? extends GadgetSet> c)
|
public GadgetSet getGadgetSet(Class<? extends GadgetSet> c)
|
||||||
{
|
{
|
||||||
for (GadgetSet set : _sets)
|
for (GadgetSet set : _sets)
|
||||||
@ -982,12 +1036,7 @@ public class GadgetManager extends MiniPlugin
|
|||||||
|
|
||||||
public void addGadget(Gadget gadget)
|
public void addGadget(Gadget gadget)
|
||||||
{
|
{
|
||||||
if (!_gadgets.containsKey(gadget.getGadgetType()))
|
_gadgets.computeIfAbsent(gadget.getGadgetType(), k -> new ArrayList<>()).add(gadget);
|
||||||
{
|
|
||||||
_gadgets.put(gadget.getGadgetType(), new ArrayList<>());
|
|
||||||
}
|
|
||||||
|
|
||||||
_gadgets.get(gadget.getGadgetType()).add(gadget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -1025,27 +1074,12 @@ public class GadgetManager extends MiniPlugin
|
|||||||
List<Gadget> gadgets = getGadgets(gadgetType);
|
List<Gadget> gadgets = getGadgets(gadgetType);
|
||||||
for (Gadget gadget : gadgets)
|
for (Gadget gadget : gadgets)
|
||||||
{
|
{
|
||||||
if (gadget.getName().equalsIgnoreCase(name)
|
if (gadget.getName().equalsIgnoreCase(name) || Arrays.asList(gadget.getAlternativePackageNames()).contains(name))
|
||||||
|| Arrays.asList(gadget.getAlternativePackageNames()).contains(name))
|
|
||||||
return gadget;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<BalloonGadget> getActiveBalloons(Player player)
|
|
||||||
{
|
|
||||||
List<BalloonGadget> balloonGadgets = new ArrayList<>();
|
|
||||||
for (Gadget gadget : getGadgets(GadgetType.BALLOON))
|
|
||||||
{
|
|
||||||
if (gadget instanceof BalloonGadget)
|
|
||||||
{
|
{
|
||||||
if (gadget.isActive(player))
|
return gadget;
|
||||||
{
|
|
||||||
balloonGadgets.add((BalloonGadget) gadget);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return balloonGadgets;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HatGadget getHatGadget(HatType type)
|
public HatGadget getHatGadget(HatType type)
|
||||||
@ -1081,16 +1115,18 @@ public class GadgetManager extends MiniPlugin
|
|||||||
|
|
||||||
public BalloonGadget getBalloonGadget(BalloonType balloonType)
|
public BalloonGadget getBalloonGadget(BalloonType balloonType)
|
||||||
{
|
{
|
||||||
for (Gadget gadget : getGadgets(GadgetType.BALLOON))
|
return (BalloonGadget) getGadgets(GadgetType.BALLOON).stream()
|
||||||
{
|
.filter(gadget -> ((BalloonGadget) gadget).getBalloonType() == balloonType)
|
||||||
if (gadget instanceof BalloonGadget)
|
.findFirst()
|
||||||
{
|
.orElse(null);
|
||||||
BalloonGadget balloonGadget = (BalloonGadget) gadget;
|
}
|
||||||
if (balloonGadget.getBalloonType().equals(balloonType))
|
|
||||||
return balloonGadget;
|
public WeaponNameGadget getWeaponNameGadget(WeaponNameType weaponNameType)
|
||||||
}
|
{
|
||||||
}
|
return (WeaponNameGadget) getGadgets(GadgetType.WEAPON_NAME).stream()
|
||||||
return null;
|
.filter(gadget -> ((WeaponNameGadget) gadget).getWeaponNameType() == weaponNameType)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SingleParticleKitSelector getSingleParticleKitSelector(SingleParticleKitSelector.SingleParticleSelectors singleParticleSelectors)
|
public SingleParticleKitSelector getSingleParticleKitSelector(SingleParticleKitSelector.SingleParticleSelectors singleParticleSelectors)
|
||||||
@ -1143,37 +1179,13 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
_userGadgetPersistence.setEnabled(false);
|
_userGadgetPersistence.setEnabled(false);
|
||||||
|
|
||||||
for (GadgetType gadgetType : _gadgets.keySet())
|
_gadgets.forEach((type, gadgets) ->
|
||||||
{
|
{
|
||||||
for (Gadget gadget : _gadgets.get(gadgetType))
|
if (type.disableForGame())
|
||||||
{
|
{
|
||||||
if (gadget instanceof ParticleGadget)
|
gadgets.forEach(Gadget::disableForAll);
|
||||||
continue;
|
|
||||||
|
|
||||||
if (gadget instanceof ArrowEffectGadget)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (gadget instanceof DoubleJumpEffectGadget)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (gadget instanceof DeathEffectGadget)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (gadget instanceof WinEffectGadget)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (gadget instanceof GameModifierGadget)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (gadget instanceof TauntGadget)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (gadget instanceof KitSelectorGadget)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
gadget.disableForAll();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disableAll(Player player)
|
public void disableAll(Player player)
|
||||||
@ -1222,6 +1234,60 @@ public class GadgetManager extends MiniPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean selectLocation(Gadget gadget, Location location)
|
||||||
|
{
|
||||||
|
GadgetSelectLocationEvent event = new GadgetSelectLocationEvent(gadget, location);
|
||||||
|
UtilServer.CallEvent(event);
|
||||||
|
return !event.isCancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean selectBlocks(Gadget gadget, Block block)
|
||||||
|
{
|
||||||
|
// Use an ArrayList since removing is unsupported for singletonLists
|
||||||
|
return selectBlocks(gadget, new ArrayList<>(Collections.singletonList(block)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean selectBlocks(Gadget gadget, Collection<Block> blocks)
|
||||||
|
{
|
||||||
|
GadgetBlockEvent event = new GadgetBlockEvent(gadget, blocks);
|
||||||
|
UtilServer.CallEvent(event);
|
||||||
|
|
||||||
|
if (event.getBlocks().isEmpty())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return !event.isCancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean selectEntity(Gadget gadget, Entity entity)
|
||||||
|
{
|
||||||
|
GadgetCollideEntityEvent event = new GadgetCollideEntityEvent(gadget, entity);
|
||||||
|
event.setCancelled(entity instanceof ArmorStand);
|
||||||
|
UtilServer.CallEvent(event);
|
||||||
|
return !event.isCancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void informNoUse(Player player)
|
||||||
|
{
|
||||||
|
player.sendMessage(F.main(getName(), "You cannot use that cosmetic in this area."));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void playLeapEffect(Player player)
|
||||||
|
{
|
||||||
|
if (hideParticles())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Gadget gadget = getActive(player, GadgetType.DOUBLE_JUMP);
|
||||||
|
|
||||||
|
if (gadget != null)
|
||||||
|
{
|
||||||
|
((DoubleJumpEffectGadget) gadget).doEffect(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public PetManager getPetManager()
|
public PetManager getPetManager()
|
||||||
{
|
{
|
||||||
return _petManager;
|
return _petManager;
|
||||||
@ -1262,20 +1328,6 @@ public class GadgetManager extends MiniPlugin
|
|||||||
return _inventoryManager;
|
return _inventoryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OutfitWindUpSuitBoosterManager getBoosterManager()
|
|
||||||
{
|
|
||||||
return _boosterManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean collideEvent(Player shooter, Gadget gadget, Entity other)
|
|
||||||
{
|
|
||||||
GadgetCollideEntityEvent collideEvent = new GadgetCollideEntityEvent(shooter, gadget, other);
|
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(collideEvent);
|
|
||||||
|
|
||||||
return collideEvent.isCancelled();
|
|
||||||
}
|
|
||||||
|
|
||||||
public BlockRestore getBlockRestore()
|
public BlockRestore getBlockRestore()
|
||||||
{
|
{
|
||||||
return _blockRestore;
|
return _blockRestore;
|
||||||
@ -1286,29 +1338,27 @@ public class GadgetManager extends MiniPlugin
|
|||||||
return _packetManager;
|
return _packetManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void setMoving(PlayerMoveEvent event)
|
public void setMoving(PlayerMoveEvent event)
|
||||||
{
|
{
|
||||||
if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0.1)
|
Location from = event.getFrom(), to = event.getTo();
|
||||||
|
|
||||||
|
if (from.getX() == to.getX() && from.getY() == to.getY() && from.getZ() == to.getZ())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
_lastMove.put(event.getPlayer(), System.currentTimeMillis());
|
_lastMove.put(event.getPlayer(), System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMoving(Player player)
|
public boolean isMoving(Player player)
|
||||||
{
|
{
|
||||||
if (!UtilEnt.isGrounded(player)) return true;
|
return !UtilEnt.isGrounded(player) || !UtilTime.elapsed(_lastMove.getOrDefault(player, Long.MAX_VALUE), 500);
|
||||||
|
|
||||||
if (!_lastMove.containsKey(player))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return !UtilTime.elapsed(_lastMove.get(player), 500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event)
|
public void onPlayerQuit(PlayerQuitEvent event)
|
||||||
{
|
{
|
||||||
//saveGadgets(event.getPlayer());
|
|
||||||
event.getPlayer().setWalkSpeed(0.2f);
|
event.getPlayer().setWalkSpeed(0.2f);
|
||||||
event.getPlayer().setFlySpeed(0.1f);
|
event.getPlayer().setFlySpeed(0.1f);
|
||||||
disableAll(event.getPlayer(), false);
|
disableAll(event.getPlayer(), false);
|
||||||
@ -1317,9 +1367,6 @@ public class GadgetManager extends MiniPlugin
|
|||||||
event.getPlayer().setWalkSpeed(0.2f);
|
event.getPlayer().setWalkSpeed(0.2f);
|
||||||
event.getPlayer().setFlySpeed(0.1f);
|
event.getPlayer().setFlySpeed(0.1f);
|
||||||
_soulManager.giveSoul(event.getPlayer());
|
_soulManager.giveSoul(event.getPlayer());
|
||||||
|
|
||||||
// Removes custom pet
|
|
||||||
CustomPet.removeCustomPet(event.getPlayer());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -1328,68 +1375,19 @@ public class GadgetManager extends MiniPlugin
|
|||||||
_lastMove.remove(event.getEntity());
|
_lastMove.remove(event.getEntity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
|
||||||
public void onGadgetCollide(GadgetCollideEntityEvent event)
|
|
||||||
{
|
|
||||||
if (event.getOther() instanceof Player)
|
|
||||||
{
|
|
||||||
event.setCancelled(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isAffectedByGadgets(event.getOther()))
|
|
||||||
{
|
|
||||||
event.setCancelled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param e The entity to check
|
|
||||||
* @return Returns true if the entity is affected by gadgets like snowballs, flesh hooks etc
|
|
||||||
*/
|
|
||||||
public boolean isAffectedByGadgets(Entity e)
|
|
||||||
{
|
|
||||||
return _gadgetCollideWhitelist.contains(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set whether or not the given entity should be affected by gadgets by snowball, flesh hooks etc
|
|
||||||
* By default only players and naturally spawned entities are affected.
|
|
||||||
*/
|
|
||||||
public void setAffectedByGadgets(Entity e, boolean affected)
|
|
||||||
{
|
|
||||||
if (affected)
|
|
||||||
{
|
|
||||||
_gadgetCollideWhitelist.add(e);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_gadgetCollideWhitelist.remove(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setActive(Player player, Gadget gadget)
|
public void setActive(Player player, Gadget gadget)
|
||||||
{
|
{
|
||||||
if (!_playerActiveGadgetMap.containsKey(player))
|
_playerActiveGadgetMap.computeIfAbsent(player, k -> new HashMap<>()).put(gadget.getGadgetType(), gadget);
|
||||||
_playerActiveGadgetMap.put(player, new HashMap<>());
|
|
||||||
|
|
||||||
_playerActiveGadgetMap.get(player).put(gadget.getGadgetType(), gadget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Gadget getActive(Player player, GadgetType gadgetType)
|
public Gadget getActive(Player player, GadgetType gadgetType)
|
||||||
{
|
{
|
||||||
if (!_playerActiveGadgetMap.containsKey(player))
|
return _playerActiveGadgetMap.computeIfAbsent(player, k -> new HashMap<>()).get(gadgetType);
|
||||||
_playerActiveGadgetMap.put(player, new HashMap<>());
|
|
||||||
|
|
||||||
return _playerActiveGadgetMap.get(player).get(gadgetType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeActive(Player player, Gadget gadget)
|
public void removeActive(Player player, Gadget gadget)
|
||||||
{
|
{
|
||||||
if (!_playerActiveGadgetMap.containsKey(player))
|
_playerActiveGadgetMap.computeIfAbsent(player, k -> new HashMap<>()).remove(gadget.getGadgetType());
|
||||||
_playerActiveGadgetMap.put(player, new HashMap<>());
|
|
||||||
|
|
||||||
_playerActiveGadgetMap.get(player).remove(gadget.getGadgetType());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHideParticles(boolean b)
|
public void setHideParticles(boolean b)
|
||||||
@ -1402,6 +1400,16 @@ public class GadgetManager extends MiniPlugin
|
|||||||
return _hideParticles;
|
return _hideParticles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setShowWeaponNames(boolean showWeaponNames)
|
||||||
|
{
|
||||||
|
_showWeaponNames = showWeaponNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean showWeaponNames()
|
||||||
|
{
|
||||||
|
return _showWeaponNames;
|
||||||
|
}
|
||||||
|
|
||||||
public void setActiveItemSlot(int i)
|
public void setActiveItemSlot(int i)
|
||||||
{
|
{
|
||||||
_activeItemSlot = i;
|
_activeItemSlot = i;
|
||||||
@ -1597,6 +1605,53 @@ public class GadgetManager extends MiniPlugin
|
|||||||
taunt.start(player);
|
taunt.start(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void anvilUse(InventoryClickEvent event)
|
||||||
|
{
|
||||||
|
if (event.isCancelled() || !showWeaponNames())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Inventory inventory = event.getClickedInventory();
|
||||||
|
|
||||||
|
if (inventory == null || !(inventory instanceof AnvilInventory) || event.getRawSlot() != 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemStack itemStack = inventory.getItem(event.getRawSlot());
|
||||||
|
|
||||||
|
if (itemStack == null || !itemStack.hasItemMeta() || !itemStack.getItemMeta().hasDisplayName())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
Player player = (Player) event.getWhoClicked();
|
||||||
|
|
||||||
|
player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1, 1);
|
||||||
|
player.sendMessage(F.main(_moduleName, "You cannot rename an item in an " + F.name("Anvil") + "."));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void gameStart(CoreGameStartEvent event)
|
||||||
|
{
|
||||||
|
_gameIsLive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
|
public void gameStop(CoreGameStopEvent event)
|
||||||
|
{
|
||||||
|
_gameIsLive = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isGameLive()
|
||||||
|
{
|
||||||
|
return _gameIsLive;
|
||||||
|
}
|
||||||
|
|
||||||
public CastleManager getCastleManager()
|
public CastleManager getCastleManager()
|
||||||
{
|
{
|
||||||
return _castleManager;
|
return _castleManager;
|
||||||
@ -1606,4 +1661,9 @@ public class GadgetManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
return _gameCosmeticManager;
|
return _gameCosmeticManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AchievementManager getAchievementManager()
|
||||||
|
{
|
||||||
|
return _achievementManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
package mineplex.core.gadget.commands;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.command.CommandBase;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.GadgetManager.Perm;
|
||||||
|
import mineplex.core.gadget.types.GadgetType;
|
||||||
|
import mineplex.core.gadget.types.TauntGadget;
|
||||||
|
|
||||||
|
public class TestTauntCommand extends CommandBase<GadgetManager>
|
||||||
|
{
|
||||||
|
|
||||||
|
public TestTauntCommand(GadgetManager plugin)
|
||||||
|
{
|
||||||
|
super(plugin, Perm.TEST_TAUNT_COMMAND, "testtaunt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void Execute(Player caller, String[] args)
|
||||||
|
{
|
||||||
|
if (args.length < 1)
|
||||||
|
{
|
||||||
|
caller.sendMessage(F.main(Plugin.getName(), "/" + _aliasUsed + " <name>"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String name = Arrays.stream(args).collect(Collectors.joining(" "));
|
||||||
|
TauntGadget gadget = (TauntGadget) Plugin.getGadget(name, GadgetType.TAUNT);
|
||||||
|
|
||||||
|
if (gadget == null)
|
||||||
|
{
|
||||||
|
caller.sendMessage(F.main(Plugin.getName(), "There is no taunt named " + F.name(name) + "."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
gadget.start(caller);
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +1,25 @@
|
|||||||
package mineplex.core.gadget.event;
|
package mineplex.core.gadget.event;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
|
|
||||||
import mineplex.core.gadget.types.Gadget;
|
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
public class GadgetBlockEvent extends Event
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
|
||||||
|
public class GadgetBlockEvent extends Event implements Cancellable
|
||||||
{
|
{
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
|
|
||||||
private Gadget _gadget;
|
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||||
private List<Block> _blocks;
|
|
||||||
|
|
||||||
private boolean _cancelled = false;
|
private final Gadget _gadget;
|
||||||
|
private final Collection<Block> _blocks;
|
||||||
|
|
||||||
public GadgetBlockEvent(Gadget gadget, List<Block> blocks)
|
private boolean _cancelled;
|
||||||
|
|
||||||
|
public GadgetBlockEvent(Gadget gadget, Collection<Block> blocks)
|
||||||
{
|
{
|
||||||
_gadget = gadget;
|
_gadget = gadget;
|
||||||
_blocks = blocks;
|
_blocks = blocks;
|
||||||
@ -25,12 +27,12 @@ public class GadgetBlockEvent extends Event
|
|||||||
|
|
||||||
public HandlerList getHandlers()
|
public HandlerList getHandlers()
|
||||||
{
|
{
|
||||||
return handlers;
|
return HANDLER_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList()
|
public static HandlerList getHandlerList()
|
||||||
{
|
{
|
||||||
return handlers;
|
return HANDLER_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Gadget getGadget()
|
public Gadget getGadget()
|
||||||
@ -38,16 +40,18 @@ public class GadgetBlockEvent extends Event
|
|||||||
return _gadget;
|
return _gadget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Block> getBlocks()
|
public Collection<Block> getBlocks()
|
||||||
{
|
{
|
||||||
return _blocks;
|
return _blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCancelled(boolean cancel)
|
public void setCancelled(boolean cancel)
|
||||||
{
|
{
|
||||||
_cancelled = cancel;
|
_cancelled = cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCancelled()
|
public boolean isCancelled()
|
||||||
{
|
{
|
||||||
return _cancelled;
|
return _cancelled;
|
||||||
|
@ -1,58 +1,42 @@
|
|||||||
package mineplex.core.gadget.event;
|
package mineplex.core.gadget.event;
|
||||||
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
import org.bukkit.event.entity.EntityEvent;
|
||||||
|
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
|
||||||
/**
|
public class GadgetCollideEntityEvent extends EntityEvent implements Cancellable
|
||||||
* An event called when a gadget used by a player collides with an entity. By default, only players are effected (event is cancelled).
|
|
||||||
*/
|
|
||||||
public class GadgetCollideEntityEvent extends Event implements Cancellable
|
|
||||||
{
|
{
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
|
|
||||||
private Player _gadgetHolder;
|
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||||
private Gadget _gadget;
|
|
||||||
private Entity _other;
|
|
||||||
|
|
||||||
private boolean _cancelled = true;
|
private final Gadget _gadget;
|
||||||
|
private boolean _cancelled;
|
||||||
|
|
||||||
public GadgetCollideEntityEvent(Player player, Gadget gadget, Entity other)
|
public GadgetCollideEntityEvent(Gadget gadget, Entity collided)
|
||||||
{
|
{
|
||||||
_gadgetHolder = player;
|
super(collided);
|
||||||
_gadget = gadget;
|
|
||||||
_other = other;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HandlerList getHandlers()
|
_gadget = gadget;
|
||||||
{
|
}
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HandlerList getHandlerList()
|
public HandlerList getHandlers()
|
||||||
{
|
{
|
||||||
return handlers;
|
return HANDLER_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer()
|
public static HandlerList getHandlerList()
|
||||||
{
|
{
|
||||||
return _gadgetHolder;
|
return HANDLER_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Gadget getGadget()
|
public Gadget getGadget()
|
||||||
{
|
{
|
||||||
return _gadget;
|
return _gadget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity getOther()
|
|
||||||
{
|
|
||||||
return _other;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCancelled(boolean cancel)
|
public void setCancelled(boolean cancel)
|
||||||
{
|
{
|
||||||
_cancelled = cancel;
|
_cancelled = cancel;
|
||||||
|
@ -1,40 +1,35 @@
|
|||||||
package mineplex.core.gadget.event;
|
package mineplex.core.gadget.event;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
|
|
||||||
/**
|
public class GadgetSelectLocationEvent extends Event implements Cancellable
|
||||||
* This event is called when a gadget selects a location for a specific effect to be shown.
|
|
||||||
*/
|
|
||||||
public class GadgetSelectLocationEvent extends Event
|
|
||||||
{
|
{
|
||||||
private static final HandlerList handlers = new HandlerList();
|
|
||||||
|
|
||||||
private Player _player;
|
private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||||
private Gadget _gadget;
|
|
||||||
private Location _location;
|
|
||||||
private boolean _showMessage = true;
|
|
||||||
private boolean _cancelled = false;
|
|
||||||
|
|
||||||
public GadgetSelectLocationEvent(Player player, Gadget gadget, Location location)
|
private final Gadget _gadget;
|
||||||
|
private final Location _location;
|
||||||
|
private boolean _cancelled;
|
||||||
|
|
||||||
|
public GadgetSelectLocationEvent(Gadget gadget, Location location)
|
||||||
{
|
{
|
||||||
_player = player;
|
|
||||||
_gadget = gadget;
|
_gadget = gadget;
|
||||||
_location = location;
|
_location = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HandlerList getHandlers()
|
public HandlerList getHandlers()
|
||||||
{
|
{
|
||||||
return handlers;
|
return HANDLER_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList()
|
public static HandlerList getHandlerList()
|
||||||
{
|
{
|
||||||
return handlers;
|
return HANDLER_LIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Gadget getGadget()
|
public Gadget getGadget()
|
||||||
@ -42,43 +37,20 @@ public class GadgetSelectLocationEvent extends Event
|
|||||||
return _gadget;
|
return _gadget;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer()
|
|
||||||
{
|
|
||||||
return _player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Location getLocation()
|
public Location getLocation()
|
||||||
{
|
{
|
||||||
return _location;
|
return _location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCancelled(boolean cancel)
|
public void setCancelled(boolean cancel)
|
||||||
{
|
{
|
||||||
_cancelled = cancel;
|
_cancelled = cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCancelled()
|
public boolean isCancelled()
|
||||||
{
|
{
|
||||||
return _cancelled;
|
return _cancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether or not a cancellation message should be displayed.
|
|
||||||
*
|
|
||||||
* @param showMessage True for the message to be shown and false for the message to be hidden/ignored.
|
|
||||||
*/
|
|
||||||
public void setShowMessage(boolean showMessage)
|
|
||||||
{
|
|
||||||
_showMessage = showMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns whether or not a cancellation message can be shown.
|
|
||||||
*
|
|
||||||
* @return True if the message can be shown and false if the message should be hidden/ignored.
|
|
||||||
*/
|
|
||||||
public boolean canShowMessage()
|
|
||||||
{
|
|
||||||
return _showMessage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.arrowtrail;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
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.UtilText;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.ArrowEffectGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
|
||||||
|
public class ArrowTrailBalance extends ArrowEffectGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
public ArrowTrailBalance(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Simple Geometry",
|
||||||
|
UtilText.splitLineToArray(C.cGray + "If you put water into a tea put, it becomes the tea pot. Be like water my friend.", LineFormat.LORE),
|
||||||
|
CostConstants.FOUND_IN_TREASURE_CHESTS,
|
||||||
|
Material.RECORD_9, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doTrail(Arrow arrow)
|
||||||
|
{
|
||||||
|
Location location = arrow.getLocation();
|
||||||
|
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location, null, 0, 1, ViewDist.NORMAL);
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.SMOKE, location, null, 0, 1, ViewDist.NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doHitEffect(Arrow arrow)
|
||||||
|
{
|
||||||
|
Location location = arrow.getLocation();
|
||||||
|
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location, null, 0.2F, 10, ViewDist.NORMAL);
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.SMOKE, location, null, 0.2F, 10, ViewDist.NORMAL);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.arrowtrail;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.common.util.particles.ColoredParticle;
|
||||||
|
import mineplex.core.common.util.particles.DustSpellColor;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.set.SetLegend;
|
||||||
|
import mineplex.core.gadget.types.ArrowEffectGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
|
||||||
|
public class ArrowTrailLegend extends ArrowEffectGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
public ArrowTrailLegend(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Arrows of the Legends",
|
||||||
|
UtilText.splitLineToArray(C.cGray + "Pwaaaaa Legendary!", LineFormat.LORE),
|
||||||
|
CostConstants.UNLOCKED_WITH_LEGEND,
|
||||||
|
Material.ENDER_PORTAL_FRAME, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doTrail(Arrow arrow)
|
||||||
|
{
|
||||||
|
Location location = arrow.getLocation();
|
||||||
|
|
||||||
|
for (DustSpellColor color : SetLegend.SELECTABLE_COLORS)
|
||||||
|
{
|
||||||
|
new ColoredParticle(ParticleType.RED_DUST, color, location)
|
||||||
|
.display();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doHitEffect(Arrow arrow)
|
||||||
|
{
|
||||||
|
for (DustSpellColor color : SetLegend.SELECTABLE_COLORS)
|
||||||
|
{
|
||||||
|
Location location = UtilAlg.getRandomLocation(arrow.getLocation(), 0.8, 0.3, 0.8);
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
while (i++ < 15)
|
||||||
|
{
|
||||||
|
new ColoredParticle(ParticleType.RED_DUST, color, location.add(0, 0.1, 0))
|
||||||
|
.display();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,84 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.balloons;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_8_R3.EntitySlime;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||||
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||||
|
import org.bukkit.entity.ArmorStand;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
|
||||||
|
public class BalloonEntity extends EntitySlime
|
||||||
|
{
|
||||||
|
|
||||||
|
public static BalloonEntity spawn(ArmorStand host, Player holder, boolean small)
|
||||||
|
{
|
||||||
|
BalloonEntity entity = new BalloonEntity(host, holder, small);
|
||||||
|
UtilEnt.spawnEntity(entity, host.getLocation());
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ArmorStand _host;
|
||||||
|
private final Player _holder;
|
||||||
|
private final boolean _small;
|
||||||
|
private final double _height;
|
||||||
|
|
||||||
|
private BalloonEntity(ArmorStand host, Player holder, boolean small)
|
||||||
|
{
|
||||||
|
super(((CraftWorld) host.getWorld()).getHandle());
|
||||||
|
|
||||||
|
_host = host;
|
||||||
|
_holder = holder;
|
||||||
|
_small = small;
|
||||||
|
_height = small ? 0.2 : 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void t_()
|
||||||
|
{
|
||||||
|
Location host = _host.getLocation(), holder = _holder.getEyeLocation(), teleport = host.clone();
|
||||||
|
double offsetXZ = UtilMath.offset2dSquared(holder, host), offsetY = host.getY() - holder.getY();
|
||||||
|
|
||||||
|
if (offsetY < 0.5)
|
||||||
|
{
|
||||||
|
teleport.add(0, 0.1, 0);
|
||||||
|
}
|
||||||
|
else if (offsetY > (_small ? 2 : 1))
|
||||||
|
{
|
||||||
|
teleport.subtract(0, 0.1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offsetXZ > 2)
|
||||||
|
{
|
||||||
|
teleport.add(UtilAlg.getTrajectory2d(host, holder).multiply(0.1 * offsetXZ));
|
||||||
|
}
|
||||||
|
|
||||||
|
teleport.add(UtilMath.random(-0.1, 0.1), UtilMath.random(-0.1, 0.1), UtilMath.random(-0.1, 0.1));
|
||||||
|
teleport.setYaw((teleport.getYaw() + UtilMath.rRange(-2, 2)) % 360);
|
||||||
|
|
||||||
|
((CraftEntity) _host).getHandle().setPositionRotation(teleport.getX(), teleport.getY(), teleport.getZ(), teleport.getYaw(), 0);
|
||||||
|
setPosition(teleport.getX(), teleport.getY() + _height, teleport.getZ());
|
||||||
|
|
||||||
|
LivingEntity entity = (LivingEntity) getBukkitEntity();
|
||||||
|
|
||||||
|
entity.setLeashHolder(_holder);
|
||||||
|
entity.setShouldBreakLeash(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void remove()
|
||||||
|
{
|
||||||
|
_host.remove();
|
||||||
|
getBukkitEntity().remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPartOfEntity(Entity entity)
|
||||||
|
{
|
||||||
|
return entity.equals(this) || entity.equals(_host);
|
||||||
|
}
|
||||||
|
}
|
@ -1,103 +0,0 @@
|
|||||||
package mineplex.core.gadget.gadgets.balloons;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Ageable;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.Zombie;
|
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.types.BalloonGadget;
|
|
||||||
|
|
||||||
public class BalloonItem extends BalloonGadget
|
|
||||||
{
|
|
||||||
|
|
||||||
private BalloonType _balloonType;
|
|
||||||
private Map<UUID, List<Entity>> _entities = new HashMap<>();
|
|
||||||
private Map<Entity, Player> _reverseEntityMap = new HashMap<>();
|
|
||||||
|
|
||||||
public BalloonItem(GadgetManager manager, BalloonType balloonType)
|
|
||||||
{
|
|
||||||
super(manager, balloonType.getName(), balloonType.getLore(), balloonType.getCost(),
|
|
||||||
balloonType.getDisplayItem().getType(),
|
|
||||||
balloonType.getDisplayItem().getData().getData(), balloonType,
|
|
||||||
balloonType.getEntityType());
|
|
||||||
setDisplayItem(balloonType.getDisplayItem());
|
|
||||||
_balloonType = balloonType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Entity[] spawnEntity(Player player)
|
|
||||||
{
|
|
||||||
Entity[] ents = new Entity[2];
|
|
||||||
if (_balloonType.getEntityType().equals(EntityType.ARMOR_STAND))
|
|
||||||
{
|
|
||||||
Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class);
|
|
||||||
zombie.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false));
|
|
||||||
zombie.getEquipment().setHelmet(_balloonType.getDisplayItem());
|
|
||||||
UtilEnt.silence(zombie, true);
|
|
||||||
UtilEnt.vegetate(zombie);
|
|
||||||
addEntity(player, zombie);
|
|
||||||
|
|
||||||
ents[0] = zombie;
|
|
||||||
|
|
||||||
return ents;
|
|
||||||
}
|
|
||||||
else if (_balloonType.equals(BalloonType.BABY_ZOMBIE))
|
|
||||||
{
|
|
||||||
Zombie zombie = player.getWorld().spawn(player.getLocation(), Zombie.class);
|
|
||||||
zombie.setBaby(true);
|
|
||||||
UtilEnt.vegetate(zombie);
|
|
||||||
UtilEnt.silence(zombie, true);
|
|
||||||
addEntity(player, zombie);
|
|
||||||
ents[0] = zombie;
|
|
||||||
return ents;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Entity entity = player.getWorld().spawnEntity(player.getLocation(), _balloonType.getEntityType());
|
|
||||||
if (_balloonType.isBaby() && entity instanceof Ageable)
|
|
||||||
{
|
|
||||||
((Ageable) entity).setBaby();
|
|
||||||
((Ageable) entity).setAgeLock(true);
|
|
||||||
}
|
|
||||||
UtilEnt.vegetate(entity);
|
|
||||||
UtilEnt.silence(entity, true);
|
|
||||||
addEntity(player, entity);
|
|
||||||
ents[0] = entity;
|
|
||||||
return ents;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addEntity(Player player, Entity entity)
|
|
||||||
{
|
|
||||||
_entities.computeIfAbsent(player.getUniqueId(), list -> new ArrayList<>());
|
|
||||||
List<Entity> entities = _entities.get(player.getUniqueId());
|
|
||||||
entities.add(entity);
|
|
||||||
_entities.put(player.getUniqueId(), entities);
|
|
||||||
_reverseEntityMap.put(entity, player);
|
|
||||||
entity.setMetadata("balloon", new FixedMetadataValue(UtilServer.getPlugin(), "true"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeEntities(Player player)
|
|
||||||
{
|
|
||||||
for (Entity entity : _entities.get(player.getUniqueId()))
|
|
||||||
{
|
|
||||||
_reverseEntityMap.remove(entity);
|
|
||||||
entity.remove();
|
|
||||||
}
|
|
||||||
_entities.remove(player.getUniqueId());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -5,70 +5,99 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBase;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseBat;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseCat;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseCow;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseGuardian;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseMooshroom;
|
||||||
|
import mineplex.core.disguise.disguises.DisguisePig;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseSheep;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseSilverFish;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseSlime;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseSquid;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseVillager;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseWolf;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseZombie;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
import mineplex.core.shop.item.IDisplayPackage;
|
||||||
|
|
||||||
public enum BalloonType
|
public enum BalloonType implements IDisplayPackage
|
||||||
{
|
{
|
||||||
|
|
||||||
// BABY
|
BABY_COW(DisguiseCow.class, "Baby Cow", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.COW)),
|
||||||
BABY_COW (EntityType.COW, true, "Baby Cow Balloon", 0, new ItemStack(Material.COOKED_BEEF)),
|
BABY_PIG(DisguisePig.class, "Baby Pig", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.PIG)),
|
||||||
BABY_PIG (EntityType.PIG, true, "Baby Pig Balloon", 0, new ItemStack(Material.GRILLED_PORK)),
|
BABY_ZOMBIE(DisguiseZombie.class, "Baby Zombie", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.ZOMBIE)),
|
||||||
BABY_ZOMBIE (EntityType.ZOMBIE, true, "Baby Zombie Balloon", 0, new ItemStack(Material.ROTTEN_FLESH)),
|
BABY_MUSHROOM(DisguiseMooshroom.class, "Baby Mushroom Cow", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.MUSHROOM_COW)),
|
||||||
BABY_MUSHROOM(EntityType.MUSHROOM_COW, true, "Baby Mushroom Cow Balloon", 0, new ItemStack(Material.MUSHROOM_SOUP)),
|
BABY_OCELOT(DisguiseCat.class, "Baby Ocelot", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.OCELOT)),
|
||||||
BABY_OCELOT (EntityType.OCELOT, true, "Baby Ocelot Balloon", 0, new ItemStack(Material.COOKED_FISH)),
|
BABY_WOLF(DisguiseWolf.class, "Baby Wolf", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.WOLF)),
|
||||||
BABY_WOLF (EntityType.WOLF, true, "Baby Wolf Balloon", 0, new ItemStack(Material.BONE)),
|
BABY_SHEEP(DisguiseSheep.class, "Baby Sheep", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.SHEEP)),
|
||||||
BABY_SHEEP (EntityType.SHEEP, true, "Baby Sheep Balloon", 0, new ItemStack(Material.WOOL)),
|
BABY_VILLAGER(DisguiseVillager.class, "Baby Villager", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.VILLAGER)),
|
||||||
BABY_VILLAGER(EntityType.VILLAGER, true, "Baby Villager Balloon", 0, new ItemStack(Material.EMERALD)),
|
BABY_SLIME(DisguiseSlime.class, "Baby Slime", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.SLIME)),
|
||||||
BABY_SLIME (EntityType.SLIME, true, "Baby Slime Balloon", 0, new ItemStack(Material.SLIME_BALL)),
|
|
||||||
|
|
||||||
// NOT BABY
|
SQUID(DisguiseSquid.class, "Squid", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.SQUID)),
|
||||||
SQUID (EntityType.SQUID, "Squid Balloon", 0, new ItemStack(Material.INK_SACK)),
|
BAT(DisguiseBat.class, "Bat", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.BAT)),
|
||||||
BAT (EntityType.BAT, "Bat Balloon", 0, new ItemStack(Material.JACK_O_LANTERN)),
|
SILVERFISH(DisguiseSilverFish.class, "Silverfish", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.SILVERFISH)),
|
||||||
SILVERFISH(EntityType.SILVERFISH, "Silverfish Balloon", 0, new ItemStack(Material.getMaterial(97))),
|
GUARDIAN(DisguiseGuardian.class, "Guardian", Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.GUARDIAN)),
|
||||||
GUARDIAN (EntityType.GUARDIAN, "Guardian Balloon", 0, new ItemStack(Material.PRISMARINE_SHARD)),
|
|
||||||
|
|
||||||
// BLOCK
|
DRAGON_EGG(new ItemStack(Material.DRAGON_EGG), "Dragon Egg", Material.DRAGON_EGG, 0),
|
||||||
/*DRAGON_EGG (new ItemStack(Material.DRAGON_EGG), false, "Dragon Egg Balloon", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), 0),
|
DIAMOND_BLOCK(new ItemStack(Material.DIAMOND_BLOCK), "Diamond Block", Material.DIAMOND_BLOCK, 0),
|
||||||
DIAMOND_BLOCK(new ItemStack(Material.DIAMOND_BLOCK), false, "Diamond Block Balloon", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), 0),
|
IRON_BLOCK(new ItemStack(Material.IRON_BLOCK), "Iron Block", Material.IRON_BLOCK, 0),
|
||||||
IRON_BLOCK (new ItemStack(Material.IRON_BLOCK), false, "Iron Block Balloon", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), 0),
|
GOLD_BLOCK(new ItemStack(Material.GOLD_BLOCK), "Gold Block", Material.GOLD_BLOCK, 0),
|
||||||
GOLD_BLOCK (new ItemStack(Material.GOLD_BLOCK), false, "Gold Block Balloon", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), 0),*/
|
EMERALD_BLOCK(new ItemStack(Material.EMERALD_BLOCK), "Emerald Block", Material.EMERALD_BLOCK, 0),
|
||||||
EMERALD_BLOCK(new ItemStack(Material.EMERALD_BLOCK), false, "Emerald Block Balloon", 0);
|
RED_BLOCK(new ItemStack(Material.STAINED_CLAY, 1, (short) 0, (byte) 14), "Red", Material.STAINED_CLAY, 14);
|
||||||
|
|
||||||
private EntityType _entityType;
|
private final Class<? extends DisguiseBase> _clazz;
|
||||||
private boolean _isBaby;
|
private final ItemStack _helmet;
|
||||||
private String _name;
|
private final String _name;
|
||||||
private String[] _lore;
|
private final String[] _description;
|
||||||
private int _cost;
|
private final int _cost;
|
||||||
private ItemStack _displayItem;
|
private final Material _material;
|
||||||
|
private final byte _materialData;
|
||||||
|
|
||||||
BalloonType(EntityType entityType, String name, int cost, ItemStack displayItem)
|
BalloonType(Class<? extends DisguiseBase> clazz, String name, Material material, int materialData)
|
||||||
{
|
{
|
||||||
this(entityType, false, name, cost, displayItem);
|
this(clazz, null, name, null, CostConstants.FOUND_IN_TREASURE_CHESTS, material, materialData);
|
||||||
}
|
}
|
||||||
|
|
||||||
BalloonType(EntityType entityType, boolean isBaby, String name, int cost, ItemStack displayItem)
|
BalloonType(Class<? extends DisguiseBase> clazz, String name, String[] description, int cost, Material material, int materialData)
|
||||||
{
|
{
|
||||||
_entityType = entityType;
|
this(clazz, null, name, description, cost, material, materialData);
|
||||||
_isBaby = isBaby;
|
}
|
||||||
|
|
||||||
|
BalloonType(ItemStack helmet, String name, Material material, int materialData)
|
||||||
|
{
|
||||||
|
this(null, helmet, name, null, CostConstants.FOUND_IN_TREASURE_CHESTS, material, materialData);
|
||||||
|
}
|
||||||
|
|
||||||
|
BalloonType(ItemStack helmet, String name, String[] description, int cost, Material material, int materialData)
|
||||||
|
{
|
||||||
|
this(null, helmet, name, description, cost, material, materialData);
|
||||||
|
}
|
||||||
|
|
||||||
|
BalloonType(Class<? extends DisguiseBase> clazz, ItemStack helmet, String name, String[] description, int cost, Material material, int materialData)
|
||||||
|
{
|
||||||
|
_clazz = clazz;
|
||||||
|
_helmet = helmet;
|
||||||
_name = name;
|
_name = name;
|
||||||
|
_description = description == null ? UtilText.splitLineToArray(C.cGray + "A floating " + F.name(getName() + " Balloon") + " that appears above your head!", LineFormat.LORE) : description;
|
||||||
_cost = cost;
|
_cost = cost;
|
||||||
_displayItem = displayItem;
|
_material = material;
|
||||||
|
_materialData = (byte) materialData;
|
||||||
}
|
}
|
||||||
|
|
||||||
BalloonType(ItemStack block, boolean isBaby, String name, int cost)
|
public Class<? extends DisguiseBase> getClazz()
|
||||||
{
|
{
|
||||||
this(EntityType.ARMOR_STAND, isBaby, name, cost, block);
|
return _clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityType getEntityType()
|
public ItemStack getHelmet()
|
||||||
{
|
{
|
||||||
return _entityType;
|
return _helmet;
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isBaby()
|
|
||||||
{
|
|
||||||
return _isBaby;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
@ -76,11 +105,10 @@ public enum BalloonType
|
|||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getLore()
|
@Override
|
||||||
|
public String[] getDescription()
|
||||||
{
|
{
|
||||||
return UtilText.splitLinesToArray(new String[]{C.cGray + "A floating " + getName() + " that appears above your head!",
|
return _description;
|
||||||
"",
|
|
||||||
C.cWhite + "Click to activate, click again to remove. You can have up to 10 balloons active at a time."}, LineFormat.LORE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCost()
|
public int getCost()
|
||||||
@ -88,8 +116,15 @@ public enum BalloonType
|
|||||||
return _cost;
|
return _cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getDisplayItem()
|
@Override
|
||||||
|
public Material getDisplayMaterial()
|
||||||
{
|
{
|
||||||
return _displayItem;
|
return _material;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public byte getDisplayData()
|
||||||
|
{
|
||||||
|
return _materialData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,64 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.chat;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.DyeColor;
|
||||||
|
|
||||||
|
public enum LevelPrefixType
|
||||||
|
{
|
||||||
|
|
||||||
|
GRAY(ChatColor.GRAY, DyeColor.GRAY, "Gray", 0),
|
||||||
|
BLUE(ChatColor.BLUE, DyeColor.BLUE, "Blue", 20),
|
||||||
|
DARK_GREEN(ChatColor.DARK_GREEN, DyeColor.GREEN, "Dark Green", 40),
|
||||||
|
GOLD(ChatColor.GOLD, DyeColor.ORANGE, "Gold", 60),
|
||||||
|
RED(ChatColor.RED, DyeColor.RED, "Red", 80),
|
||||||
|
DARK_RED(ChatColor.DARK_RED, DyeColor.BROWN, "Dark Red"),
|
||||||
|
YELLOW(ChatColor.YELLOW, DyeColor.YELLOW, "Yellow"),
|
||||||
|
GREEN(ChatColor.GREEN, DyeColor.LIME, "Green"),
|
||||||
|
AQUA(ChatColor.AQUA, DyeColor.LIGHT_BLUE, "Aqua"),
|
||||||
|
CYAN(ChatColor.DARK_AQUA, DyeColor.CYAN, "Cyan"),
|
||||||
|
DARK_BLUE(ChatColor.DARK_BLUE, DyeColor.BLUE, "Dark Blue"),
|
||||||
|
PURPLE(ChatColor.DARK_PURPLE, DyeColor.PURPLE, "Purple"),
|
||||||
|
PINK(ChatColor.LIGHT_PURPLE, DyeColor.PINK, "Pink"),
|
||||||
|
WHITE(ChatColor.WHITE, DyeColor.WHITE, "White"),
|
||||||
|
BLACK(ChatColor.BLACK, DyeColor.BLACK, "Black")
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private final ChatColor _chatColor;
|
||||||
|
private final DyeColor _dyeColor;
|
||||||
|
private final String _name;
|
||||||
|
private int _unlockAt;
|
||||||
|
|
||||||
|
LevelPrefixType(ChatColor chatColor, DyeColor dyeColor, String name)
|
||||||
|
{
|
||||||
|
this(chatColor, dyeColor, name, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
LevelPrefixType(ChatColor chatColor, DyeColor dyeColor, String name, int unlockAt)
|
||||||
|
{
|
||||||
|
_chatColor = chatColor;
|
||||||
|
_dyeColor = dyeColor;
|
||||||
|
_name = name;
|
||||||
|
_unlockAt = unlockAt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChatColor getChatColor()
|
||||||
|
{
|
||||||
|
return _chatColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DyeColor getDyeColor()
|
||||||
|
{
|
||||||
|
return _dyeColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUnlockAt()
|
||||||
|
{
|
||||||
|
return _unlockAt;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.death;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import mineplex.core.blood.BloodEvent;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
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.UtilText;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
|
||||||
|
public class DeathBalance extends DeathEffectGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final double DELTA_THETA = Math.PI / 10;
|
||||||
|
|
||||||
|
public DeathBalance(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Everlasting balance",
|
||||||
|
UtilText.splitLineToArray(C.cGray + "Mmmmm Challenge him you must.", LineFormat.LORE),
|
||||||
|
CostConstants.FOUND_IN_TREASURE_CHESTS,
|
||||||
|
Material.RECORD_9, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlood(Player player, BloodEvent event)
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.setItem(Material.RECORD_9, (byte) 0);
|
||||||
|
|
||||||
|
Location locationA = player.getLocation().add(0, 0.1, 0), locationB = locationA.clone();
|
||||||
|
|
||||||
|
Manager.runSyncTimer(new BukkitRunnable()
|
||||||
|
{
|
||||||
|
double theta = 0, radius = 2, y = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
double x = radius * Math.cos(theta), z = radius * Math.sin(theta);
|
||||||
|
|
||||||
|
locationA.add(x, y, z);
|
||||||
|
locationB.add(-x, y, -z);
|
||||||
|
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, locationA, null, 0, 1, ViewDist.NORMAL);
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.SMOKE, locationB, null, 0, 1, ViewDist.NORMAL);
|
||||||
|
|
||||||
|
locationA.subtract(x, y, z);
|
||||||
|
locationB.subtract(-x, y, -z);
|
||||||
|
|
||||||
|
theta += DELTA_THETA;
|
||||||
|
radius -= 0.1;
|
||||||
|
y += 0.2;
|
||||||
|
|
||||||
|
if (radius < 0)
|
||||||
|
{
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, locationA, null, 0.2F, 5, ViewDist.NORMAL);
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.SMOKE, locationB, null, 0.5F, 5, ViewDist.NORMAL);
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.death;
|
||||||
|
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
import mineplex.core.blood.BloodEvent;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.DeathEffectGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
|
||||||
|
public class DeathLegend extends DeathEffectGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
public DeathLegend(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Legend's Legacy",
|
||||||
|
UtilText.splitLineToArray(C.cGray + "A story to be told for generations to come.", LineFormat.LORE),
|
||||||
|
CostConstants.UNLOCKED_WITH_LEGEND,
|
||||||
|
Material.ENDER_PORTAL_FRAME, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlood(Player player, BloodEvent event)
|
||||||
|
{
|
||||||
|
event.setItem(Material.ENDER_PEARL, (byte) 0);
|
||||||
|
event.getLocation().getWorld().playEffect(event.getLocation(), Effect.ENDER_SIGNAL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,51 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.doublejump;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
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.UtilText;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
|
||||||
|
public class DoubleJumpBalance extends DoubleJumpEffectGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
public DoubleJumpBalance(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Balanced Leap",
|
||||||
|
UtilText.splitLineToArray(C.cGray + "The richest in the world is not the one who has the most, but the one that needs the least.", LineFormat.LORE),
|
||||||
|
CostConstants.FOUND_IN_TREASURE_CHESTS,
|
||||||
|
Material.RECORD_9, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doEffect(Player player)
|
||||||
|
{
|
||||||
|
Manager.runSyncTimer(new BukkitRunnable()
|
||||||
|
{
|
||||||
|
int ticks = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Location location = player.getLocation();
|
||||||
|
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, location, null, 0.05F, 1, ViewDist.NORMAL);
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.SMOKE, location, null, 0.05F, 1, ViewDist.NORMAL);
|
||||||
|
|
||||||
|
if (ticks++ > 15)
|
||||||
|
{
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 0, 1);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.doublejump;
|
||||||
|
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilShapes;
|
||||||
|
import mineplex.core.common.util.UtilText;
|
||||||
|
import mineplex.core.common.util.particles.ColoredParticle;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.set.SetLegend;
|
||||||
|
import mineplex.core.gadget.types.DoubleJumpEffectGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
|
||||||
|
public class DoubleJumpLegend extends DoubleJumpEffectGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
public DoubleJumpLegend(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Legendary Leap",
|
||||||
|
UtilText.splitLineToArray(C.cGray + "Reach the height of legends.", LineFormat.LORE),
|
||||||
|
CostConstants.UNLOCKED_WITH_LEGEND,
|
||||||
|
Material.ENDER_PORTAL_FRAME, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doEffect(Player player)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
Location center = player.getLocation().add(0, 0.3, 0);
|
||||||
|
|
||||||
|
for (Location location : UtilShapes.getPointsInCircle(center, 50, 1))
|
||||||
|
{
|
||||||
|
new ColoredParticle(ParticleType.RED_DUST, SetLegend.SELECTABLE_COLORS[i++ % SetLegend.SELECTABLE_COLORS.length], location)
|
||||||
|
.display();
|
||||||
|
}
|
||||||
|
center.getWorld().playEffect(center, Effect.ENDER_SIGNAL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -15,6 +15,7 @@ public enum FlagType
|
|||||||
PRESENT(CountryFlag.PRESENT, CostConstants.FOUND_IN_GINGERBREAD_CHESTS),
|
PRESENT(CountryFlag.PRESENT, CostConstants.FOUND_IN_GINGERBREAD_CHESTS),
|
||||||
WREATH(CountryFlag.WREATH, CostConstants.FOUND_IN_GINGERBREAD_CHESTS),
|
WREATH(CountryFlag.WREATH, CostConstants.FOUND_IN_GINGERBREAD_CHESTS),
|
||||||
SNOW_FLAKE(CountryFlag.SNOW_FLAKE, CostConstants.FOUND_IN_GINGERBREAD_CHESTS),
|
SNOW_FLAKE(CountryFlag.SNOW_FLAKE, CostConstants.FOUND_IN_GINGERBREAD_CHESTS),
|
||||||
|
HEART(CountryFlag.HEART, CostConstants.FOUND_IN_TREASURE_CHESTS),
|
||||||
|
|
||||||
// Country
|
// Country
|
||||||
AFGHANISTAN(CountryFlag.AFGHANISTAN, -1),
|
AFGHANISTAN(CountryFlag.AFGHANISTAN, -1),
|
||||||
|
@ -0,0 +1,122 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.item;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
|
|
||||||
|
import mineplex.core.common.Pair;
|
||||||
|
import mineplex.core.common.jsonchat.ClickEvent;
|
||||||
|
import mineplex.core.common.jsonchat.HoverEvent;
|
||||||
|
import mineplex.core.common.jsonchat.JsonMessage;
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.UtilPlayer;
|
||||||
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.Ammo;
|
||||||
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
|
|
||||||
|
public abstract class GameItemGadget extends ItemGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final long COOLDOWN_INVITE = TimeUnit.SECONDS.toMillis(8);
|
||||||
|
|
||||||
|
protected final Map<String, Pair<String, Long>> _invites;
|
||||||
|
private final String _command;
|
||||||
|
|
||||||
|
public GameItemGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, Ammo ammo)
|
||||||
|
{
|
||||||
|
super(manager, name, desc, cost, mat, data, COOLDOWN_INVITE, ammo);
|
||||||
|
|
||||||
|
_invites = new HashMap<>(3);
|
||||||
|
_command = "/play-" + name.toLowerCase().replace(" ", "-");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ActivateCustom(Player player)
|
||||||
|
{
|
||||||
|
for (Player nearby : UtilPlayer.getNearby(player.getLocation(), 3))
|
||||||
|
{
|
||||||
|
if (player.equals(nearby))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
sendGameInvite(nearby, player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void startGame(Player invitee, Player inviter);
|
||||||
|
|
||||||
|
private void sendGameInvite(Player invitee, Player inviter)
|
||||||
|
{
|
||||||
|
inviter.sendMessage(F.main(Manager.getName(), "You challenged " + F.name(invitee.getName()) + " to play " + F.name(getName()) + "!"));
|
||||||
|
|
||||||
|
new JsonMessage(F.main(Manager.getName(), F.color("CLICK HERE", C.cYellowB) + " to play " + F.name(getName()) + " with " + F.name(inviter.getName()) + "!"))
|
||||||
|
.hover(HoverEvent.SHOW_TEXT, C.cYellow + "Click to play " + F.name(getName()) + " with " + F.name(inviter.getName()))
|
||||||
|
.click(ClickEvent.RUN_COMMAND, _command + " " + inviter.getName())
|
||||||
|
.sendToPlayer(invitee);
|
||||||
|
|
||||||
|
invitee.playSound(invitee.getLocation(), Sound.NOTE_PIANO, 1, 1);
|
||||||
|
inviter.playSound(inviter.getLocation(), Sound.NOTE_PIANO, 1, 1);
|
||||||
|
|
||||||
|
_invites.put(inviter.getName(), Pair.create(invitee.getName(), System.currentTimeMillis()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void commandProcess(PlayerCommandPreprocessEvent event)
|
||||||
|
{
|
||||||
|
String command = event.getMessage();
|
||||||
|
String[] split = command.split(" ");
|
||||||
|
|
||||||
|
if (split.length != 2 || !split[0].equals(_command))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
Player caller = event.getPlayer();
|
||||||
|
String player = split[1];
|
||||||
|
Pair<String, Long> pair = _invites.get(player);
|
||||||
|
|
||||||
|
if (pair == null || !pair.getLeft().equals(caller.getName()) || UtilTime.elapsed(pair.getRight(), COOLDOWN_INVITE))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player inviter = UtilPlayer.searchExact(player);
|
||||||
|
|
||||||
|
if (inviter == null)
|
||||||
|
{
|
||||||
|
caller.sendMessage(F.main(Manager.getName(), "Looks like the player who challenged you is no longer online."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_invites.remove(player);
|
||||||
|
caller.sendMessage(F.main(Manager.getName(), F.name(inviter.getName()) + " challenged you to a game of " + F.name(getName()) + "!"));
|
||||||
|
inviter.sendMessage(F.main(Manager.getName(), "You challenged " + F.name(caller.getName()) + " to a game of " + F.name(getName()) + "!"));
|
||||||
|
startGame(caller, inviter);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void endGame(Player winner, Player loser)
|
||||||
|
{
|
||||||
|
UtilTextMiddle.display(C.cYellowB + "YOU WON", "", 10, 30, 10, winner);
|
||||||
|
UtilTextMiddle.display(C.cRedB + "YOU LOST", "", 10, 30, 10, loser);
|
||||||
|
winner.getWorld().playSound(winner.getLocation(), Sound.VILLAGER_YES, 1, 1);
|
||||||
|
loser.getWorld().playSound(winner.getLocation(), Sound.VILLAGER_NO, 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void drawGame(Player... players)
|
||||||
|
{
|
||||||
|
UtilTextMiddle.display(C.cRedB + "DRAW", "", 10, 30, 10, players);
|
||||||
|
}
|
||||||
|
}
|
@ -38,7 +38,7 @@ public class ItemBallCatch extends ItemGadget
|
|||||||
private static final double VELOCITY_INCREASE_FACTOR = 1.05;
|
private static final double VELOCITY_INCREASE_FACTOR = 1.05;
|
||||||
private static final double VELOCITY_Y = 0.2;
|
private static final double VELOCITY_Y = 0.2;
|
||||||
private static final double VELOCITY_Y_DECREASE = 0.005;
|
private static final double VELOCITY_Y_DECREASE = 0.005;
|
||||||
private static final long COOLDOWN = TimeUnit.SECONDS.toMillis(20);
|
private static final long COOLDOWN = TimeUnit.SECONDS.toMillis(10);
|
||||||
|
|
||||||
private final Map<ArmorStand, BallData> _balls;
|
private final Map<ArmorStand, BallData> _balls;
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ public class ItemBallCatch extends ItemGadget
|
|||||||
{
|
{
|
||||||
super(manager, "Play Catch", new String[]
|
super(manager, "Play Catch", new String[]
|
||||||
{
|
{
|
||||||
C.cWhite + "Play Catch",
|
C.cGray + "Play Catch",
|
||||||
C.cWhite + "with other players!",
|
C.cGray + "with other players!",
|
||||||
C.blankLine,
|
C.blankLine,
|
||||||
C.cWhite + "Left click hit the ball.",
|
C.cWhite + "Left click hit the ball.",
|
||||||
C.cWhite + "You cannot hit the ball twice",
|
C.cWhite + "You cannot hit the ball twice",
|
||||||
|
@ -118,8 +118,10 @@ public class ItemBatGun extends ItemGadget
|
|||||||
|
|
||||||
if (UtilEnt.hitBox(bat.getLocation(), other, 2, null))
|
if (UtilEnt.hitBox(bat.getLocation(), other, 2, null))
|
||||||
{
|
{
|
||||||
if (Manager.collideEvent(cur, this, other))
|
if (!Manager.selectEntity(this, other))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//Damage Event
|
//Damage Event
|
||||||
UtilAction.velocity(other, UtilAlg.getTrajectory(cur, other), 0.4, false, 0, 0.2, 10, true);
|
UtilAction.velocity(other, UtilAlg.getTrajectory(cur, other), 0.4, false, 0, 0.2, 10, true);
|
||||||
|
@ -1,121 +0,0 @@
|
|||||||
package mineplex.core.gadget.gadgets.item;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.block.Action;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
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.UtilBlock;
|
|
||||||
import mineplex.core.common.util.UtilGear;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilParticle;
|
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.common.util.particles.ColoredParticle;
|
|
||||||
import mineplex.core.common.util.particles.DustSpellColor;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.gadgets.Ammo;
|
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
|
|
||||||
public class ItemBubbleBlaster extends ItemGadget
|
|
||||||
{
|
|
||||||
|
|
||||||
private Map<ArmorStand, Player> _armorStands = new HashMap<>();
|
|
||||||
|
|
||||||
public ItemBubbleBlaster(GadgetManager manager)
|
|
||||||
{
|
|
||||||
super(manager, "Bubble Blaster", UtilText.splitLinesToArray(new String[]{C.cGray + "Placeholder"}, LineFormat.LORE),
|
|
||||||
-14, Material.DIAMOND_BARDING, (byte) 0, 5000, new Ammo("Bubble", "Bubble", Material.DIAMOND_BARDING, (byte) 0, new String[]{C.cGray + "Placeholder"}, -5, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disableCustom(Player player, boolean message)
|
|
||||||
{
|
|
||||||
super.disableCustom(player, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ActivateCustom(Player player)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@EventHandler
|
|
||||||
public void Activate(PlayerInteractEvent event)
|
|
||||||
{
|
|
||||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (UtilBlock.usable(event.getClickedBlock()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!UtilGear.isMat(event.getPlayer().getItemInHand(), this.getDisplayMaterial()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
|
|
||||||
if (!isActive(player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
player.getInventory().setItem(Manager.getActiveItemSlot(), ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, F.item(Manager.getInventoryManager().Get(player).getItemCount(getName()) + " " + getName())));
|
|
||||||
|
|
||||||
// TODO CHANGE COLOR IF RAINBOW
|
|
||||||
// TODO COOLDOWN AFTER MAX OF 5 SECONDS HOLDING
|
|
||||||
// TODO LAUNCH MULTIPLE WHILE HOLDING
|
|
||||||
|
|
||||||
ArmorStand armorStand = player.getWorld().spawn(player.getLocation().add(0, 1, 0), ArmorStand.class);
|
|
||||||
armorStand.setItemInHand(new ItemStack(Material.STAINED_GLASS, 1, (byte) UtilMath.random.nextInt(15)));
|
|
||||||
armorStand.setSmall(true);
|
|
||||||
armorStand.setVisible(false);
|
|
||||||
|
|
||||||
_armorStands.put(armorStand, player);
|
|
||||||
|
|
||||||
double x = UtilMath.random(0.5, 1) - 1.25, z = UtilMath.random(0.5, 1) - 1.25;
|
|
||||||
double sub = UtilMath.random(0.5, 1);
|
|
||||||
if (sub > 0.75)
|
|
||||||
UtilAction.velocity(armorStand, player.getLocation().getDirection().add(new Vector(x, 0, z)), 0.25, false, 0, 0.5, 1, false);
|
|
||||||
else
|
|
||||||
UtilAction.velocity(armorStand, player.getLocation().getDirection().subtract(new Vector(x, 0, z)), 0.25, false, 0, 0.5, 1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void updateArmorStand(UpdateEvent event)
|
|
||||||
{
|
|
||||||
if (event.getType() != UpdateType.TICK)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Iterator<Map.Entry<ArmorStand, Player>> iterator = _armorStands.entrySet().iterator();
|
|
||||||
while (iterator.hasNext())
|
|
||||||
{
|
|
||||||
Map.Entry<ArmorStand, Player> entry = iterator.next();
|
|
||||||
ArmorStand armorStand = entry.getKey();
|
|
||||||
Player player = entry.getValue();
|
|
||||||
if (armorStand.getTicksLived() >= 20)
|
|
||||||
{
|
|
||||||
ColoredParticle coloredParticle = new ColoredParticle(UtilParticle.ParticleType.RED_DUST, new DustSpellColor(Color.WHITE), armorStand.getLocation());
|
|
||||||
coloredParticle.display();
|
|
||||||
armorStand.remove();
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,416 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.item;
|
||||||
|
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.F;
|
||||||
|
import mineplex.core.common.util.MapUtil;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
import mineplex.core.updater.UpdateType;
|
||||||
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
|
|
||||||
|
public class ItemConnect4 extends GameItemGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final long COOLDOWN_USE = TimeUnit.SECONDS.toMillis(20);
|
||||||
|
private static final long TIMEOUT = TimeUnit.MINUTES.toMillis(5);
|
||||||
|
|
||||||
|
private static final int ROWS = 6;
|
||||||
|
private static final int COLUMNS = 7;
|
||||||
|
|
||||||
|
private final Set<GameBoard> _gameBoards;
|
||||||
|
|
||||||
|
public ItemConnect4(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Connect 4", new String[]
|
||||||
|
{
|
||||||
|
C.cGray + "Play Connect 4",
|
||||||
|
C.cGray + "with other players!",
|
||||||
|
C.blankLine,
|
||||||
|
C.cWhite + "Left click the quartz block",
|
||||||
|
C.cWhite + "to place a counter in that",
|
||||||
|
C.cWhite + "column",
|
||||||
|
C.cWhite + "First person to get 4",
|
||||||
|
C.cWhite + "in a row"
|
||||||
|
}, CostConstants.POWERPLAY_BONUS, Material.STAINED_CLAY, (byte) 4, null);
|
||||||
|
|
||||||
|
setPPCYearMonth(YearMonth.of(2018, Month.MARCH));
|
||||||
|
Free = false;
|
||||||
|
_gameBoards = new HashSet<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean activatePreprocess(Player player)
|
||||||
|
{
|
||||||
|
for (GameBoard board : _gameBoards)
|
||||||
|
{
|
||||||
|
if (board.PlayerA.equals(player) || board.PlayerB.equals(player))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
super.disableCustom(player, message);
|
||||||
|
|
||||||
|
remove(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void remove(Player player)
|
||||||
|
{
|
||||||
|
_gameBoards.removeIf(board ->
|
||||||
|
{
|
||||||
|
if (board.PlayerA.equals(player) || board.PlayerB.equals(player))
|
||||||
|
{
|
||||||
|
cleanupBoard(board, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
_invites.remove(player.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void updateTimeout(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.SLOWER)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_gameBoards.removeIf(board ->
|
||||||
|
{
|
||||||
|
if (UtilTime.elapsed(board.StartTime, TIMEOUT))
|
||||||
|
{
|
||||||
|
cleanupBoard(board, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void startGame(Player invitee, Player inviter)
|
||||||
|
{
|
||||||
|
Location location = inviter.getLocation();
|
||||||
|
GameBoard board = new GameBoard(inviter, invitee, location);
|
||||||
|
|
||||||
|
if (!Manager.selectLocation(this, location) || !Manager.selectBlocks(this, board.Blocks) || board.Blocks.stream()
|
||||||
|
.anyMatch(block -> block.getType() != Material.AIR))
|
||||||
|
{
|
||||||
|
String message = F.main(Manager.getName(), "You must find a more open area to play " + F.name(getName()));
|
||||||
|
invitee.sendMessage(message);
|
||||||
|
inviter.sendMessage(message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
board.Blocks.forEach(block -> Manager.getBlockRestore().restore(block));
|
||||||
|
board.Ceiling.forEach(block -> MapUtil.QuickChangeBlockAt(block.getLocation(), Material.QUARTZ_BLOCK));
|
||||||
|
board.Floor.forEach(block -> MapUtil.QuickChangeBlockAt(block.getLocation(), Material.QUARTZ_BLOCK));
|
||||||
|
|
||||||
|
location.setYaw(0);
|
||||||
|
|
||||||
|
{
|
||||||
|
Location teleport = location.clone().add(0, 0, 2);
|
||||||
|
teleport.setYaw(180);
|
||||||
|
inviter.teleport(teleport);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Location teleport = location.clone().subtract(0, 0, 2);
|
||||||
|
teleport.setYaw(0);
|
||||||
|
invitee.teleport(teleport);
|
||||||
|
}
|
||||||
|
|
||||||
|
_gameBoards.add(board);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void blockInteract(PlayerInteractEvent evnet)
|
||||||
|
{
|
||||||
|
Block block = evnet.getClickedBlock();
|
||||||
|
|
||||||
|
if (block == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = evnet.getPlayer();
|
||||||
|
|
||||||
|
for (GameBoard board : _gameBoards)
|
||||||
|
{
|
||||||
|
if (!board.AllowInteract)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean playerA = board.PlayerA.equals(player);
|
||||||
|
boolean playerB = board.PlayerB.equals(player);
|
||||||
|
boolean playerATurn = board.Turn % 2 == 0;
|
||||||
|
int column = board.Floor.indexOf(block);
|
||||||
|
|
||||||
|
if (!playerA && !playerB || column == -1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (playerA && !playerATurn || playerB && playerATurn)
|
||||||
|
{
|
||||||
|
player.sendMessage(F.main(Manager.getName(), "It's not your turn."));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
board.AllowInteract = false;
|
||||||
|
|
||||||
|
Manager.runSyncTimer(new BukkitRunnable()
|
||||||
|
{
|
||||||
|
Block top = block.getRelative(0, ROWS + 1, 0);
|
||||||
|
int row = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if (!isActive(board.PlayerA))
|
||||||
|
{
|
||||||
|
cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row != 0)
|
||||||
|
{
|
||||||
|
MapUtil.QuickChangeBlockAt(top.getLocation(), Material.AIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
top = top.getRelative(BlockFace.DOWN);
|
||||||
|
Location location = top.getLocation().add(0.5, 0.5, 0.5);
|
||||||
|
|
||||||
|
if (top.getType() != Material.AIR)
|
||||||
|
{
|
||||||
|
if (row == 0)
|
||||||
|
{
|
||||||
|
board.AllowInteract = true;
|
||||||
|
player.sendMessage(F.main("Game", "That column is full."));
|
||||||
|
cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
top = top.getRelative(BlockFace.UP);
|
||||||
|
location = top.getLocation().add(0.5, 0.5, 0.5);
|
||||||
|
board.OwnedTiles[--row][column] = playerATurn ? 1 : 2;
|
||||||
|
location.getWorld().playEffect(location, Effect.STEP_SOUND, playerATurn ? Material.REDSTONE_BLOCK : Material.GOLD_BLOCK);
|
||||||
|
cancel();
|
||||||
|
|
||||||
|
if (board.nextTurn())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MapUtil.QuickChangeBlockAt(location, Material.STAINED_CLAY, (byte) (playerATurn ? 14 : 4));
|
||||||
|
row++;
|
||||||
|
}
|
||||||
|
}, 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cleanupBoard(GameBoard board, boolean remove)
|
||||||
|
{
|
||||||
|
Recharge.Instance.use(board.PlayerA, getName(), COOLDOWN_USE, true, true);
|
||||||
|
board.Blocks.forEach(block ->
|
||||||
|
{
|
||||||
|
Manager.getBlockRestore().restore(block);
|
||||||
|
MapUtil.QuickChangeBlockAt(block.getLocation(), Material.AIR);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (remove)
|
||||||
|
{
|
||||||
|
_gameBoards.remove(board);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void gadgetBlock(GadgetBlockEvent event)
|
||||||
|
{
|
||||||
|
for (GameBoard board : _gameBoards)
|
||||||
|
{
|
||||||
|
event.getBlocks().removeIf(board.Blocks::contains);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class GameBoard
|
||||||
|
{
|
||||||
|
|
||||||
|
final Player PlayerA, PlayerB;
|
||||||
|
final int[][] OwnedTiles;
|
||||||
|
final Location TopLeft;
|
||||||
|
final List<Block> Blocks, Floor, Ceiling;
|
||||||
|
final long StartTime;
|
||||||
|
int Turn;
|
||||||
|
boolean First = true, AllowInteract;
|
||||||
|
|
||||||
|
GameBoard(Player playerA, Player playerB, Location center)
|
||||||
|
{
|
||||||
|
PlayerA = playerA;
|
||||||
|
PlayerB = playerB;
|
||||||
|
|
||||||
|
OwnedTiles = new int[ROWS][COLUMNS];
|
||||||
|
for (int[] i : OwnedTiles)
|
||||||
|
{
|
||||||
|
Arrays.fill(i, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
double xMod = Math.floor(COLUMNS / 2D), yMod = ROWS + 1;
|
||||||
|
TopLeft = center.clone().add(-xMod, ROWS, 0);
|
||||||
|
Blocks = UtilBlock.getInBoundingBox(center.clone().add(-xMod, 1, 0), center.clone().add(xMod, yMod, 0), false);
|
||||||
|
Floor = UtilBlock.getInBoundingBox(center.clone().add(-xMod, 0, 0), center.clone().add(xMod, 0, 0), false);
|
||||||
|
Ceiling = UtilBlock.getInBoundingBox(center.clone().add(-xMod, yMod, 0), center.clone().add(xMod, yMod, 0), false);
|
||||||
|
Blocks.addAll(Floor);
|
||||||
|
Blocks.addAll(Ceiling);
|
||||||
|
|
||||||
|
StartTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
if (Math.random() > 0.5)
|
||||||
|
{
|
||||||
|
Turn = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
nextTurn();
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean nextTurn()
|
||||||
|
{
|
||||||
|
boolean playerATurn = Turn % 2 == 0;
|
||||||
|
|
||||||
|
if (hasDrawn())
|
||||||
|
{
|
||||||
|
drawGame(PlayerA, PlayerB);
|
||||||
|
cleanupBoard(this, true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (hasWon(playerATurn ? 1 : 2))
|
||||||
|
{
|
||||||
|
Player winner = playerATurn ? PlayerA : PlayerB;
|
||||||
|
Player loser = playerATurn ? PlayerB : PlayerA;
|
||||||
|
endGame(winner, loser);
|
||||||
|
Manager.runSyncLater(() -> cleanupBoard(this, true), 60);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Turn++;
|
||||||
|
playerATurn = !playerATurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (First)
|
||||||
|
{
|
||||||
|
boolean finalPlayerATurn = playerATurn;
|
||||||
|
Manager.runSyncLater(() -> informTurn(finalPlayerATurn), 20);
|
||||||
|
First = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
informTurn(playerATurn);
|
||||||
|
}
|
||||||
|
|
||||||
|
AllowInteract = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void informTurn(boolean playerATurn)
|
||||||
|
{
|
||||||
|
UtilTextMiddle.display("", C.cYellowB + "Your Turn", 5, 15, 5, playerATurn ? PlayerA : PlayerB);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hasDrawn()
|
||||||
|
{
|
||||||
|
for (int[] columns : OwnedTiles)
|
||||||
|
{
|
||||||
|
for (int column : columns)
|
||||||
|
{
|
||||||
|
if (column == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hasWon(int valueToCheck)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < COLUMNS - 3; j++)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ROWS; i++)
|
||||||
|
{
|
||||||
|
if (OwnedTiles[i][j] == valueToCheck && OwnedTiles[i][j + 1] == valueToCheck && OwnedTiles[i][j + 2] == valueToCheck && OwnedTiles[i][j + 3] == valueToCheck)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < ROWS - 3; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < COLUMNS; j++)
|
||||||
|
{
|
||||||
|
if (OwnedTiles[i][j] == valueToCheck && OwnedTiles[i + 1][j] == valueToCheck && OwnedTiles[i + 2][j] == valueToCheck && OwnedTiles[i + 3][j] == valueToCheck)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 3; i < ROWS; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < COLUMNS - 3; j++)
|
||||||
|
{
|
||||||
|
if (OwnedTiles[i][j] == valueToCheck && OwnedTiles[i - 1][j + 1] == valueToCheck && OwnedTiles[i - 2][j + 2] == valueToCheck && OwnedTiles[i - 3][j + 3] == valueToCheck)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 3; i < ROWS; i++)
|
||||||
|
{
|
||||||
|
for (int j = 3; j < COLUMNS; j++)
|
||||||
|
{
|
||||||
|
if (OwnedTiles[i][j] == valueToCheck && OwnedTiles[i - 1][j - 1] == valueToCheck && OwnedTiles[i - 2][j - 2] == valueToCheck && OwnedTiles[i - 3][j - 3] == valueToCheck)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@ import org.bukkit.EntityEffect;
|
|||||||
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;
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -64,14 +63,10 @@ public class ItemFleshHook extends ItemGadget implements IThrown
|
|||||||
|
|
||||||
Player player = (Player)data.getThrower();
|
Player player = (Player)data.getThrower();
|
||||||
|
|
||||||
if (target == null)
|
if (target == null || !Manager.selectEntity(this, target))
|
||||||
return;
|
{
|
||||||
|
|
||||||
if (Manager.collideEvent(player, this, target))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (target instanceof ArmorStand)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Manager.getCastleManager().isInsideCastle(target.getLocation()))
|
if (Manager.getCastleManager().isInsideCastle(target.getLocation()))
|
||||||
return;
|
return;
|
||||||
|
@ -1,125 +0,0 @@
|
|||||||
package mineplex.core.gadget.gadgets.item;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand;
|
|
||||||
import org.bukkit.entity.Bat;
|
|
||||||
import org.bukkit.entity.FallingBlock;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
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.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.gadgets.Ammo;
|
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
|
|
||||||
public class ItemFootball extends ItemGadget
|
|
||||||
{
|
|
||||||
private HashSet<Bat> _active = new HashSet<Bat>();
|
|
||||||
|
|
||||||
public ItemFootball(GadgetManager manager)
|
|
||||||
{
|
|
||||||
super(manager, "Football", new String[]
|
|
||||||
{
|
|
||||||
C.cWhite + "An amazing souvenier from the",
|
|
||||||
C.cWhite + "Mineplex World Cup in 2053!",
|
|
||||||
},
|
|
||||||
-1,
|
|
||||||
Material.CLAY_BALL, (byte)3,
|
|
||||||
1000, new Ammo("Melon Launcher", "10 Footballs", Material.CLAY_BALL, (byte)0, new String[] { C.cWhite + "10 Footballs to play with" }, 1000, 10));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void ActivateCustom(Player player)
|
|
||||||
{
|
|
||||||
//Action
|
|
||||||
FallingBlock ball = player.getWorld().spawnFallingBlock(player.getLocation().add(0, 1, 0), Material.SKULL, (byte) 3);
|
|
||||||
|
|
||||||
Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class);
|
|
||||||
UtilEnt.vegetate(bat);
|
|
||||||
UtilEnt.ghost(bat, true, true);
|
|
||||||
UtilEnt.silence(bat, true);
|
|
||||||
|
|
||||||
bat.setPassenger(ball);
|
|
||||||
|
|
||||||
_active.add(bat);
|
|
||||||
|
|
||||||
//Inform
|
|
||||||
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + "."));
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void Collide(UpdateEvent event)
|
|
||||||
{
|
|
||||||
if (event.getType() != UpdateType.TICK)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Bat ball : _active)
|
|
||||||
{
|
|
||||||
if (ball.getPassenger() != null)
|
|
||||||
{
|
|
||||||
((CraftFallingSand)ball.getPassenger()).getHandle().ticksLived = 1;
|
|
||||||
ball.getPassenger().setTicksLived(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Player other : UtilServer.getPlayers())
|
|
||||||
{
|
|
||||||
if (UtilMath.offset(ball, other) > 1.5)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!Recharge.Instance.use(other, getName() + " Bump", 200, false, false))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
|
||||||
double power = 0.4;
|
|
||||||
if (other.isSprinting())
|
|
||||||
power = 0.7;
|
|
||||||
|
|
||||||
//Velocity
|
|
||||||
UtilAction.velocity(ball, UtilAlg.getTrajectory2d(other, ball), power, false, 0, 0, 0, false);
|
|
||||||
|
|
||||||
other.getWorld().playSound(other.getLocation(), Sound.ITEM_PICKUP, 0.2f, 0.2f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void Snort(PlayerInteractEvent event)
|
|
||||||
{
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
|
|
||||||
if (!UtilEvent.isAction(event, ActionType.L))
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (Bat ball : _active)
|
|
||||||
{
|
|
||||||
if (UtilMath.offset(ball, player) > 2)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (!Recharge.Instance.use(player, getName() + " Kick", 1000, false, false))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Recharge.Instance.useForce(player, getName() + " Bump", 1000);
|
|
||||||
|
|
||||||
//Velocity
|
|
||||||
UtilAction.velocity(ball, UtilAlg.getTrajectory2d(player, ball), 2, false, 0, 0, 0, false);
|
|
||||||
|
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.ITEM_PICKUP, 1f, 0.1f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -74,7 +74,7 @@ public class ItemFreezeCannon extends ItemGadget implements IThrown
|
|||||||
@Override
|
@Override
|
||||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||||
{
|
{
|
||||||
if (target instanceof Player)
|
if (target instanceof Player && Manager.selectEntity(this, target))
|
||||||
{
|
{
|
||||||
Player p = (Player) target;
|
Player p = (Player) target;
|
||||||
|
|
||||||
|
@ -114,20 +114,12 @@ public class ItemLovePotion extends ItemGadget
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Recharge.Instance.usable(player, getName()))
|
if (!Recharge.Instance.usable(player, getName()) || !Manager.selectEntity(this, event.getRightClicked()))
|
||||||
{
|
{
|
||||||
UtilInv.Update(player);
|
UtilInv.Update(player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GadgetCollideEntityEvent gadgetEvent = new GadgetCollideEntityEvent(player, this, event.getRightClicked());
|
|
||||||
gadgetEvent.setCancelled(true); // Pre cancel
|
|
||||||
|
|
||||||
Bukkit.getPluginManager().callEvent(gadgetEvent);
|
|
||||||
|
|
||||||
if (gadgetEvent.isCancelled())
|
|
||||||
return;
|
|
||||||
|
|
||||||
Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown
|
Recharge.Instance.use(player, getName(), getName(), _recharge, _recharge > 1000, true, false, true, "Cosmetics"); // Cooldown
|
||||||
|
|
||||||
Manager.getInventoryManager().addItemToInventory(player, getName(), -1);
|
Manager.getInventoryManager().addItemToInventory(player, getName(), -1);
|
||||||
|
@ -2,13 +2,13 @@ package mineplex.core.gadget.gadgets.item;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.EntityEffect;
|
import org.bukkit.EntityEffect;
|
||||||
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;
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Item;
|
import org.bukkit.entity.Item;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -40,15 +40,16 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
|
|
||||||
public class ItemMelonLauncher extends ItemGadget implements IThrown
|
public class ItemMelonLauncher extends ItemGadget implements IThrown
|
||||||
{
|
{
|
||||||
private ArrayList<Item> _melon = new ArrayList<Item>();
|
|
||||||
|
private final List<Item> _melon = new ArrayList<>();
|
||||||
|
|
||||||
public ItemMelonLauncher(GadgetManager manager)
|
public ItemMelonLauncher(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Melon Launcher",
|
super(manager, "Melon Launcher",
|
||||||
UtilText.splitLineToArray(C.cWhite + "Because who doesn't want to shoot watermelons at people?!", LineFormat.LORE),
|
UtilText.splitLineToArray(C.cWhite + "Because who doesn't want to shoot watermelons at people?!", LineFormat.LORE),
|
||||||
-1,
|
-1,
|
||||||
Material.MELON_BLOCK, (byte)0,
|
Material.MELON_BLOCK, (byte) 0,
|
||||||
1000, new Ammo("Melon Launcher", "100 Melons", Material.MELON_BLOCK, (byte)0, new String[] { C.cWhite + "100 Melons for you to launch!" }, 500, 100));
|
1000, new Ammo("Melon Launcher", "100 Melons", Material.MELON_BLOCK, (byte) 0, new String[] {C.cWhite + "100 Melons for you to launch!"}, 500, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -59,11 +60,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
|
|||||||
UtilAction.velocity(item, player.getLocation().getDirection(),
|
UtilAction.velocity(item, player.getLocation().getDirection(),
|
||||||
1, false, 0, 0.2, 10, false);
|
1, false, 0, 0.2, 10, false);
|
||||||
|
|
||||||
// Breakpoints for a sentry error
|
Manager.getProjectileManager().AddThrow(item, player, this, 5000, true, true, true, true, 0.5f);
|
||||||
Manager
|
|
||||||
.getProjectileManager()
|
|
||||||
.AddThrow(item, player, this, -1, true, true, true, true,
|
|
||||||
null, 1f, 1f, null, null, 0, UpdateType.TICK, 0.5f);
|
|
||||||
|
|
||||||
//Inform
|
//Inform
|
||||||
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + "."));
|
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(getName()) + "."));
|
||||||
@ -77,16 +74,17 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
|
|||||||
{
|
{
|
||||||
if (target != null)
|
if (target != null)
|
||||||
{
|
{
|
||||||
if (!(target instanceof ArmorStand) && !Manager.getCastleManager().isInsideCastle(target.getLocation()))
|
if (!Manager.selectEntity(this, target))
|
||||||
{
|
{
|
||||||
//Push
|
return;
|
||||||
UtilAction.velocity(target,
|
|
||||||
UtilAlg.getTrajectory2d(data.getThrown().getLocation(), target.getLocation()),
|
|
||||||
1.4, false, 0, 0.8, 1.5, true);
|
|
||||||
|
|
||||||
//Effect
|
|
||||||
target.playEffect(EntityEffect.HURT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Push
|
||||||
|
UtilAction.velocity(target,
|
||||||
|
UtilAlg.getTrajectory2d(data.getThrown().getLocation(), target.getLocation()),
|
||||||
|
1.4, false, 0, 0.8, 1.5, true);
|
||||||
|
|
||||||
|
target.playEffect(EntityEffect.HURT);
|
||||||
}
|
}
|
||||||
|
|
||||||
smash(data.getThrown());
|
smash(data.getThrown());
|
||||||
@ -115,7 +113,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
|
|||||||
//Effect
|
//Effect
|
||||||
ent.getWorld().playEffect(ent.getLocation(), Effect.STEP_SOUND, Material.MELON_BLOCK);
|
ent.getWorld().playEffect(ent.getLocation(), Effect.STEP_SOUND, Material.MELON_BLOCK);
|
||||||
|
|
||||||
for (int i=0 ; i<10 ; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
Item item = ent.getWorld().dropItem(ent.getLocation(), ItemStackFactory.Instance.CreateStack(Material.MELON));
|
Item item = ent.getWorld().dropItem(ent.getLocation(), ItemStackFactory.Instance.CreateStack(Material.MELON));
|
||||||
item.setVelocity(new Vector(UtilMath.rr(0.5, true), UtilMath.rr(0.5, false), UtilMath.rr(0.5, true)));
|
item.setVelocity(new Vector(UtilMath.rr(0.5, true), UtilMath.rr(0.5, false), UtilMath.rr(0.5, true)));
|
||||||
@ -152,7 +150,7 @@ public class ItemMelonLauncher extends ItemGadget implements IThrown
|
|||||||
if (event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Iterator<Item> melonIterator = _melon.iterator(); melonIterator.hasNext();)
|
for (Iterator<Item> melonIterator = _melon.iterator(); melonIterator.hasNext(); )
|
||||||
{
|
{
|
||||||
Item melon = melonIterator.next();
|
Item melon = melonIterator.next();
|
||||||
|
|
||||||
|
@ -3,9 +3,7 @@ package mineplex.core.gadget.gadgets.item;
|
|||||||
import java.time.Month;
|
import java.time.Month;
|
||||||
import java.time.YearMonth;
|
import java.time.YearMonth;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -18,14 +16,9 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import mineplex.core.common.Pair;
|
|
||||||
import mineplex.core.common.jsonchat.ClickEvent;
|
|
||||||
import mineplex.core.common.jsonchat.HoverEvent;
|
|
||||||
import mineplex.core.common.jsonchat.JsonMessage;
|
|
||||||
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.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
@ -33,23 +26,19 @@ import mineplex.core.common.util.UtilEnt;
|
|||||||
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.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.UtilTextMiddle;
|
import mineplex.core.common.util.UtilTextMiddle;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.types.ItemGadget;
|
|
||||||
import mineplex.core.gadget.util.CostConstants;
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
import mineplex.core.itemstack.ItemBuilder;
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
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;
|
||||||
|
|
||||||
public class ItemOAndX extends ItemGadget
|
public class ItemOAndX extends GameItemGadget
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long COOLDOWN_USE = TimeUnit.SECONDS.toMillis(30);
|
private static final long COOLDOWN_USE = TimeUnit.SECONDS.toMillis(15);
|
||||||
private static final long COOLDOWN_INVITE = TimeUnit.SECONDS.toMillis(8);
|
|
||||||
private static final String COMMAND = "/play-tic-tac-toe";
|
|
||||||
private static final int BOARD_SIZE = 9;
|
private static final int BOARD_SIZE = 9;
|
||||||
private static final int[][] TILE_LOCATIONS =
|
private static final int[][] TILE_LOCATIONS =
|
||||||
{
|
{
|
||||||
@ -85,23 +74,21 @@ public class ItemOAndX extends ItemGadget
|
|||||||
private static final ItemStack DEFAULT_TILE = new ItemStack(Material.WOOL, 1, (short) 0, (byte) 15);
|
private static final ItemStack DEFAULT_TILE = new ItemStack(Material.WOOL, 1, (short) 0, (byte) 15);
|
||||||
private static final long TIMEOUT = TimeUnit.MINUTES.toMillis(2);
|
private static final long TIMEOUT = TimeUnit.MINUTES.toMillis(2);
|
||||||
|
|
||||||
private final Map<String, Pair<String, Long>> _invites;
|
|
||||||
private final Set<GameBoard> _gameBoards;
|
private final Set<GameBoard> _gameBoards;
|
||||||
|
|
||||||
public ItemOAndX(GadgetManager manager)
|
public ItemOAndX(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Tic Tac Toe", new String[]
|
super(manager, "Tic Tac Toe", new String[]
|
||||||
{
|
{
|
||||||
C.cWhite + "Play Tic Tac Toe",
|
C.cGray + "Play Tic Tac Toe",
|
||||||
C.cWhite + "with other players!",
|
C.cGray + "with other players!",
|
||||||
C.blankLine,
|
C.blankLine,
|
||||||
C.cWhite + "Left click the block",
|
C.cWhite + "Left click the block",
|
||||||
C.cWhite + "to claim it.",
|
C.cWhite + "to claim it.",
|
||||||
C.cWhite + "First person to get 3",
|
C.cWhite + "First person to get 3",
|
||||||
C.cWhite + "in a row"
|
C.cWhite + "in a row"
|
||||||
}, CostConstants.POWERPLAY_BONUS, Material.CARPET, (byte) 14, COOLDOWN_INVITE, null);
|
}, CostConstants.POWERPLAY_BONUS, Material.CARPET, (byte) 14, null);
|
||||||
|
|
||||||
_invites = new HashMap<>(3);
|
|
||||||
_gameBoards = new HashSet<>(3);
|
_gameBoards = new HashSet<>(3);
|
||||||
|
|
||||||
Free = false;
|
Free = false;
|
||||||
@ -123,36 +110,7 @@ public class ItemOAndX extends ItemGadget
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void ActivateCustom(Player player)
|
protected void startGame(Player invitee, Player inviter)
|
||||||
{
|
|
||||||
for (Player nearby : UtilPlayer.getNearby(player.getLocation(), 3))
|
|
||||||
{
|
|
||||||
if (player.equals(nearby))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendGameInvite(nearby, player);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sendGameInvite(Player invitee, Player inviter)
|
|
||||||
{
|
|
||||||
inviter.sendMessage(F.main(Manager.getName(), "You challenged " + F.name(invitee.getName()) + " to play " + F.name(getName()) + "!"));
|
|
||||||
|
|
||||||
new JsonMessage(F.main(Manager.getName(), F.color("CLICK HERE", C.cYellowB) + " to play " + F.name(getName()) + " with " + F.name(inviter.getName()) + "!"))
|
|
||||||
.hover(HoverEvent.SHOW_TEXT, C.cYellow + "Click to play " + F.name(getName()) + " with " + F.name(inviter.getName()))
|
|
||||||
.click(ClickEvent.RUN_COMMAND, COMMAND + " " + inviter.getName())
|
|
||||||
.sendToPlayer(invitee);
|
|
||||||
|
|
||||||
invitee.playSound(invitee.getLocation(), Sound.NOTE_PIANO, 1, 1);
|
|
||||||
inviter.playSound(inviter.getLocation(), Sound.NOTE_PIANO, 1, 1);
|
|
||||||
|
|
||||||
_invites.put(inviter.getName(), Pair.create(invitee.getName(), System.currentTimeMillis()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startGame(Player invitee, Player inviter)
|
|
||||||
{
|
{
|
||||||
Location location = inviter.getLocation();
|
Location location = inviter.getLocation();
|
||||||
|
|
||||||
@ -199,40 +157,6 @@ public class ItemOAndX extends ItemGadget
|
|||||||
_gameBoards.add(new GameBoard(inviter, invitee, location.subtract(0, 1.4, 0)));
|
_gameBoards.add(new GameBoard(inviter, invitee, location.subtract(0, 1.4, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void commandProcess(PlayerCommandPreprocessEvent event)
|
|
||||||
{
|
|
||||||
String command = event.getMessage();
|
|
||||||
String[] split = command.split(" ");
|
|
||||||
|
|
||||||
if (split.length != 2 || !split[0].equals(COMMAND))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
|
|
||||||
Player caller = event.getPlayer();
|
|
||||||
String player = split[1];
|
|
||||||
Pair<String, Long> pair = _invites.get(player);
|
|
||||||
|
|
||||||
if (pair == null || !pair.getLeft().equals(caller.getName()) || UtilTime.elapsed(pair.getRight(), COOLDOWN_INVITE))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Player inviter = UtilPlayer.searchExact(player);
|
|
||||||
|
|
||||||
if (inviter == null)
|
|
||||||
{
|
|
||||||
caller.sendMessage(F.main(Manager.getName(), "Looks like the player who challenged you is no longer online."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_invites.remove(player);
|
|
||||||
startGame(caller, inviter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void armorStandInteract(EntityDamageByEntityEvent event)
|
public void armorStandInteract(EntityDamageByEntityEvent event)
|
||||||
{
|
{
|
||||||
@ -424,7 +348,7 @@ public class ItemOAndX extends ItemGadget
|
|||||||
|
|
||||||
if (hasDrawn())
|
if (hasDrawn())
|
||||||
{
|
{
|
||||||
UtilTextMiddle.display(C.cRedB + "DRAW", "", 10, 30, 10, PlayerA, PlayerB);
|
drawGame(PlayerA, PlayerB);
|
||||||
cleanupBoard(this, true);
|
cleanupBoard(this, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -433,10 +357,7 @@ public class ItemOAndX extends ItemGadget
|
|||||||
Player winner = playerATurn ? PlayerA : PlayerB;
|
Player winner = playerATurn ? PlayerA : PlayerB;
|
||||||
Player loser = playerATurn ? PlayerB : PlayerA;
|
Player loser = playerATurn ? PlayerB : PlayerA;
|
||||||
|
|
||||||
UtilTextMiddle.display(C.cYellowB + "YOU WON", "", 10, 30, 10, winner);
|
endGame(winner, loser);
|
||||||
UtilTextMiddle.display(C.cRedB + "YOU LOST", "", 10, 30, 10, loser);
|
|
||||||
winner.getWorld().playSound(winner.getLocation(), Sound.VILLAGER_YES, 1, 1);
|
|
||||||
loser.getWorld().playSound(winner.getLocation(), Sound.VILLAGER_NO, 1, 1);
|
|
||||||
cleanupBoard(this, true);
|
cleanupBoard(this, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,10 @@ public class ItemSnowball extends ItemGadget
|
|||||||
|
|
||||||
if(!_snowballs.containsKey(ball)) return;
|
if(!_snowballs.containsKey(ball)) return;
|
||||||
|
|
||||||
if(Manager.collideEvent(_snowballs.remove(ball), this, event.getEntity())) return;
|
if (!Manager.selectEntity(this, event.getEntity()))
|
||||||
|
{
|
||||||
if (event.getEntity() instanceof ArmorStand)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UtilAction.velocity(event.getEntity(), event.getDamager().getVelocity().normalize().add(new Vector(0,0.5,0)).multiply(0.5));
|
UtilAction.velocity(event.getEntity(), event.getDamager().getVelocity().normalize().add(new Vector(0,0.5,0)).multiply(0.5));
|
||||||
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);
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
package mineplex.core.gadget.gadgets.item;
|
package mineplex.core.gadget.gadgets.item;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
|
|
||||||
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.LineFormat;
|
||||||
@ -16,16 +27,6 @@ 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.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.entity.TNTPrimed;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ItemTNT extends ItemGadget
|
public class ItemTNT extends ItemGadget
|
||||||
{
|
{
|
||||||
@ -57,13 +58,11 @@ public class ItemTNT extends ItemGadget
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player killer = _tnt.get(event.getEntity());
|
|
||||||
|
|
||||||
Map<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 8);
|
Map<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 8);
|
||||||
|
|
||||||
for (Player player : players.keySet())
|
for (Player player : players.keySet())
|
||||||
{
|
{
|
||||||
if (Manager.collideEvent(killer, this, player) || Manager.getCastleManager().isInsideCastle(player.getLocation()))
|
if (!Manager.selectEntity(this, player) || Manager.getCastleManager().isInsideCastle(player.getLocation()))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.item;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.ItemGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
|
||||||
|
public class ItemTrampoline extends ItemGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final long DURATION = TimeUnit.SECONDS.toMillis(20);
|
||||||
|
|
||||||
|
public ItemTrampoline(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Trampoline", new String[]
|
||||||
|
{
|
||||||
|
C.cGray + "Create a trampoline for all",
|
||||||
|
C.cGray + "of your bouncing needs",
|
||||||
|
C.blankLine,
|
||||||
|
C.cWhite + "Sneak to go higher!"
|
||||||
|
}, CostConstants.NO_LORE, Material.SLIME_BLOCK, (byte) 0, TimeUnit.SECONDS.toMillis(30), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void ActivateCustom(Player player)
|
||||||
|
{
|
||||||
|
Block block = player.getLocation().getBlock();
|
||||||
|
List<Block> blocks = new ArrayList<>(UtilBlock.getSurrounding(block, true));
|
||||||
|
blocks.add(block);
|
||||||
|
|
||||||
|
Manager.selectBlocks(this, blocks);
|
||||||
|
|
||||||
|
for (Block nearby : blocks)
|
||||||
|
{
|
||||||
|
if (nearby.getY() != block.getY())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Manager.getBlockRestore().add(nearby, Material.SLIME_BLOCK.getId(), getDisplayData(), DURATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.teleport(player.getLocation().add(0, 1, 0));
|
||||||
|
|
||||||
|
Location location = block.getLocation().add(0.5, 1.25, 0.5);
|
||||||
|
|
||||||
|
Manager.runSyncTimer(new BukkitRunnable()
|
||||||
|
{
|
||||||
|
long iterations = DURATION / 50 / 10;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
for (Player nearby : block.getWorld().getPlayers())
|
||||||
|
{
|
||||||
|
double y = nearby.getVelocity().getY();
|
||||||
|
|
||||||
|
if (y < 0.2 && y > -0.2 && blocks.contains(nearby.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||||
|
{
|
||||||
|
nearby.getWorld().playSound(nearby.getLocation(), Sound.FIREWORK_LAUNCH, 2, 1);
|
||||||
|
UtilAction.velocity(nearby, 0.1, 3, 4, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UtilParticle.PlayParticleToAll(ParticleType.HAPPY_VILLAGER, location, 1, 0.5F, 1, 0, 5, ViewDist.NORMAL);
|
||||||
|
|
||||||
|
if (--iterations == 0)
|
||||||
|
{
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 2, 10);
|
||||||
|
}
|
||||||
|
}
|
@ -1,14 +1,10 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.server.v1_8_R3.Entity;
|
import net.minecraft.server.v1_8_R3.Entity;
|
||||||
import net.minecraft.server.v1_8_R3.EntityArmorStand;
|
import net.minecraft.server.v1_8_R3.EntityArmorStand;
|
||||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||||
import net.minecraft.server.v1_8_R3.IBlockData;
|
import net.minecraft.server.v1_8_R3.IBlockData;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -30,7 +26,6 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.disguise.disguises.DisguiseBlock;
|
import mineplex.core.disguise.disguises.DisguiseBlock;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSlime;
|
import mineplex.core.disguise.disguises.DisguiseSlime;
|
||||||
import mineplex.core.gadget.event.GadgetBlockEvent;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
|
||||||
public class BlockForm
|
public class BlockForm
|
||||||
@ -190,16 +185,8 @@ public class BlockForm
|
|||||||
{
|
{
|
||||||
Block block = _player.getLocation().getBlock();
|
Block block = _player.getLocation().getBlock();
|
||||||
|
|
||||||
List<Block> blockList = new ArrayList<>();
|
|
||||||
blockList.add(block);
|
|
||||||
|
|
||||||
GadgetBlockEvent event = new GadgetBlockEvent(_host, blockList);
|
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
// Not Able
|
// Not Able
|
||||||
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN))
|
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)) || !_host.Manager.selectBlocks(_host, block))
|
||||||
|| event.getBlocks().isEmpty() || event.isCancelled())
|
|
||||||
{
|
{
|
||||||
UtilPlayer.message(_player, F.main("Morph", "You cannot become a Solid Block here."));
|
UtilPlayer.message(_player, F.main("Morph", "You cannot become a Solid Block here."));
|
||||||
_player.setExp(0f);
|
_player.setExp(0f);
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
|
||||||
|
public abstract class MorphAbilityGadget extends MorphGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final int ACTIVE_SLOT = 2;
|
||||||
|
|
||||||
|
private final ItemStack _abilityItem;
|
||||||
|
private final String _abilityName;
|
||||||
|
private final long _recharge;
|
||||||
|
|
||||||
|
public MorphAbilityGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data, ItemStack abilityItem, String abilityName, long recharge)
|
||||||
|
{
|
||||||
|
super(manager, name, desc, cost, mat, data);
|
||||||
|
|
||||||
|
_abilityName = abilityName;
|
||||||
|
_abilityItem = abilityItem;
|
||||||
|
_recharge = recharge;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyArmor(Player player, boolean message)
|
||||||
|
{
|
||||||
|
super.applyArmor(player, message);
|
||||||
|
|
||||||
|
player.getInventory().setItem(ACTIVE_SLOT, _abilityItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeArmor(Player player)
|
||||||
|
{
|
||||||
|
super.removeArmor(player);
|
||||||
|
|
||||||
|
player.getInventory().setItem(ACTIVE_SLOT, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onAbilityActivate(Player player);
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void interact(PlayerInteractEvent event)
|
||||||
|
{
|
||||||
|
if (event.getAction() == Action.PHYSICAL)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
ItemStack itemStack = event.getItem();
|
||||||
|
|
||||||
|
if (!isActive(player) || itemStack == null || !itemStack.equals(_abilityItem))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
if (!Manager.selectLocation(this, player.getLocation()))
|
||||||
|
{
|
||||||
|
Manager.informNoUse(player);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Recharge.Instance.use(player, _abilityName, _recharge, true, true, "Cosmetics"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
onAbilityActivate(player);
|
||||||
|
}
|
||||||
|
}
|
@ -9,26 +9,12 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.LineFormat;
|
|
||||||
import mineplex.core.common.util.UtilBlock;
|
|
||||||
import mineplex.core.common.util.UtilEvent;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.hologram.Hologram;
|
|
||||||
import mineplex.core.hologram.HologramManager;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
import mineplex.core.recharge.Recharge;
|
|
||||||
import mineplex.core.treasure.event.TreasureFinishEvent;
|
|
||||||
import mineplex.core.treasure.event.TreasureStartEvent;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
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;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
@ -37,10 +23,20 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
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.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
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.gadgets.morph.managers.UtilMorph;
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.hologram.Hologram;
|
||||||
|
import mineplex.core.hologram.HologramManager;
|
||||||
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
|
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.utils.UtilGameProfile;
|
import mineplex.core.utils.UtilGameProfile;
|
||||||
@ -198,9 +194,6 @@ public class MorphBobRoss extends MorphGadget
|
|||||||
/** Colors that are being used by painting players */
|
/** Colors that are being used by painting players */
|
||||||
private final Map<UUID, Byte> _paintColors = new HashMap<>();
|
private final Map<UUID, Byte> _paintColors = new HashMap<>();
|
||||||
|
|
||||||
/** Locations at which treasure is currently being opened */
|
|
||||||
private final Map<UUID, Location> _openingTreasure = new HashMap<>();
|
|
||||||
|
|
||||||
private final HologramManager _holograms;
|
private final HologramManager _holograms;
|
||||||
|
|
||||||
public MorphBobRoss(GadgetManager manager, HologramManager holograms)
|
public MorphBobRoss(GadgetManager manager, HologramManager holograms)
|
||||||
@ -374,14 +367,6 @@ public class MorphBobRoss extends MorphGadget
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Location location : _openingTreasure.values())
|
|
||||||
{
|
|
||||||
if (location.toVector().isInSphere(event.getPlayer().getLocation().toVector(), TREASURE_RADIUS))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if the player has been issued a paintbrush
|
// check if the player has been issued a paintbrush
|
||||||
if (_inventoryItems.containsKey(player.getUniqueId()))
|
if (_inventoryItems.containsKey(player.getUniqueId()))
|
||||||
{
|
{
|
||||||
@ -401,7 +386,7 @@ public class MorphBobRoss extends MorphGadget
|
|||||||
if ((block.isEmpty() || carpet) && UtilBlock.fullSolid(down) && !UtilBlock.bottomSlab(down))
|
if ((block.isEmpty() || carpet) && UtilBlock.fullSolid(down) && !UtilBlock.bottomSlab(down))
|
||||||
{
|
{
|
||||||
// if the block is a non-paint carpet
|
// if the block is a non-paint carpet
|
||||||
if (carpet && !Manager.getBlockRestore().contains(block))
|
if (carpet && !Manager.getBlockRestore().contains(block) || !Manager.selectBlocks(this, block))
|
||||||
{
|
{
|
||||||
return; // don't paint
|
return; // don't paint
|
||||||
}
|
}
|
||||||
@ -561,26 +546,4 @@ public class MorphBobRoss extends MorphGadget
|
|||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable painting in the area around treasure being opened.
|
|
||||||
*/
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
|
||||||
public void disableOnTreasureStart(TreasureStartEvent event)
|
|
||||||
{
|
|
||||||
_openingTreasure.put(event.getPlayer().getUniqueId(), event.getPlayer().getLocation());
|
|
||||||
Manager.getBlockRestore().restoreBlockAround(Material.CARPET, event.getPlayer().getLocation(), TREASURE_RADIUS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable painting in the area around treasure no longer being opened.
|
|
||||||
*/
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
|
||||||
public void enableOnTreasureFinish(TreasureFinishEvent event)
|
|
||||||
{
|
|
||||||
if (_openingTreasure.containsKey(event.getPlayer().getUniqueId()))
|
|
||||||
{
|
|
||||||
_openingTreasure.remove(event.getPlayer().getUniqueId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.Color;
|
|||||||
import org.bukkit.FireworkEffect.Type;
|
import org.bukkit.FireworkEffect.Type;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
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;
|
||||||
@ -62,7 +63,7 @@ public class MorphBunny extends MorphGadget
|
|||||||
"#" + C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Shards",
|
"#" + C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "Hide Easter Egg uses 500 Shards",
|
||||||
}, LineFormat.LORE),
|
}, LineFormat.LORE),
|
||||||
-5,
|
-5,
|
||||||
Material.MONSTER_EGG, (byte) 98);
|
Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.RABBIT));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -163,8 +164,7 @@ public class MorphBunny extends MorphGadget
|
|||||||
|
|
||||||
|
|
||||||
//Item
|
//Item
|
||||||
ItemStack eggStack = ItemStackFactory.Instance.CreateStack(Material.MONSTER_EGG, (byte) 0, 1, "Hidden Egg" + System.currentTimeMillis());
|
ItemStack eggStack = ItemStackFactory.Instance.CreateStack(getDisplayMaterial(), getDisplayData(), 1, "Hidden Egg" + System.currentTimeMillis());
|
||||||
eggStack.setDurability((short) 98);
|
|
||||||
|
|
||||||
Item egg = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), eggStack);
|
Item egg = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), eggStack);
|
||||||
UtilAction.velocity(egg, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false);
|
UtilAction.velocity(egg, player.getLocation().getDirection(), 0.2, false, 0, 0.2, 1, false);
|
||||||
|
@ -37,7 +37,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
|
|
||||||
public class MorphChristmasKing extends MorphGadget
|
public class MorphChristmasKing extends MorphGadget
|
||||||
{
|
{
|
||||||
private Map<Projectile, Player> _snowball = new WeakHashMap<>();
|
private final Map<Projectile, Player> _snowball = new WeakHashMap<>();
|
||||||
|
|
||||||
public MorphChristmasKing(GadgetManager manager)
|
public MorphChristmasKing(GadgetManager manager)
|
||||||
{
|
{
|
||||||
@ -155,11 +155,10 @@ public class MorphChristmasKing extends MorphGadget
|
|||||||
|
|
||||||
Snowball proj = (Snowball) event.getDamager();
|
Snowball proj = (Snowball) event.getDamager();
|
||||||
|
|
||||||
if (!_snowball.containsKey(proj))
|
if (_snowball.remove(proj) == null || !Manager.selectEntity(this, event.getEntity()))
|
||||||
return;
|
{
|
||||||
|
|
||||||
if (Manager.collideEvent(_snowball.remove(proj), this, event.getEntity()))
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
|
UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
|
||||||
}
|
}
|
||||||
|
@ -107,11 +107,10 @@ public class MorphCreeper extends MorphGadget
|
|||||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(player.getLocation(), 8);
|
HashMap<Player, Double> players = UtilPlayer.getInRadius(player.getLocation(), 8);
|
||||||
for (Player other : players.keySet())
|
for (Player other : players.keySet())
|
||||||
{
|
{
|
||||||
if (other.equals(player))
|
if (other.equals(player) || !Manager.selectEntity(this, other))
|
||||||
continue;
|
{
|
||||||
|
|
||||||
if (Manager.collideEvent(player, this, other))
|
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double mult = players.get(other);
|
double mult = players.get(other);
|
||||||
|
|
||||||
|
@ -1,6 +1,24 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import java.time.Month;
|
||||||
|
import java.time.YearMonth;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ThreadLocalRandom;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.block.Banner;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import mineplex.core.blockrestore.BlockRestore;
|
import mineplex.core.blockrestore.BlockRestore;
|
||||||
import mineplex.core.common.skin.SkinData;
|
import mineplex.core.common.skin.SkinData;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -19,23 +37,6 @@ 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.utils.UtilGameProfile;
|
import mineplex.core.utils.UtilGameProfile;
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Banner;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
|
|
||||||
import java.time.Month;
|
|
||||||
import java.time.YearMonth;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Freedom fighter morph, capable of planting flags by crouching.
|
* Freedom fighter morph, capable of planting flags by crouching.
|
||||||
@ -90,7 +91,6 @@ public class MorphFreedomFighter extends MorphGadget
|
|||||||
DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile);
|
DisguisePlayer disguisePlayer = new DisguisePlayer(player, profile);
|
||||||
disguisePlayer.showInTabList(true, 0);
|
disguisePlayer.showInTabList(true, 0);
|
||||||
UtilMorph.disguise(player, disguisePlayer, Manager);
|
UtilMorph.disguise(player, disguisePlayer, Manager);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -114,17 +114,7 @@ public class MorphFreedomFighter extends MorphGadget
|
|||||||
// Clear cooldown timers
|
// Clear cooldown timers
|
||||||
if (event.getType() == UpdateType.SEC)
|
if (event.getType() == UpdateType.SEC)
|
||||||
{
|
{
|
||||||
Iterator<Map.Entry<UUID, Long>> itr = _flagCooldowns.entrySet().iterator();
|
_flagCooldowns.entrySet().removeIf(entry -> entry.getValue() + FLAG_COOLDOWN < System.currentTimeMillis());
|
||||||
|
|
||||||
while (itr.hasNext())
|
|
||||||
{
|
|
||||||
Map.Entry<UUID, Long> entry = itr.next();
|
|
||||||
|
|
||||||
if (entry.getValue() + FLAG_COOLDOWN < System.currentTimeMillis())
|
|
||||||
{
|
|
||||||
itr.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For all active cosmetics
|
// For all active cosmetics
|
||||||
@ -145,22 +135,7 @@ public class MorphFreedomFighter extends MorphGadget
|
|||||||
// If the players has waiting long enough to place the flag
|
// If the players has waiting long enough to place the flag
|
||||||
if (_flagTimers.get(uuid) + FLAG_DELAY < System.currentTimeMillis())
|
if (_flagTimers.get(uuid) + FLAG_DELAY < System.currentTimeMillis())
|
||||||
{
|
{
|
||||||
boolean flag = false;
|
if (!Manager.selectLocation(this, player.getLocation()))
|
||||||
Location location = player.getLocation().subtract(0, 0.5, 0);
|
|
||||||
|
|
||||||
// Make sure the ground is flat enough to place the flag
|
|
||||||
for (int i = 0; i < BEACON_BASE.length; ++i)
|
|
||||||
{
|
|
||||||
Block b = location.clone().add(BEACON_BASE[i][0], 0, BEACON_BASE[i][2]).getBlock();
|
|
||||||
|
|
||||||
if (b.isEmpty())
|
|
||||||
{
|
|
||||||
flag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flag)
|
|
||||||
{
|
{
|
||||||
_flagTimers.remove(uuid);
|
_flagTimers.remove(uuid);
|
||||||
player.sendMessage(F.main("Morphs", C.cRed + "You must plant your flag on flatter ground."));
|
player.sendMessage(F.main("Morphs", C.cRed + "You must plant your flag on flatter ground."));
|
||||||
@ -255,9 +230,9 @@ public class MorphFreedomFighter extends MorphGadget
|
|||||||
|
|
||||||
restore.add(point.getBlock().getRelative(BlockFace.DOWN), Material.BEACON.getId(), (byte) 0, FLAG_COOLDOWN);
|
restore.add(point.getBlock().getRelative(BlockFace.DOWN), Material.BEACON.getId(), (byte) 0, FLAG_COOLDOWN);
|
||||||
|
|
||||||
for (int i = 0; i < BEACON_BASE.length; ++i)
|
for (int[] beaconBase : BEACON_BASE)
|
||||||
{
|
{
|
||||||
restore.add(world.getBlockAt(point.clone().add(BEACON_BASE[i][0], BEACON_BASE[i][1], BEACON_BASE[i][2])),
|
restore.add(world.getBlockAt(point.clone().add(beaconBase[0], beaconBase[1], beaconBase[2])),
|
||||||
Material.IRON_BLOCK.getId(), (byte) 0, FLAG_COOLDOWN);
|
Material.IRON_BLOCK.getId(), (byte) 0, FLAG_COOLDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
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;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -110,7 +111,11 @@ public class MorphFrostGolem extends MorphGadget
|
|||||||
player.teleport(location.add(0, 1, 0));
|
player.teleport(location.add(0, 1, 0));
|
||||||
_ability.put(location.clone().add(0, 3, 0), System.currentTimeMillis());
|
_ability.put(location.clone().add(0, 3, 0), System.currentTimeMillis());
|
||||||
|
|
||||||
UtilBlock.getInRadius(location, RADIUS).forEach((block, scale) ->
|
Map<Block, Double> blocks = UtilBlock.getInRadius(location, RADIUS);
|
||||||
|
|
||||||
|
Manager.selectBlocks(this, blocks.keySet());
|
||||||
|
|
||||||
|
blocks.forEach((block, scale) ->
|
||||||
{
|
{
|
||||||
if (block.getType() != Material.AIR || block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
if (block.getType() != Material.AIR || block.getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ import java.time.YearMonth;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.LargeFireball;
|
import org.bukkit.entity.LargeFireball;
|
||||||
@ -148,12 +149,17 @@ public class MorphGhast extends MorphGadget
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player player : UtilPlayer.getNearby(event.getEntity().getLocation(), 5))
|
Location location = event.getEntity().getLocation();
|
||||||
|
|
||||||
|
for (Player player : UtilPlayer.getNearby(location, 5))
|
||||||
{
|
{
|
||||||
player.setVelocity(UP);
|
if (Manager.selectEntity(this, player))
|
||||||
|
{
|
||||||
|
player.setVelocity(UP);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UtilParticle.PlayParticleToAll(ParticleType.LAVA, event.getEntity().getLocation().add(0, 0.8, 0), 0.5F, 0.5F, 0.5F, 0.01F, 6, ViewDist.NORMAL);
|
UtilParticle.PlayParticleToAll(ParticleType.LAVA, location.add(0, 0.8, 0), 0.5F, 0.5F, 0.5F, 0.01F, 6, ViewDist.NORMAL);
|
||||||
event.getEntity().remove();
|
event.getEntity().remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,8 @@ public class MorphGoldPot extends MorphGadget
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onUpdate(UpdateEvent event)
|
public void onUpdate(UpdateEvent event)
|
||||||
{ for (GoldPotHelper goldPotHelper : _helpers.values())
|
{
|
||||||
|
for (GoldPotHelper goldPotHelper : _helpers.values())
|
||||||
{
|
{
|
||||||
boolean solid = goldPotHelper.updatePlayer(event.getType() == UpdateType.SEC, event.getType() == UpdateType.TICK);
|
boolean solid = goldPotHelper.updatePlayer(event.getType() == UpdateType.SEC, event.getType() == UpdateType.TICK);
|
||||||
if (solid)
|
if (solid)
|
||||||
|
@ -42,16 +42,16 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
public class MorphGrimReaper extends MorphGadget
|
public class MorphGrimReaper extends MorphGadget
|
||||||
{
|
{
|
||||||
|
|
||||||
private Map<Player, Long> _flying = new HashMap<>();
|
private final Map<Player, Long> _flying = new HashMap<>();
|
||||||
private List<Player> _flyReady = new ArrayList<>();
|
private final List<Player> _flyReady = new ArrayList<>();
|
||||||
|
|
||||||
private SoulManager _soulManager;
|
private final SoulManager _soulManager;
|
||||||
private ItemStack _hoe;
|
private ItemStack _hoe;
|
||||||
|
|
||||||
private static final int FLY_DELAY = 15000;
|
private static final int FLY_DELAY = 15000;
|
||||||
|
|
||||||
private ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN);
|
private final ShapeWings _wings = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.2,0.2,0.2), 1, 0, false, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN);
|
||||||
private ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN);
|
private final ShapeWings _wingsEdge = new ShapeWings(UtilParticle.ParticleType.RED_DUST.particleName, new Vector(0.1,0.1,0.1), 1, 0, true, ShapeWings.DEFAULT_ROTATION, ShapeWings.SMALL_ANGEL_WING_PATTERN);
|
||||||
|
|
||||||
public MorphGrimReaper(GadgetManager manager)
|
public MorphGrimReaper(GadgetManager manager)
|
||||||
{
|
{
|
||||||
@ -178,7 +178,8 @@ public class MorphGrimReaper extends MorphGadget
|
|||||||
setFlying(player, true, event.getType()==UpdateType.FAST);
|
setFlying(player, true, event.getType()==UpdateType.FAST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stopFlying.forEach(p -> _flying.remove(p));
|
|
||||||
|
stopFlying.forEach(_flying::remove);
|
||||||
|
|
||||||
if (event.getType() != UpdateType.SEC)
|
if (event.getType() != UpdateType.SEC)
|
||||||
return;
|
return;
|
||||||
|
@ -73,19 +73,12 @@ public class MorphLoveDoctor extends MorphGadget
|
|||||||
ignore.add(Material.AIR);
|
ignore.add(Material.AIR);
|
||||||
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
||||||
|
|
||||||
GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc);
|
if (!Manager.selectLocation(this, loc))
|
||||||
Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent);
|
|
||||||
|
|
||||||
// Checks to see if it's a valid location
|
|
||||||
if (gadgetSelectLocationEvent.isCancelled())
|
|
||||||
{
|
{
|
||||||
if (gadgetSelectLocationEvent.canShowMessage())
|
Manager.informNoUse(player);
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LoveDoctorEffect loveDoctorEffect = new LoveDoctorEffect(player, loc, this);
|
LoveDoctorEffect loveDoctorEffect = new LoveDoctorEffect(player, loc, this);
|
||||||
loveDoctorEffect.start();
|
loveDoctorEffect.start();
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,12 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import java.time.Month;
|
||||||
import mineplex.core.common.skin.SkinData;
|
import java.time.YearMonth;
|
||||||
import mineplex.core.common.util.C;
|
import java.util.ArrayList;
|
||||||
import mineplex.core.common.util.F;
|
import java.util.HashMap;
|
||||||
import mineplex.core.common.util.LineFormat;
|
import java.util.Map;
|
||||||
import mineplex.core.common.util.UtilFirework;
|
import java.util.UUID;
|
||||||
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;
|
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Color;
|
import org.bukkit.Color;
|
||||||
import org.bukkit.FireworkEffect;
|
import org.bukkit.FireworkEffect;
|
||||||
@ -24,13 +18,21 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.time.Month;
|
import com.mojang.authlib.GameProfile;
|
||||||
import java.time.YearMonth;
|
|
||||||
import java.util.ArrayList;
|
import mineplex.core.common.Pair;
|
||||||
import java.util.HashMap;
|
import mineplex.core.common.skin.SkinData;
|
||||||
import java.util.Map;
|
import mineplex.core.common.util.C;
|
||||||
import java.util.UUID;
|
import mineplex.core.common.util.F;
|
||||||
import java.util.concurrent.ThreadLocalRandom;
|
import mineplex.core.common.util.LineFormat;
|
||||||
|
import mineplex.core.common.util.UtilFirework;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PPC Reward for month of August 2017. Allows users to turn other player's heads into various fruits.
|
* PPC Reward for month of August 2017. Allows users to turn other player's heads into various fruits.
|
||||||
@ -39,13 +41,13 @@ public class MorphMelonHead extends MorphGadget
|
|||||||
{
|
{
|
||||||
/** Fruit head texture options */
|
/** Fruit head texture options */
|
||||||
private static final Pair[] TEXTURES = {
|
private static final Pair[] TEXTURES = {
|
||||||
Pair.of(SkinData.APPLE, C.cDRedB + "Apple Head"),
|
Pair.create(SkinData.APPLE, C.cDRedB + "Apple Head"),
|
||||||
Pair.of(SkinData.MELON, C.cDGreenB + "Melon Head"),
|
Pair.create(SkinData.MELON, C.cDGreenB + "Melon Head"),
|
||||||
Pair.of(SkinData.ORANGE, C.cGoldB + "Orange Head"),
|
Pair.create(SkinData.ORANGE, C.cGoldB + "Orange Head"),
|
||||||
Pair.of(SkinData.STRAWBERRY, C.cRedB + "Berry Head"),
|
Pair.create(SkinData.STRAWBERRY, C.cRedB + "Berry Head"),
|
||||||
Pair.of(SkinData.PINEAPPLE, C.cYellowB + "Pineapple Head"),
|
Pair.create(SkinData.PINEAPPLE, C.cYellowB + "Pineapple Head"),
|
||||||
Pair.of(SkinData.GREEN_APPLE, C.cGreenB + "Apple Head"),
|
Pair.create(SkinData.GREEN_APPLE, C.cGreenB + "Apple Head"),
|
||||||
Pair.of(SkinData.PLUM, C.cPurpleB + "Plum Head")
|
Pair.create(SkinData.PLUM, C.cPurpleB + "Plum Head")
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Ticks that a fruit head change lasts */
|
/** Ticks that a fruit head change lasts */
|
||||||
@ -122,7 +124,7 @@ public class MorphMelonHead extends MorphGadget
|
|||||||
}
|
}
|
||||||
|
|
||||||
// select a head skin and name it
|
// select a head skin and name it
|
||||||
Pair<SkinData, String> data = TEXTURES[ThreadLocalRandom.current().nextInt(TEXTURES.length)];
|
Pair<SkinData, String> data = UtilMath.randomElement(TEXTURES);
|
||||||
ItemStack head = data.getLeft().getSkull(data.getRight(), new ArrayList<>());
|
ItemStack head = data.getLeft().getSkull(data.getRight(), new ArrayList<>());
|
||||||
|
|
||||||
// equip the head and notify the player of the action
|
// equip the head and notify the player of the action
|
||||||
|
@ -122,17 +122,9 @@ public class MorphMetalMan extends MorphGadget
|
|||||||
ignore.add(Material.AIR);
|
ignore.add(Material.AIR);
|
||||||
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
||||||
|
|
||||||
GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc);
|
if (!Manager.selectLocation(this, loc))
|
||||||
Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent);
|
|
||||||
|
|
||||||
// Checks to see if it's a valid location
|
|
||||||
if (gadgetSelectLocationEvent.isCancelled())
|
|
||||||
{
|
{
|
||||||
if (gadgetSelectLocationEvent.canShowMessage())
|
Manager.informNoUse(player);
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseCat;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.types.MorphGadget;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
|
||||||
|
public class MorphOcelot extends MorphGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final PotionEffect POTION_EFFECT = new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 1, false, false);
|
||||||
|
|
||||||
|
public MorphOcelot(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Ocelot Morph", new String[]
|
||||||
|
{
|
||||||
|
C.cGray + "Meeeeeeeeeeoooooooowwwwww",
|
||||||
|
}, CostConstants.LEVEL_REWARDS, Material.MONSTER_EGG, UtilEnt.getEntityEggData(EntityType.OCELOT));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
applyArmor(player, message);
|
||||||
|
|
||||||
|
DisguiseCat disguise = new DisguiseCat(player);
|
||||||
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
|
|
||||||
|
player.addPotionEffect(POTION_EFFECT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
removeArmor(player);
|
||||||
|
|
||||||
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
player.removePotionEffect(PotionEffectType.SPEED);
|
||||||
|
}
|
||||||
|
}
|
@ -8,7 +8,6 @@ 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 org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -36,14 +35,14 @@ public class MorphPig extends MorphGadget
|
|||||||
public MorphPig(GadgetManager manager)
|
public MorphPig(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Pig Morph", UtilText.splitLinesToArray(new String[]
|
super(manager, "Pig Morph", UtilText.splitLinesToArray(new String[]
|
||||||
{
|
{
|
||||||
C.cGray + "Oink. Oink. Oink.... Oink?",
|
C.cGray + "Oink. Oink. Oink.... Oink?",
|
||||||
C.blankLine,
|
C.blankLine,
|
||||||
"#" + C.cWhite + "Left Click to use Oink",
|
"#" + C.cWhite + "Left Click to use Oink",
|
||||||
"#" + C.cWhite + "Collide to use Pig Bounce",
|
"#" + C.cWhite + "Collide to use Pig Bounce",
|
||||||
}, LineFormat.LORE),
|
}, LineFormat.LORE),
|
||||||
-10,
|
-10,
|
||||||
Material.PORK, (byte)0);
|
Material.PORK, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,6 +59,7 @@ public class MorphPig extends MorphGadget
|
|||||||
{
|
{
|
||||||
this.removeArmor(player);
|
this.removeArmor(player);
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
_double.remove(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@ -76,7 +76,7 @@ public class MorphPig extends MorphGadget
|
|||||||
if (!Recharge.Instance.use(player, getName(), 400, false, false, "Cosmetics"))
|
if (!Recharge.Instance.use(player, getName(), 400, false, false, "Cosmetics"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(0.75 + Math.random() * 0.5));
|
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float) (0.75 + Math.random() * 0.5));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,8 +135,10 @@ public class MorphPig extends MorphGadget
|
|||||||
if (UtilMath.offset(player, other) > range)
|
if (UtilMath.offset(player, other) > range)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Manager.collideEvent(player, this, other))
|
if (!Manager.selectEntity(this, other))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//Cooldown
|
//Cooldown
|
||||||
Recharge.Instance.useForce(other, getName() + " Collide", 200);
|
Recharge.Instance.useForce(other, getName() + " Collide", 200);
|
||||||
@ -164,19 +166,13 @@ public class MorphPig extends MorphGadget
|
|||||||
//Sound
|
//Sound
|
||||||
if (_double.contains(player))
|
if (_double.contains(player))
|
||||||
{
|
{
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.PIG_DEATH, (float)(0.8 + Math.random() * 0.4), (float)(0.8 + Math.random() * 0.4));
|
player.getWorld().playSound(player.getLocation(), Sound.PIG_DEATH, (float) (0.8 + Math.random() * 0.4), (float) (0.8 + Math.random() * 0.4));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float)(1.5 + Math.random() * 0.5));
|
player.getWorld().playSound(player.getLocation(), Sound.PIG_IDLE, 1f, (float) (1.5 + Math.random() * 0.5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void Clean(PlayerQuitEvent event)
|
|
||||||
{
|
|
||||||
_double.remove(event.getPlayer());
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -118,7 +118,7 @@ public class MorphPumpkinKing extends MorphGadget implements IPacketHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_bombs.removeIf(bomb -> bomb.update());
|
_bombs.removeIf(JackOBomb::update);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,8 +174,10 @@ public class MorphPumpkinKing extends MorphGadget implements IPacketHandler
|
|||||||
Map<Player, Double> players = UtilPlayer.getInRadius(_ent.getLocation(), 8);
|
Map<Player, Double> players = UtilPlayer.getInRadius(_ent.getLocation(), 8);
|
||||||
for (Player player : players.keySet())
|
for (Player player : players.keySet())
|
||||||
{
|
{
|
||||||
if (Manager.collideEvent(_user, MorphPumpkinKing.this, player))
|
if (!Manager.selectEntity(MorphPumpkinKing.this, player))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double mult = players.get(player);
|
double mult = players.get(player);
|
||||||
|
|
||||||
|
@ -0,0 +1,74 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Arrow;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
|
||||||
|
public class MorphSkeleton extends MorphAbilityGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final ItemStack ACTIVE_ITEM = new ItemBuilder(Material.BOW)
|
||||||
|
.setTitle(C.cGreenB + "Arrow Storm")
|
||||||
|
.addLore("Clicking this fires out lots of high powered arrows!")
|
||||||
|
.setUnbreakable(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public MorphSkeleton(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Skeleton Morph", new String[]
|
||||||
|
{
|
||||||
|
C.cGray + "I have a bone to pick with you",
|
||||||
|
C.blankLine,
|
||||||
|
C.cGreen + "Shoot" + C.cWhite + " your " + C.cYellow + "Bow" + C.cWhite + " to fire",
|
||||||
|
C.cGreen + "Arrow Storm"
|
||||||
|
}, CostConstants.FOUND_IN_TREASURE_CHESTS, Material.SKULL_ITEM, (byte) 0, ACTIVE_ITEM, "Arrow Storm", TimeUnit.SECONDS.toMillis(8));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
applyArmor(player, message);
|
||||||
|
|
||||||
|
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
|
||||||
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
removeArmor(player);
|
||||||
|
|
||||||
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onAbilityActivate(Player player)
|
||||||
|
{
|
||||||
|
Manager.runSyncTimer(new BukkitRunnable()
|
||||||
|
{
|
||||||
|
int arrows = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if (arrows++ == 10)
|
||||||
|
{
|
||||||
|
cancel();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.launchProjectile(Arrow.class);
|
||||||
|
}
|
||||||
|
}, 0, 2);
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
import java.util.WeakHashMap;
|
import java.util.WeakHashMap;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -37,21 +38,21 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
public class MorphSnowman extends MorphGadget
|
public class MorphSnowman extends MorphGadget
|
||||||
{
|
{
|
||||||
|
|
||||||
private WeakHashMap<Projectile, Player> _snowball = new WeakHashMap<Projectile, Player>();
|
private final Map<Projectile, Player> _snowball = new WeakHashMap<>();
|
||||||
|
|
||||||
public MorphSnowman(GadgetManager manager)
|
public MorphSnowman(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Olaf Morph",
|
super(manager, "Olaf Morph",
|
||||||
UtilText.splitLinesToArray(new String[]
|
UtilText.splitLinesToArray(new String[]
|
||||||
{
|
{
|
||||||
C.cGray + "Do you wanna build a snowman?",
|
C.cGray + "Do you wanna build a snowman?",
|
||||||
C.cGray + "It doesn't have to be a snowman...",
|
C.cGray + "It doesn't have to be a snowman...",
|
||||||
C.cGray + "Or... it kind of does...",
|
C.cGray + "Or... it kind of does...",
|
||||||
C.blankLine,
|
C.blankLine,
|
||||||
"#" + C.cWhite + "Left-Click to use Blizzard",
|
"#" + C.cWhite + "Left-Click to use Blizzard",
|
||||||
"#" + C.cWhite + "Sneak to use Snow Slide",
|
"#" + C.cWhite + "Sneak to use Snow Slide",
|
||||||
}, LineFormat.LORE),
|
}, LineFormat.LORE),
|
||||||
-3, Material.SNOW_BALL, (byte) 0);
|
-3, Material.SNOW_BALL, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -73,13 +74,13 @@ public class MorphSnowman extends MorphGadget
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInteract(PlayerInteractEvent event)
|
public void onInteract(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
if(!isActive(event.getPlayer())) return;
|
if (!isActive(event.getPlayer())) return;
|
||||||
|
|
||||||
if(!UtilEvent.isAction(event, ActionType.L)) return;
|
if (!UtilEvent.isAction(event, ActionType.L)) return;
|
||||||
|
|
||||||
if(event.getItem() != null && event.getItem().getType() != Material.AIR) return;
|
if (event.getItem() != null && event.getItem().getType() != Material.AIR) return;
|
||||||
|
|
||||||
if(Recharge.Instance.use(event.getPlayer(), "Blizzard", 12000, true, true))
|
if (Recharge.Instance.use(event.getPlayer(), "Blizzard", 12000, true, true))
|
||||||
{
|
{
|
||||||
event.getPlayer().sendMessage(F.main("Recharge", "You used " + F.skill("Blizzard") + "."));
|
event.getPlayer().sendMessage(F.main("Recharge", "You used " + F.skill("Blizzard") + "."));
|
||||||
}
|
}
|
||||||
@ -94,20 +95,20 @@ public class MorphSnowman extends MorphGadget
|
|||||||
for (Player player : getActive())
|
for (Player player : getActive())
|
||||||
{
|
{
|
||||||
NautHashMap<String, RechargeData> map = Recharge.Instance.Get(player);
|
NautHashMap<String, RechargeData> map = Recharge.Instance.Get(player);
|
||||||
if(map == null) continue;
|
if (map == null) continue;
|
||||||
|
|
||||||
RechargeData data = map.get("Blizzard");
|
RechargeData data = map.get("Blizzard");
|
||||||
if(data == null) continue;
|
if (data == null) continue;
|
||||||
if(data.GetRemaining() < 10000) continue;
|
if (data.GetRemaining() < 10000) continue;
|
||||||
|
|
||||||
for (int i=0 ; i<4 ; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class);
|
Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class);
|
||||||
double x = 0.1 - (UtilMath.r(20)/100d);
|
double x = 0.1 - (UtilMath.r(20) / 100d);
|
||||||
double y = UtilMath.r(20)/100d;
|
double y = UtilMath.r(20) / 100d;
|
||||||
double z = 0.1 - (UtilMath.r(20)/100d);
|
double z = 0.1 - (UtilMath.r(20) / 100d);
|
||||||
snow.setShooter(player);
|
snow.setShooter(player);
|
||||||
snow.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
|
snow.setVelocity(player.getLocation().getDirection().add(new Vector(x, y, z)).multiply(2));
|
||||||
_snowball.put(snow, player);
|
_snowball.put(snow, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,11 +117,11 @@ public class MorphSnowman extends MorphGadget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
{
|
{
|
||||||
for (Player player : getActive())
|
for (Player player : getActive())
|
||||||
{
|
{
|
||||||
if(player.isSneaking() && UtilEnt.isGrounded(player))
|
if (player.isSneaking() && UtilEnt.isGrounded(player))
|
||||||
{
|
{
|
||||||
player.setVelocity(player.getLocation().getDirection().setY(0).normalize());
|
player.setVelocity(player.getLocation().getDirection().setY(0).normalize());
|
||||||
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation(), 0.3f, 0.1f, 0.3f, 0, 10, ViewDist.NORMAL);
|
UtilParticle.PlayParticle(ParticleType.SNOW_SHOVEL, player.getLocation(), 0.3f, 0.1f, 0.3f, 0, 10, ViewDist.NORMAL);
|
||||||
@ -138,10 +139,10 @@ public class MorphSnowman extends MorphGadget
|
|||||||
|
|
||||||
Snowball proj = (Snowball) event.getDamager();
|
Snowball proj = (Snowball) event.getDamager();
|
||||||
|
|
||||||
if (!_snowball.containsKey(proj))
|
if (_snowball.remove(proj) == null || Manager.selectEntity(this, event.getEntity()))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if(Manager.collideEvent(_snowball.remove(proj), this, event.getEntity())) return;
|
|
||||||
|
|
||||||
UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
|
UtilAction.velocity(event.getEntity(), proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
|
||||||
}
|
}
|
||||||
|
@ -1,128 +0,0 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Arrow;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|
||||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.LineFormat;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilText;
|
|
||||||
import mineplex.core.disguise.disguises.DisguiseSquid;
|
|
||||||
import mineplex.core.gadget.GadgetManager;
|
|
||||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
|
||||||
import mineplex.core.gadget.types.MorphGadget;
|
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* THIS MORPH IS 1.9+ ONLY
|
|
||||||
*/
|
|
||||||
public class MorphStray extends MorphGadget
|
|
||||||
{
|
|
||||||
|
|
||||||
private List<Arrow> _strayArrows = new ArrayList<>();
|
|
||||||
private ItemStack _arrow;
|
|
||||||
|
|
||||||
public MorphStray(GadgetManager manager)
|
|
||||||
{
|
|
||||||
super(manager, "Stray Morph", UtilText.splitLinesToArray(new String[]{
|
|
||||||
C.cGray + "Even though it's a stray your mom probably won't let you keep this puppy.",
|
|
||||||
"",
|
|
||||||
C.cWhite + "Gains an arrow every 5 seconds with EXTREME knockback."
|
|
||||||
}, LineFormat.LORE),
|
|
||||||
0, Material.BARRIER, (byte) 0);
|
|
||||||
_arrow = ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte) 0, 1, C.cGreen + "Stray Arrow", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void enableCustom(Player player, boolean message)
|
|
||||||
{
|
|
||||||
// TODO CHECK IF LOBBY IS 1.9+
|
|
||||||
applyArmor(player, message);
|
|
||||||
DisguiseSquid disguiseSquid = new DisguiseSquid(player);
|
|
||||||
UtilMorph.disguise(player, disguiseSquid, Manager);
|
|
||||||
|
|
||||||
// Gives bow and arrow
|
|
||||||
ItemStack bow = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte) 0, 1, C.cGreen + "Stray Bow", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE));
|
|
||||||
player.getInventory().setItem(2, bow);
|
|
||||||
player.getInventory().setItem(17, _arrow);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void disableCustom(Player player, boolean message)
|
|
||||||
{
|
|
||||||
removeArmor(player);
|
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
|
||||||
|
|
||||||
// Removes bow and arrow
|
|
||||||
player.getInventory().setItem(2, new ItemStack(Material.AIR));
|
|
||||||
player.getInventory().setItem(17, new ItemStack(Material.AIR));
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onShoot(EntityShootBowEvent event)
|
|
||||||
{
|
|
||||||
if (!(event.getEntity() instanceof Player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(event.getProjectile() instanceof Arrow))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
|
|
||||||
if (!isActive(player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_strayArrows.add((Arrow) event.getProjectile());
|
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
player.getInventory().setItem(17, _arrow);
|
|
||||||
}
|
|
||||||
}, 3 * 20L);
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onArrowHitPlayer(EntityDamageByEntityEvent event)
|
|
||||||
{
|
|
||||||
if (!(event.getDamager() instanceof Arrow))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(event.getEntity() instanceof Player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!(((Arrow) event.getDamager()).getShooter() instanceof Player))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Arrow arrow = (Arrow) event.getDamager();
|
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
|
|
||||||
if (!_strayArrows.contains(arrow))
|
|
||||||
return;
|
|
||||||
|
|
||||||
_strayArrows.remove(arrow);
|
|
||||||
|
|
||||||
Player shooter = (Player) arrow.getShooter();
|
|
||||||
arrow.remove();
|
|
||||||
|
|
||||||
if (shooter.getUniqueId().equals(player.getUniqueId()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
player.setVelocity(player.getVelocity().multiply(-15).setY(15));
|
|
||||||
UtilPlayer.message(player, F.main("Stray Arrow", "You were hit with a " + F.greenElem("Stray Arrow") + " from " + F.name(shooter.getName()) + " and got knocked back!"));
|
|
||||||
UtilPlayer.message(shooter, F.main("Stray Arrow", "You hit " + F.name(player.getName()) + " with the " + F.greenElem("Stray Arrow") + " and they got knocked back!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -3,8 +3,8 @@ package mineplex.core.gadget.gadgets.morph;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -17,7 +17,6 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
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.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
@ -33,7 +32,6 @@ 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.gadgets.morph.managers.UtilMorph;
|
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;
|
||||||
@ -43,7 +41,8 @@ import mineplex.core.updater.event.UpdateEvent;
|
|||||||
|
|
||||||
public class MorphTitan extends MorphGadget
|
public class MorphTitan extends MorphGadget
|
||||||
{
|
{
|
||||||
private HashMap<Player, ArmorStand> _targets = new HashMap<Player, ArmorStand>();
|
|
||||||
|
private final Map<Player, ArmorStand> _targets = new HashMap<>();
|
||||||
|
|
||||||
public MorphTitan(GadgetManager manager)
|
public MorphTitan(GadgetManager manager)
|
||||||
{
|
{
|
||||||
@ -106,16 +105,9 @@ public class MorphTitan extends MorphGadget
|
|||||||
|
|
||||||
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5);
|
||||||
|
|
||||||
GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc);
|
if (!Manager.selectLocation(this, loc))
|
||||||
Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent);
|
|
||||||
|
|
||||||
if (gadgetSelectLocationEvent.isCancelled())
|
|
||||||
{
|
{
|
||||||
if (gadgetSelectLocationEvent.canShowMessage())
|
Manager.informNoUse(player);
|
||||||
{
|
|
||||||
UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,9 +144,10 @@ public class MorphTitan extends MorphGadget
|
|||||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(stand.getLocation(), 12d);
|
HashMap<Player, Double> players = UtilPlayer.getInRadius(stand.getLocation(), 12d);
|
||||||
for (Player ent : players.keySet())
|
for (Player ent : players.keySet())
|
||||||
{
|
{
|
||||||
if (ent instanceof Player)
|
if (!Manager.selectEntity(this, ent))
|
||||||
if (Manager.collideEvent(event.GetPlayer(), this, (Player)ent))
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double mult = players.get(ent);
|
double mult = players.get(ent);
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets.morph;
|
|||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.EntityEffect;
|
import org.bukkit.EntityEffect;
|
||||||
@ -38,7 +39,8 @@ 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 final Set<Item> _gems = new HashSet<>();
|
||||||
|
|
||||||
public MorphVillager(GadgetManager manager)
|
public MorphVillager(GadgetManager manager)
|
||||||
{
|
{
|
||||||
@ -110,12 +112,10 @@ public class MorphVillager extends MorphGadget implements IThrown
|
|||||||
@Override
|
@Override
|
||||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||||
{
|
{
|
||||||
if (target == null)
|
if (target == null || !Manager.selectEntity(this, target))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (target instanceof Player)
|
|
||||||
if (Manager.collideEvent((Player) data.getThrower(), this, (Player) target))
|
|
||||||
return;
|
|
||||||
|
|
||||||
//Pull
|
//Pull
|
||||||
UtilAction.velocity(target,
|
UtilAction.velocity(target,
|
||||||
|
@ -3,13 +3,11 @@ package mineplex.core.gadget.gadgets.morph;
|
|||||||
import java.time.Month;
|
import java.time.Month;
|
||||||
import java.time.YearMonth;
|
import java.time.YearMonth;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
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;
|
||||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import mineplex.core.common.skin.SkinData;
|
import mineplex.core.common.skin.SkinData;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
@ -19,7 +17,6 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
import mineplex.core.common.util.UtilText;
|
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.gadgets.morph.managers.UtilMorph;
|
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;
|
||||||
@ -60,11 +57,6 @@ public class MorphWitch extends MorphGadget
|
|||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getWitchItem()
|
|
||||||
{
|
|
||||||
return SkinData.WITCH.getSkull();
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onSneak(PlayerToggleSneakEvent event)
|
public void onSneak(PlayerToggleSneakEvent event)
|
||||||
{
|
{
|
||||||
@ -102,24 +94,6 @@ public class MorphWitch extends MorphGadget
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Checks if player is opening a treasure chest/close to a treasure area
|
|
||||||
// if (Manager.getTreasureManager() != null)
|
|
||||||
// {
|
|
||||||
// if (Manager.getTreasureManager().isOpening(event.getPlayer()))
|
|
||||||
// {
|
|
||||||
// UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// for (Location blockLocation : Manager.getTreasureManager().getBlockLocations())
|
|
||||||
// {
|
|
||||||
// if (blockLocation.distanceSquared(cauldronLocation) <= 25)
|
|
||||||
// {
|
|
||||||
// UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Checks if the player is close to a cactus
|
// Checks if the player is close to a cactus
|
||||||
for (int x = -3; x < 3; x++)
|
for (int x = -3; x < 3; x++)
|
||||||
{
|
{
|
||||||
@ -134,14 +108,9 @@ public class MorphWitch extends MorphGadget
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks if the player is in a Soccer area
|
if (!Manager.selectLocation(this, cauldronLocation))
|
||||||
GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(event.getPlayer(), this, cauldronLocation.clone().subtract(0, 1, 0));
|
|
||||||
gadgetSelectLocationEvent.setShowMessage(true);
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent);
|
|
||||||
|
|
||||||
if (gadgetSelectLocationEvent.isCancelled())
|
|
||||||
{
|
{
|
||||||
UtilPlayer.message(event.getPlayer(), F.main("Witch Morph", "You can't place the cauldron there!"));
|
Manager.informNoUse(event.getPlayer());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,8 +136,10 @@ public class MorphWither extends MorphGadget
|
|||||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 6);
|
HashMap<Player, Double> players = UtilPlayer.getInRadius(event.getLocation(), 6);
|
||||||
for (Player player : players.keySet())
|
for (Player player : players.keySet())
|
||||||
{
|
{
|
||||||
if (Manager.collideEvent((Player) skull.getShooter(), this, player))
|
if (!Manager.selectEntity(this, player))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double mult = players.get(player);
|
double mult = players.get(player);
|
||||||
|
|
||||||
|
@ -0,0 +1,81 @@
|
|||||||
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
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 org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
|
import mineplex.core.disguise.disguises.DisguiseWolf;
|
||||||
|
import mineplex.core.gadget.GadgetManager;
|
||||||
|
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||||
|
import mineplex.core.gadget.util.CostConstants;
|
||||||
|
import mineplex.core.itemstack.ItemBuilder;
|
||||||
|
import mineplex.core.recharge.Recharge;
|
||||||
|
|
||||||
|
public class MorphWolf extends MorphAbilityGadget
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final ItemStack ACTIVE_ITEM = new ItemBuilder(Material.BONE)
|
||||||
|
.setTitle(C.cGreenB + "Pounce")
|
||||||
|
.addLore("Clicking this causes you to pounce.")
|
||||||
|
.setUnbreakable(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public MorphWolf(GadgetManager manager)
|
||||||
|
{
|
||||||
|
super(manager, "Wolf Morph", new String[]
|
||||||
|
{
|
||||||
|
C.cGray + "Arf",
|
||||||
|
C.blankLine,
|
||||||
|
C.cGreen + "Click" + C.cWhite + " your " + C.cYellow + "Bone" + C.cWhite + " to " + C.cGreen + "Pounce"
|
||||||
|
}, CostConstants.LEVEL_REWARDS, Material.BONE, (byte) 0, ACTIVE_ITEM, "Pounce", TimeUnit.SECONDS.toMillis(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
applyArmor(player, message);
|
||||||
|
|
||||||
|
DisguiseWolf disguise = new DisguiseWolf(player);
|
||||||
|
UtilMorph.disguise(player, disguise, Manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableCustom(Player player, boolean message)
|
||||||
|
{
|
||||||
|
removeArmor(player);
|
||||||
|
|
||||||
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAbilityActivate(Player player)
|
||||||
|
{
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 1, 0.8F);
|
||||||
|
UtilAction.velocity(player, 1.6, 0.2, 1, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void playerSneak(PlayerToggleSneakEvent event)
|
||||||
|
{
|
||||||
|
if (!event.isSneaking())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
|
if (!isActive(player) || !Recharge.Instance.use(player, "Wolf Howl", 8000, true, false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.getWorld().playSound(player.getLocation(), Sound.WOLF_HOWL, 1, (float) (0.4 + Math.random() / 2));
|
||||||
|
}
|
||||||
|
}
|
@ -35,7 +35,7 @@ public class WitchEffectManager
|
|||||||
_location.getBlock().setType(Material.CAULDRON);
|
_location.getBlock().setType(Material.CAULDRON);
|
||||||
_location.getBlock().setData((byte) 3);
|
_location.getBlock().setData((byte) 3);
|
||||||
|
|
||||||
_location.getWorld().strikeLightning(_location);
|
_location.getWorld().strikeLightningEffect(_location);
|
||||||
Bat bat = _location.getWorld().spawn(_location.clone().add(0, 1, 0), Bat.class);
|
Bat bat = _location.getWorld().spawn(_location.clone().add(0, 1, 0), Bat.class);
|
||||||
bat.setCustomName(_player.getName() + "'s Magical Bat");
|
bat.setCustomName(_player.getName() + "'s Magical Bat");
|
||||||
bat.setCustomNameVisible(true);
|
bat.setCustomNameVisible(true);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph.managers;
|
package mineplex.core.gadget.gadgets.morph.managers;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
@ -22,7 +21,6 @@ import mineplex.core.disguise.disguises.DisguiseBlock;
|
|||||||
import mineplex.core.disguise.disguises.DisguiseCat;
|
import mineplex.core.disguise.disguises.DisguiseCat;
|
||||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
import mineplex.core.gadget.event.GadgetBlockEvent;
|
|
||||||
import mineplex.core.gadget.types.Gadget;
|
import mineplex.core.gadget.types.Gadget;
|
||||||
import mineplex.core.recharge.Recharge;
|
import mineplex.core.recharge.Recharge;
|
||||||
|
|
||||||
@ -34,9 +32,9 @@ public class GoldPotHelper
|
|||||||
private static final int SHARDS = 250;
|
private static final int SHARDS = 250;
|
||||||
private static final int GEMS = 60;
|
private static final int GEMS = 60;
|
||||||
|
|
||||||
private Player _player;
|
private final Player _player;
|
||||||
private GadgetManager _manager;
|
private final GadgetManager _manager;
|
||||||
private Gadget _gadget;
|
private final Gadget _gadget;
|
||||||
private GoldPotStands _goldPotStands;
|
private GoldPotStands _goldPotStands;
|
||||||
private Block _block;
|
private Block _block;
|
||||||
private boolean _solid = false;
|
private boolean _solid = false;
|
||||||
@ -59,13 +57,9 @@ public class GoldPotHelper
|
|||||||
|
|
||||||
Block block = _player.getLocation().getBlock();
|
Block block = _player.getLocation().getBlock();
|
||||||
|
|
||||||
GadgetBlockEvent event = new GadgetBlockEvent(_gadget, Collections.singletonList(block));
|
if (!_manager.selectBlocks(_gadget, block) || block.getType() != Material.AIR)
|
||||||
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled() || block.getType() != Material.AIR)
|
|
||||||
{
|
{
|
||||||
UtilPlayer.message(_player, F.main("Morph", "You cannot become a gold pot here!"));
|
_manager.informNoUse(_player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,6 +188,11 @@ public class MorphAnath extends MorphGadget
|
|||||||
block = block.getRelative(BlockFace.DOWN);
|
block = block.getRelative(BlockFace.DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Manager.selectBlocks(this, block))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
Block fBlock = block;
|
Block fBlock = block;
|
||||||
Manager.runSyncLater(() -> Manager.getBlockRestore().add(fBlock.getRelative(BlockFace.UP), Material.FIRE.getId(), (byte) 0, 5000), 10);
|
Manager.runSyncLater(() -> Manager.getBlockRestore().add(fBlock.getRelative(BlockFace.UP), Material.FIRE.getId(), (byte) 0, 5000), 10);
|
||||||
return false;
|
return false;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user