This commit is contained in:
Brianna O'Keefe 2018-07-18 13:27:00 -04:00
parent 82183a144a
commit 70809423bf
11 changed files with 38 additions and 111 deletions

View File

@ -42,9 +42,6 @@ public class UltimateKits extends JavaPlugin {
public HologramHandler holo;
private SettingsManager settingsManager;
public boolean v1_7 = Bukkit.getServer().getClass().getPackage().getName().contains("1_7");
public boolean v1_8 = Bukkit.getServer().getClass().getPackage().getName().contains("1_8");
private static UltimateKits INSTANCE;
public DisplayItemHandler displayitem;
@ -112,7 +109,7 @@ public class UltimateKits extends JavaPlugin {
getServer().getPluginManager().registerEvents(new BlockListeners(this), this);
getServer().getPluginManager().registerEvents(new ChatListeners(this), this);
if (!v1_7) getServer().getPluginManager().registerEvents(new EntityListeners(this), this);
getServer().getPluginManager().registerEvents(new EntityListeners(this), this);
getServer().getPluginManager().registerEvents(new InteractListeners(this), this);
getServer().getPluginManager().registerEvents(new InventoryListeners(this), this);
getServer().getPluginManager().registerEvents(new QuitListeners(this), this);

View File

@ -10,9 +10,9 @@ import java.util.Set;
public class DefaultHook implements Hook {
public enum Kits {
TOOLS(10, "STONE_PICKAXE 1", "STONE_AXE 1", "STONE_SPADE 1", "STONE_HOE 1"),
BETTER_TOOLS(300, "DIAMOND_PICKAXE 1 DIG_SPEED:5 DURABILITY:2", "DIAMOND_AXE 1 DIG_SPEED:2 DURABILITY:2", "DIAMOND_SPADE 1 DIG_SPEED:1", "DIAMOND_HOE 1 DURABILITY:3"),
BRIANNA(0, "SKULL_ITEM:3 1 player:Songoda");
TOOLS(10, "STONE_PICKAXE 1", "STONE_AXE 1", "STONE_SHOVEL 1", "STONE_HOE 1"),
BETTER_TOOLS(300, "DIAMOND_PICKAXE 1 DIG_SPEED:5 DURABILITY:2", "DIAMOND_AXE 1 DIG_SPEED:2 DURABILITY:2", "DIAMOND_SHOVEL 1 DIG_SPEED:1", "DIAMOND_HOE 1 DURABILITY:3"),
BRIANNA(0, "PLAYER_HEAD:3 1 player:Songoda");
public String[] items;
public int delay;

View File

@ -29,11 +29,9 @@ public class InteractListeners implements Listener {
public void onBlockInteract(PlayerInteractEvent e) {
try {
boolean chand = true; // This needs to be out of my code.
if (!UltimateKits.getInstance().v1_7 && !UltimateKits.getInstance().v1_8) {
if (e.getHand() != EquipmentSlot.HAND) {
chand = false;
}
}
Block b = e.getClickedBlock();

View File

@ -34,7 +34,6 @@ public class HologramHandler {
public void updateHolograms() {
try {
if (instance.v1_7) return;
Map<Location, KitBlockData> kitBlocks = instance.getKitManager().getKitLocations();
for (KitBlockData kitBlockData : kitBlocks.values()) {
@ -126,7 +125,7 @@ public class HologramHandler {
public void remove(Location location) {
for (Entity e : Methods.getNearbyEntities(location, 1, 50, 1)) {
for (Entity e : location.getWorld().getNearbyEntities(location, 1, 50, 1)) {
if (e.getType().equals(EntityType.ARMOR_STAND))
Arconix.pl().getApi().packetLibrary.getHologramManager().despawnHologram(e.getLocation());
}

View File

@ -34,13 +34,7 @@ public class ParticleHandler {
Location location = kitBlockData.getLocation();
location.add(.5, 0, .5);
if (instance.v1_8 || instance.v1_7) {
//Could not manage to get the original message to resolve, so I am doing this. --Nova
location.getWorld().playEffect(location, Effect.valueOf(type), 1, 0);
//location.getWorld().spigot.playEffect(location, org.bukkit.Effect.valueOf(type), 1, 0, (float) 0.25, (float) 0.25, (float) 0.25, 1, amt, 100);
} else {
location.getWorld().spawnParticle(org.bukkit.Particle.valueOf(type), location, amt, 0.25, 0.25, 0.25);
}
}
} catch (Exception ex) {
@ -55,11 +49,7 @@ public class ParticleHandler {
instance.saveConfig();
}
if (instance.getConfig().getString("data.particlesettings.type") != null) return;
if (instance.v1_7 || instance.v1_8) {
instance.getConfig().set("data.particlesettings.type", "WITCH_MAGIC");
} else {
instance.getConfig().set("data.particlesettings.type", "SPELL_WITCH");
}
instance.saveConfig();
} catch (Exception ex) {
Debugger.runReport(ex);

View File

@ -70,7 +70,7 @@ public class BlockEditor {
exit.setItemMeta(exitmeta);
i.setItem(8, exit);
ItemStack alli = new ItemStack(Material.REDSTONE_COMPARATOR);
ItemStack alli = new ItemStack(Material.COMPARATOR);
ItemMeta allmeta = alli.getItemMeta();
allmeta.setDisplayName(Arconix.pl().getApi().format().formatText("&5&lSwitch kit type"));
ArrayList<String> lore = new ArrayList<>();
@ -95,7 +95,7 @@ public class BlockEditor {
i.setItem(11, alli);
alli = new ItemStack(Material.RED_ROSE);
alli = new ItemStack(Material.POPPY);
allmeta = alli.getItemMeta();
allmeta.setDisplayName(Arconix.pl().getApi().format().formatText("&9&lDecor Options"));
lore = new ArrayList<>();
@ -158,7 +158,7 @@ public class BlockEditor {
exit.setItemMeta(exitmeta);
ItemStack head2 = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
ItemStack head2 = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
ItemStack back = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta skull2Meta = (SkullMeta) back.getItemMeta();
back.setDurability((short) 3);

View File

@ -46,13 +46,10 @@ public class KitEditor {
exitmeta.setDisplayName(Lang.EXIT.getConfigValue());
exit.setItemMeta(exitmeta);
ItemStack head2 = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
ItemStack head2 = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
ItemStack back = head2;
if (!instance.v1_7)
back = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta skull2Meta = (SkullMeta) back.getItemMeta();
if (instance.v1_7)
skull2Meta.setOwner("MHF_ArrowLeft");
back.setDurability((short) 3);
skull2Meta.setDisplayName(Lang.BACK.getConfigValue());
back.setItemMeta(skull2Meta);
@ -67,7 +64,7 @@ public class KitEditor {
itmeta.setLore(lore);
it.setItemMeta(itmeta);
ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short) 7);
ItemStack glass = new ItemStack(Material.GRAY_STAINED_GLASS_PANE, 1);
ItemMeta glassmeta = glass.getItemMeta();
glassmeta.setDisplayName(Arconix.pl().getApi().format().formatText("&" + playerData.getKit().getName().replaceAll(".(?!$)", "$0&")));
glass.setItemMeta(glassmeta);
@ -190,7 +187,7 @@ public class KitEditor {
playerData.setInInventory(false);
player.getInventory().clear();
ItemStack alli = new ItemStack(Material.REDSTONE_TORCH_ON, 1);
ItemStack alli = new ItemStack(Material.REDSTONE_TORCH, 1);
ItemMeta allmeta = alli.getItemMeta();
allmeta.setDisplayName(Arconix.pl().getApi().format().formatText("&6General Options"));
List<String> lore = new ArrayList<>();
@ -234,7 +231,7 @@ public class KitEditor {
player.getInventory().setItem(13, alli);
alli = new ItemStack(Material.DOUBLE_PLANT, 1);
alli = new ItemStack(Material.SUNFLOWER, 1);
allmeta = alli.getItemMeta();
allmeta.setDisplayName(Arconix.pl().getApi().format().formatText("&6Add Economy"));
lore = new ArrayList<>();
@ -287,13 +284,10 @@ public class KitEditor {
exitmeta.setDisplayName(Lang.EXIT.getConfigValue());
exit.setItemMeta(exitmeta);
ItemStack head2 = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
ItemStack head2 = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
ItemStack back = head2;
if (!instance.v1_7)
back = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta skull2Meta = (SkullMeta) back.getItemMeta();
if (instance.v1_7)
skull2Meta.setOwner("MHF_ArrowLeft");
back.setDurability((short) 3);
skull2Meta.setDisplayName(Lang.BACK.getConfigValue());
back.setItemMeta(skull2Meta);
@ -395,13 +389,10 @@ public class KitEditor {
exitmeta.setDisplayName(Lang.EXIT.getConfigValue());
exit.setItemMeta(exitmeta);
ItemStack head2 = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
ItemStack head2 = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
ItemStack back = head2;
if (!instance.v1_7)
back = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta skull2Meta = (SkullMeta) back.getItemMeta();
if (instance.v1_7)
skull2Meta.setOwner("MHF_ArrowLeft");
back.setDurability((short) 3);
skull2Meta.setDisplayName(Lang.BACK.getConfigValue());
back.setItemMeta(skull2Meta);
@ -511,13 +502,10 @@ public class KitEditor {
exitmeta.setDisplayName(Lang.EXIT.getConfigValue());
exit.setItemMeta(exitmeta);
ItemStack head2 = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
ItemStack head2 = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
ItemStack back = head2;
if (!instance.v1_7)
back = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta skull2Meta = (SkullMeta) back.getItemMeta();
if (instance.v1_7)
skull2Meta.setOwner("MHF_ArrowLeft");
back.setDurability((short) 3);
skull2Meta.setDisplayName(Lang.BACK.getConfigValue());
back.setItemMeta(skull2Meta);
@ -546,7 +534,7 @@ public class KitEditor {
/*i.setItem(11, alli);*/
alli = new ItemStack(Material.WATCH);
alli = new ItemStack(Material.CLOCK);
allmeta = alli.getItemMeta();
allmeta.setDisplayName(Arconix.pl().getApi().format().formatText("&9&lChange Delay"));
lore = new ArrayList<>();

View File

@ -201,24 +201,16 @@ public class KitsGUI {
infometa.setLore(lore);
info.setItemMeta(infometa);
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
ItemStack skull = head;
if (!UltimateKits.getInstance().v1_7)
skull = Arconix.pl().getApi().getGUI().addTexture(head, "http://textures.minecraft.net/texture/1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
ItemStack skull = Arconix.pl().getApi().getGUI().addTexture(head, "http://textures.minecraft.net/texture/1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b");
SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
if (UltimateKits.getInstance().v1_7)
skullMeta.setOwner("MHF_ArrowRight");
skull.setDurability((short) 3);
skullMeta.setDisplayName(Lang.NEXT.getConfigValue());
skull.setItemMeta(skullMeta);
ItemStack head2 = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
ItemStack skull2 = head2;
if (!UltimateKits.getInstance().v1_7)
skull2 = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
ItemStack head2 = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
ItemStack skull2 = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta skull2Meta = (SkullMeta) skull2.getItemMeta();
if (UltimateKits.getInstance().v1_7)
skull2Meta.setOwner("MHF_ArrowLeft");
skull2.setDurability((short) 3);
skull2Meta.setDisplayName(Lang.LAST.getConfigValue());
skull2.setItemMeta(skull2Meta);

View File

@ -124,11 +124,7 @@ public class Kit {
return;
}
if (UltimateKits.getInstance().getConfig().getBoolean("Main.Sounds Enabled")) {
if (!UltimateKits.getInstance().v1_8 && !UltimateKits.getInstance().v1_7) {
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 0.6F, 15.0F);
} else {
p.playSound(p.getLocation(), Sound.valueOf("LEVEL_UP"), 2F, 15.0F);
}
p.playSound(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 0.6F, 15.0F);
}
if (useKey) {
if (p.getItemInHand().getType() != Material.TRIPWIRE_HOOK || !p.getItemInHand().hasItemMeta()) {
@ -350,13 +346,10 @@ public class Kit {
if (back && !UltimateKits.getInstance().getConfig().getBoolean("Interfaces.Do Not Use Glass Borders")) {
ItemStack head2 = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
ItemStack skull2 = head2;
if (!UltimateKits.getInstance().v1_7)
skull2 = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
ItemStack head2 = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
ItemStack skull2 = Arconix.pl().getApi().getGUI().addTexture(head2, "http://textures.minecraft.net/texture/3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23");
SkullMeta skull2Meta = (SkullMeta) skull2.getItemMeta();
if (UltimateKits.getInstance().v1_7)
skull2Meta.setOwner("MHF_ArrowLeft");
skull2Meta.setOwner("MHF_ArrowLeft");
skull2.setDurability((short) 3);
skull2Meta.setDisplayName(Lang.BACK.getConfigValue());
skull2.setItemMeta(skull2Meta);

View File

@ -62,24 +62,6 @@ public class Methods {
return UltimateKits.getInstance().getKitFile().getConfig().contains("Kits." + kit);
}
public static Collection<Entity> getNearbyEntities(Location location, double x, double y, double z) {
if (!UltimateKits.getInstance().v1_7) return location.getWorld().getNearbyEntities(location, x, y, z);
if (location == null) return Collections.emptyList();
World world = location.getWorld();
net.minecraft.server.v1_7_R4.AxisAlignedBB aabb = net.minecraft.server.v1_7_R4.AxisAlignedBB
.a(location.getX() - x, location.getY() - y, location.getZ() - z, location.getX() + x, location.getY() + y, location.getZ() + z);
List<net.minecraft.server.v1_7_R4.Entity> entityList = ((org.bukkit.craftbukkit.v1_7_R4.CraftWorld) world).getHandle().getEntities(null, aabb, null);
List<Entity> bukkitEntityList = new ArrayList<>();
for (Object entity : entityList) {
bukkitEntityList.add(((net.minecraft.server.v1_7_R4.Entity) entity).getBukkitEntity());
}
return bukkitEntityList;
}
public static boolean pay(Player p, double amount) {
if (UltimateKits.getInstance().getServer().getPluginManager().getPlugin("Vault") == null) return false;
RegisteredServiceProvider<Economy> rsp = UltimateKits.getInstance().getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
@ -162,7 +144,7 @@ public class Methods {
str.append(e.getName().toLowerCase()).append(":").append(enchantmentStorageMeta.getStoredEnchantLevel(e)).append(" ");
}
break;
case FIREWORK:
case FIREWORK_ROCKET:
FireworkMeta fireworkMeta = (FireworkMeta) item.getItemMeta();
if (fireworkMeta.hasEffects()) {
for (FireworkEffect effect : fireworkMeta.getEffects()) {
@ -198,7 +180,6 @@ public class Methods {
break;
case POTION:
PotionMeta potion = ((PotionMeta) item.getItemMeta());
if (!UltimateKits.getInstance().v1_8 && !UltimateKits.getInstance().v1_7) {
if (potion.hasColor()) {
str.append("color:").append(potion.getColor().asRGB()).append(" ");
}
@ -208,9 +189,8 @@ public class Methods {
PotionEffectType e = potion.getBasePotionData().getType().getEffectType();
str.append("effect:").append(e.getName().toLowerCase()).append(" ").append("duration:").append(e.getDurationModifier()).append(" ");
}
}
break;
case SKULL_ITEM:
case PLAYER_HEAD:
SkullMeta skullMeta = (SkullMeta) item.getItemMeta();
if (skullMeta != null && skullMeta.hasOwner()) {
str.append("player:").append(skullMeta.getOwner()).append(" ");
@ -224,7 +204,7 @@ public class Methods {
int rgb = leatherArmorMeta.getColor().asRGB();
str.append("color:").append(rgb).append(" ");
break;
case BANNER:
case LEGACY_BANNER: //ToDO: shouldnt be done like this, but i dont have time to do this corecctly.
BannerMeta bannerMeta = (BannerMeta) item.getItemMeta();
if (bannerMeta != null) {
int basecolor = bannerMeta.getBaseColor().getColor().asRGB();
@ -256,15 +236,10 @@ public class Methods {
String[] splited = string.split("\\s+");
String[] val = splited[0].split(":");
ItemStack item;
if (Arconix.pl().getApi().doMath().isNumeric(val[0])) {
item = new ItemStack(Integer.parseInt(val[0]));
} else {
item = new ItemStack(Material.valueOf(val[0]));
}
ItemStack item = new ItemStack(Material.valueOf(val[0]));
if (item.getType() == Material.SKULL_ITEM) {
item = new ItemStack(Material.SKULL_ITEM, 1, (byte) 3);
if (item.getType() == Material.PLAYER_HEAD) {
item = new ItemStack(Material.PLAYER_HEAD, 1, (byte) 3);
}
ItemMeta meta = item.getItemMeta();
@ -313,7 +288,7 @@ public class Methods {
meta.setLore(lore);
break;
case "player":
if (item.getType() == Material.SKULL_ITEM) {
if (item.getType() == Material.PLAYER_HEAD) {
((SkullMeta) meta).setOwner(value);
}
break;
@ -350,9 +325,7 @@ public class Methods {
case "color":
switch (item.getType()) {
case POTION:
if (!UltimateKits.getInstance().v1_8 && !UltimateKits.getInstance().v1_7) {
((PotionMeta) meta).setColor(Color.fromRGB(Integer.parseInt(value)));
}
//ToDO: this
break;
case LEATHER_HELMET:
case LEATHER_CHESTPLATE:

View File

@ -53,7 +53,7 @@ public class SettingsManager implements Listener {
}
if (e.getInventory().getTitle().equals(pluginName + " Settings Manager")) {
if (e.getCurrentItem().getType().equals(Material.STAINED_GLASS_PANE)) {
if (e.getCurrentItem().getType().name().contains("STAINED_GLASS")) {
e.setCancelled(true);
return;
}
@ -64,7 +64,7 @@ public class SettingsManager implements Listener {
e.setCancelled(true);
} else if (e.getInventory().getTitle().equals(pluginName + " Settings KitEditor")) {
if (e.getCurrentItem().getType().equals(Material.STAINED_GLASS_PANE)) {
if (e.getCurrentItem().getType().name().contains("STAINED_GLASS")) {
e.setCancelled(true);
return;
}
@ -137,7 +137,7 @@ public class SettingsManager implements Listener {
int spot = 10;
for (String key : instance.getConfig().getConfigurationSection("").getKeys(false)) {
ItemStack item = new ItemStack(Material.WOOL, 1, (byte) (spot - 9));
ItemStack item = new ItemStack(Material.WHITE_WOOL, 1, (byte) (spot - 9)); //ToDo: Make this function as it was meant to.
ItemMeta meta = item.getItemMeta();
meta.setLore(Collections.singletonList(Arconix.pl().getApi().format().formatText("&6Click To Edit This Category.")));
meta.setDisplayName(Arconix.pl().getApi().format().formatText("&f&l" + key));
@ -176,7 +176,7 @@ public class SettingsManager implements Listener {
lore.add(Arconix.pl().getApi().format().formatText("&9" + str));
break;
case "java.lang.Integer":
item.setType(Material.WATCH);
item.setType(Material.CLOCK);
int in = (Integer) instance.getConfig().get(fKey);
lore.add(Arconix.pl().getApi().format().formatText("&5" + in));
@ -211,9 +211,6 @@ public class SettingsManager implements Listener {
config.set(s.setting, config.get(s.oldSetting));
config.set(s.oldSetting, null);
} else if (s.setting.equals("Main.Upgrade Particle Type")) {
if (instance.v1_7 || instance.v1_8)
config.addDefault(s.setting, "WITCH_MAGIC");
else
config.addDefault(s.setting, s.option);
} else
config.addDefault(s.setting, s.option);
@ -221,7 +218,7 @@ public class SettingsManager implements Listener {
}
public enum settings {
o1("Lock-KP-Commands", "Main.Block Help Page For Non Admins", false),
o3("Only-Show-Kits-With-Perms", "Main.Only Show Players Kits They Have Permission To Use", false),
o4("Kits-Free-With-Perms", "Main.Allow Players To Receive Kits For Free If They Have Permission", true),
@ -231,7 +228,7 @@ public class SettingsManager implements Listener {
o8("Sound", "Main.Sound Played While Clicking In Inventories", "ENTITY_ENDERMEN_TELEPORT"),
o85("Sound", "Main.Prevent The Redeeming of a Kit When Inventory Is Full", true),
o9("Exit-Icon", "Interfaces.Exit Icon", "WOOD_DOOR"),
o9("Exit-Icon", "Interfaces.Exit Icon", "OAK_DOOR"),
o10("Buy-Icon", "Interfaces.Buy Icon", "EMERALD"),
o11("Glass-Type-1", "Interfaces.Glass Type 1", 7),
o12("Glass-Type-2", "Interfaces.Glass Type 2", 11),