Added 1.10 Support (1.10_R1)

This commit is contained in:
Eric 2016-06-09 19:34:48 +02:00
parent 8a08dcb059
commit 8def855a43
8 changed files with 665 additions and 440 deletions

View File

@ -1,421 +1,426 @@
(Source: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html)
ACACIA_DOOR
ACACIA_DOOR_ITEM
ACACIA_FENCE
ACACIA_FENCE_GATE
ACACIA_STAIRS
ACTIVATOR_RAIL
AIR
ANVIL
APPLE
ARMOR_STAND
ARROW
BAKED_POTATO
BANNER
BARRIER
BEACON
BED
BED_BLOCK
BEDROCK
BEETROOT
BEETROOT_BLOCK
BEETROOT_SEEDS
BEETROOT_SOUP
BIRCH_DOOR
BIRCH_DOOR_ITEM
BIRCH_FENCE
BIRCH_FENCE_GATE
BIRCH_WOOD_STAIRS
BLAZE_POWDER
BLAZE_ROD
BOAT
BOAT_ACACIA
BOAT_BIRCH
BOAT_DARK_OAK
BOAT_JUNGLE
BOAT_SPRUCE
BONE
BOOK
BOOK_AND_QUILL
BOOKSHELF
BOW
BOWL
BREAD
BREWING_STAND
BREWING_STAND_ITEM
BRICK
BRICK_STAIRS
BROWN_MUSHROOM
BUCKET
BURNING_FURNACE
CACTUS
CAKE
CAKE_BLOCK
CARPET
CARROT
CARROT_ITEM
CARROT_STICK
CAULDRON
CAULDRON_ITEM
CHAINMAIL_BOOTS
CHAINMAIL_CHESTPLATE
CHAINMAIL_HELMET
CHAINMAIL_LEGGINGS
CHEST
CHORUS_FLOWER
CHORUS_FRUIT
CHORUS_FRUIT_POPPED
CHORUS_PLANT
CLAY
CLAY_BALL
CLAY_BRICK
COAL
COAL_BLOCK
COAL_ORE
COBBLE_WALL
COBBLESTONE
COBBLESTONE_STAIRS
COCOA
COMMAND
COMMAND_CHAIN
COMMAND_MINECART
COMMAND_REPEATING
COMPASS
COOKED_BEEF
COOKED_CHICKEN
COOKED_FISH
COOKED_MUTTON
COOKED_RABBIT
COOKIE
CROPS
DARK_OAK_DOOR
DARK_OAK_DOOR_ITEM
DARK_OAK_FENCE
DARK_OAK_FENCE_GATE
DARK_OAK_STAIRS
DAYLIGHT_DETECTOR
DAYLIGHT_DETECTOR_INVERTED
DEAD_BUSH
DETECTOR_RAIL
DIAMOND
DIAMOND_AXE
DIAMOND_BARDING
DIAMOND_BLOCK
DIAMOND_BOOTS
DIAMOND_CHESTPLATE
DIAMOND_HELMET
DIAMOND_HOE
DIAMOND_LEGGINGS
DIAMOND_ORE
DIAMOND_PICKAXE
DIAMOND_SPADE
DIAMOND_SWORD
DIODE
DIODE_BLOCK_OFF
DIODE_BLOCK_ON
DIRT
DISPENSER
DOUBLE_PLANT
DOUBLE_STEP
DOUBLE_STONE_SLAB2
DRAGON_EGG
DRAGONS_BREATH
DROPPER
EGG
ELYTRA
EMERALD
EMERALD_BLOCK
EMERALD_ORE
EMPTY_MAP
ENCHANTED_BOOK
ENCHANTMENT_TABLE
END_BRICKS
END_CRYSTAL
END_GATEWAY
END_ROD
ENDER_CHEST
ENDER_PEARL
ENDER_PORTAL
ENDER_PORTAL_FRAME
ENDER_STONE
EXP_BOTTLE
EXPLOSIVE_MINECART
EYE_OF_ENDER
FEATHER
FENCE
FENCE_GATE
FERMENTED_SPIDER_EYE
FIRE
FIREBALL
FIREWORK
FIREWORK_CHARGE
FISHING_ROD
FLINT
FLINT_AND_STEEL
FLOWER_POT
FLOWER_POT_ITEM
FROSTED_ICE
FURNACE
GHAST_TEAR
GLASS
GLASS_BOTTLE
GLOWING_REDSTONE_ORE
GLOWSTONE
GLOWSTONE_DUST
GOLD_AXE
GOLD_BARDING
GOLD_BLOCK
GOLD_BOOTS
GOLD_CHESTPLATE
GOLD_HELMET
GOLD_HOE
GOLD_INGOT
GOLD_LEGGINGS
GOLD_NUGGET
GOLD_ORE
GOLD_PICKAXE
GOLD_PLATE
GOLD_RECORD
GOLD_SPADE
GOLD_SWORD
GOLDEN_APPLE
GOLDEN_CARROT
GRASS
GRASS_PATH
GRAVEL
GREEN_RECORD
GRILLED_PORK
HARD_CLAY
HAY_BLOCK
HOPPER
HOPPER_MINECART
HUGE_MUSHROOM_1
HUGE_MUSHROOM_2
ICE
INK_SACK
IRON_AXE
IRON_BARDING
IRON_BLOCK
IRON_BOOTS
IRON_CHESTPLATE
IRON_DOOR
IRON_DOOR_BLOCK
IRON_FENCE
IRON_HELMET
IRON_HOE
IRON_INGOT
IRON_LEGGINGS
IRON_ORE
IRON_PICKAXE
IRON_PLATE
IRON_SPADE
IRON_SWORD
IRON_TRAPDOOR
ITEM_FRAME
JACK_O_LANTERN
JUKEBOX
JUNGLE_DOOR
JUNGLE_DOOR_ITEM
JUNGLE_FENCE
JUNGLE_FENCE_GATE
JUNGLE_WOOD_STAIRS
LADDER
LAPIS_BLOCK
LAPIS_ORE
LAVA
LAVA_BUCKET
LEASH
LEATHER
LEATHER_BOOTS
LEATHER_CHESTPLATE
LEATHER_HELMET
LEATHER_LEGGINGS
LEAVES
LEAVES_2
LEVER
LINGERING_POTION
LOG
LOG_2
LONG_GRASS
MAGMA_CREAM
MAP
MELON
MELON_BLOCK
MELON_SEEDS
MELON_STEM
MILK_BUCKET
MINECART
MOB_SPAWNER
MONSTER_EGG
MONSTER_EGGS
MOSSY_COBBLESTONE
MUSHROOM_SOUP
MUTTON
MYCEL
NAME_TAG
NETHER_BRICK
NETHER_BRICK_ITEM
NETHER_BRICK_STAIRS
NETHER_FENCE
NETHER_STALK
NETHER_STAR
NETHER_WARTS
NETHERRACK
NOTE_BLOCK
OBSIDIAN
PACKED_ICE
PAINTING
PAPER
PISTON_BASE
PISTON_EXTENSION
PISTON_MOVING_PIECE
PISTON_STICKY_BASE
POISONOUS_POTATO
PORK
PORTAL
POTATO
POTATO_ITEM
POTION
POWERED_MINECART
POWERED_RAIL
PRISMARINE
PRISMARINE_CRYSTALS
PRISMARINE_SHARD
PUMPKIN
PUMPKIN_PIE
PUMPKIN_SEEDS
PUMPKIN_STEM
PURPUR_BLOCK
PURPUR_DOUBLE_SLAB
PURPUR_PILLAR
PURPUR_SLAB
PURPUR_STAIRS
QUARTZ
QUARTZ_BLOCK
QUARTZ_ORE
QUARTZ_STAIRS
RABBIT
RABBIT_FOOT
RABBIT_HIDE
RABBIT_STEW
RAILS
RAW_BEEF
RAW_CHICKEN
RAW_FISH
RECORD_10
RECORD_11
RECORD_12
RECORD_3
RECORD_4
RECORD_5
RECORD_6
RECORD_7
RECORD_8
RECORD_9
RED_MUSHROOM
RED_ROSE
RED_SANDSTONE
RED_SANDSTONE_STAIRS
REDSTONE
REDSTONE_BLOCK
REDSTONE_COMPARATOR
REDSTONE_COMPARATOR_OFF
REDSTONE_COMPARATOR_ON
REDSTONE_LAMP_OFF
REDSTONE_LAMP_ON
REDSTONE_ORE
REDSTONE_TORCH_OFF
REDSTONE_TORCH_ON
REDSTONE_WIRE
ROTTEN_FLESH
SADDLE
SAND
SANDSTONE
SANDSTONE_STAIRS
SAPLING
SEA_LANTERN
SEEDS
SHEARS
SHIELD
SIGN
SIGN_POST
SKULL
SKULL_ITEM
SLIME_BALL
SLIME_BLOCK
SMOOTH_BRICK
SMOOTH_STAIRS
SNOW
SNOW_BALL
SNOW_BLOCK
SOIL
SOUL_SAND
SPECKLED_MELON
SPECTRAL_ARROW
SPIDER_EYE
SPLASH_POTION
SPONGE
SPRUCE_DOOR
SPRUCE_DOOR_ITEM
SPRUCE_FENCE
SPRUCE_FENCE_GATE
SPRUCE_WOOD_STAIRS
STAINED_CLAY
STAINED_GLASS
STAINED_GLASS_PANE
STANDING_BANNER
STATIONARY_LAVA
STATIONARY_WATER
STEP
STICK
STONE
STONE_AXE
STONE_BUTTON
STONE_HOE
STONE_PICKAXE
STONE_PLATE
STONE_SLAB2
STONE_SPADE
STONE_SWORD
STORAGE_MINECART
STRING
STRUCTURE_BLOCK
SUGAR
SUGAR_CANE
SUGAR_CANE_BLOCK
SULPHUR
THIN_GLASS
TIPPED_ARROW
TNT
TORCH
TRAP_DOOR
TRAPPED_CHEST
TRIPWIRE
TRIPWIRE_HOOK
VINE
WALL_BANNER
WALL_SIGN
WATCH
WATER
WATER_BUCKET
WATER_LILY
WEB
WHEAT
WOOD
WOOD_AXE
WOOD_BUTTON
WOOD_DOOR
WOOD_DOUBLE_STEP
WOOD_HOE
WOOD_PICKAXE
WOOD_PLATE
WOOD_SPADE
WOOD_STAIRS
WOOD_STEP
WOOD_SWORD
WOODEN_DOOR
WOOL
WORKBENCH
WRITTEN_BOOK
YELLOW_FLOWER
ACACIA_DOOR
ACACIA_DOOR_ITEM
ACACIA_FENCE
ACACIA_FENCE_GATE
ACACIA_STAIRS
ACTIVATOR_RAIL
AIR
ANVIL
APPLE
ARMOR_STAND
ARROW
BAKED_POTATO
BANNER
BARRIER
BEACON
BED
BED_BLOCK
BEDROCK
BEETROOT
BEETROOT_BLOCK
BEETROOT_SEEDS
BEETROOT_SOUP
BIRCH_DOOR
BIRCH_DOOR_ITEM
BIRCH_FENCE
BIRCH_FENCE_GATE
BIRCH_WOOD_STAIRS
BLAZE_POWDER
BLAZE_ROD
BOAT
BOAT_ACACIA
BOAT_BIRCH
BOAT_DARK_OAK
BOAT_JUNGLE
BOAT_SPRUCE
BONE
BONE_BLOCK
BOOK
BOOK_AND_QUILL
BOOKSHELF
BOW
BOWL
BREAD
BREWING_STAND
BREWING_STAND_ITEM
BRICK
BRICK_STAIRS
BROWN_MUSHROOM
BUCKET
BURNING_FURNACE
CACTUS
CAKE
CAKE_BLOCK
CARPET
CARROT
CARROT_ITEM
CARROT_STICK
CAULDRON
CAULDRON_ITEM
CHAINMAIL_BOOTS
CHAINMAIL_CHESTPLATE
CHAINMAIL_HELMET
CHAINMAIL_LEGGINGS
CHEST
CHORUS_FLOWER
CHORUS_FRUIT
CHORUS_FRUIT_POPPED
CHORUS_PLANT
CLAY
CLAY_BALL
CLAY_BRICK
COAL
COAL_BLOCK
COAL_ORE
COBBLE_WALL
COBBLESTONE
COBBLESTONE_STAIRS
COCOA
COMMAND
COMMAND_CHAIN
COMMAND_MINECART
COMMAND_REPEATING
COMPASS
COOKED_BEEF
COOKED_CHICKEN
COOKED_FISH
COOKED_MUTTON
COOKED_RABBIT
COOKIE
CROPS
DARK_OAK_DOOR
DARK_OAK_DOOR_ITEM
DARK_OAK_FENCE
DARK_OAK_FENCE_GATE
DARK_OAK_STAIRS
DAYLIGHT_DETECTOR
DAYLIGHT_DETECTOR_INVERTED
DEAD_BUSH
DETECTOR_RAIL
DIAMOND
DIAMOND_AXE
DIAMOND_BARDING
DIAMOND_BLOCK
DIAMOND_BOOTS
DIAMOND_CHESTPLATE
DIAMOND_HELMET
DIAMOND_HOE
DIAMOND_LEGGINGS
DIAMOND_ORE
DIAMOND_PICKAXE
DIAMOND_SPADE
DIAMOND_SWORD
DIODE
DIODE_BLOCK_OFF
DIODE_BLOCK_ON
DIRT
DISPENSER
DOUBLE_PLANT
DOUBLE_STEP
DOUBLE_STONE_SLAB2
DRAGON_EGG
DRAGONS_BREATH
DROPPER
EGG
ELYTRA
EMERALD
EMERALD_BLOCK
EMERALD_ORE
EMPTY_MAP
ENCHANTED_BOOK
ENCHANTMENT_TABLE
END_BRICKS
END_CRYSTAL
END_GATEWAY
END_ROD
ENDER_CHEST
ENDER_PEARL
ENDER_PORTAL
ENDER_PORTAL_FRAME
ENDER_STONE
EXP_BOTTLE
EXPLOSIVE_MINECART
EYE_OF_ENDER
FEATHER
FENCE
FENCE_GATE
FERMENTED_SPIDER_EYE
FIRE
FIREBALL
FIREWORK
FIREWORK_CHARGE
FISHING_ROD
FLINT
FLINT_AND_STEEL
FLOWER_POT
FLOWER_POT_ITEM
FROSTED_ICE
FURNACE
GHAST_TEAR
GLASS
GLASS_BOTTLE
GLOWING_REDSTONE_ORE
GLOWSTONE
GLOWSTONE_DUST
GOLD_AXE
GOLD_BARDING
GOLD_BLOCK
GOLD_BOOTS
GOLD_CHESTPLATE
GOLD_HELMET
GOLD_HOE
GOLD_INGOT
GOLD_LEGGINGS
GOLD_NUGGET
GOLD_ORE
GOLD_PICKAXE
GOLD_PLATE
GOLD_RECORD
GOLD_SPADE
GOLD_SWORD
GOLDEN_APPLE
GOLDEN_CARROT
GRASS
GRASS_PATH
GRAVEL
GREEN_RECORD
GRILLED_PORK
HARD_CLAY
HAY_BLOCK
HOPPER
HOPPER_MINECART
HUGE_MUSHROOM_1
HUGE_MUSHROOM_2
ICE
INK_SACK
IRON_AXE
IRON_BARDING
IRON_BLOCK
IRON_BOOTS
IRON_CHESTPLATE
IRON_DOOR
IRON_DOOR_BLOCK
IRON_FENCE
IRON_HELMET
IRON_HOE
IRON_INGOT
IRON_LEGGINGS
IRON_ORE
IRON_PICKAXE
IRON_PLATE
IRON_SPADE
IRON_SWORD
IRON_TRAPDOOR
ITEM_FRAME
JACK_O_LANTERN
JUKEBOX
JUNGLE_DOOR
JUNGLE_DOOR_ITEM
JUNGLE_FENCE
JUNGLE_FENCE_GATE
JUNGLE_WOOD_STAIRS
LADDER
LAPIS_BLOCK
LAPIS_ORE
LAVA
LAVA_BUCKET
LEASH
LEATHER
LEATHER_BOOTS
LEATHER_CHESTPLATE
LEATHER_HELMET
LEATHER_LEGGINGS
LEAVES
LEAVES_2
LEVER
LINGERING_POTION
LOG
LOG_2
LONG_GRASS
MAGMA
MAGMA_CREAM
MAP
MELON
MELON_BLOCK
MELON_SEEDS
MELON_STEM
MILK_BUCKET
MINECART
MOB_SPAWNER
MONSTER_EGG
MONSTER_EGGS
MOSSY_COBBLESTONE
MUSHROOM_SOUP
MUTTON
MYCEL
NAME_TAG
NETHER_BRICK
NETHER_BRICK_ITEM
NETHER_BRICK_STAIRS
NETHER_FENCE
NETHER_STALK
NETHER_STAR
NETHER_WART_BLOCK
NETHER_WARTS
NETHERRACK
NOTE_BLOCK
OBSIDIAN
PACKED_ICE
PAINTING
PAPER
PISTON_BASE
PISTON_EXTENSION
PISTON_MOVING_PIECE
PISTON_STICKY_BASE
POISONOUS_POTATO
PORK
PORTAL
POTATO
POTATO_ITEM
POTION
POWERED_MINECART
POWERED_RAIL
PRISMARINE
PRISMARINE_CRYSTALS
PRISMARINE_SHARD
PUMPKIN
PUMPKIN_PIE
PUMPKIN_SEEDS
PUMPKIN_STEM
PURPUR_BLOCK
PURPUR_DOUBLE_SLAB
PURPUR_PILLAR
PURPUR_SLAB
PURPUR_STAIRS
QUARTZ
QUARTZ_BLOCK
QUARTZ_ORE
QUARTZ_STAIRS
RABBIT
RABBIT_FOOT
RABBIT_HIDE
RABBIT_STEW
RAILS
RAW_BEEF
RAW_CHICKEN
RAW_FISH
RECORD_10
RECORD_11
RECORD_12
RECORD_3
RECORD_4
RECORD_5
RECORD_6
RECORD_7
RECORD_8
RECORD_9
RED_MUSHROOM
RED_NETHER_BRICK
RED_ROSE
RED_SANDSTONE
RED_SANDSTONE_STAIRS
REDSTONE
REDSTONE_BLOCK
REDSTONE_COMPARATOR
REDSTONE_COMPARATOR_OFF
REDSTONE_COMPARATOR_ON
REDSTONE_LAMP_OFF
REDSTONE_LAMP_ON
REDSTONE_ORE
REDSTONE_TORCH_OFF
REDSTONE_TORCH_ON
REDSTONE_WIRE
ROTTEN_FLESH
SADDLE
SAND
SANDSTONE
SANDSTONE_STAIRS
SAPLING
SEA_LANTERN
SEEDS
SHEARS
SHIELD
SIGN
SIGN_POST
SKULL
SKULL_ITEM
SLIME_BALL
SLIME_BLOCK
SMOOTH_BRICK
SMOOTH_STAIRS
SNOW
SNOW_BALL
SNOW_BLOCK
SOIL
SOUL_SAND
SPECKLED_MELON
SPECTRAL_ARROW
SPIDER_EYE
SPLASH_POTION
SPONGE
SPRUCE_DOOR
SPRUCE_DOOR_ITEM
SPRUCE_FENCE
SPRUCE_FENCE_GATE
SPRUCE_WOOD_STAIRS
STAINED_CLAY
STAINED_GLASS
STAINED_GLASS_PANE
STANDING_BANNER
STATIONARY_LAVA
STATIONARY_WATER
STEP
STICK
STONE
STONE_AXE
STONE_BUTTON
STONE_HOE
STONE_PICKAXE
STONE_PLATE
STONE_SLAB2
STONE_SPADE
STONE_SWORD
STORAGE_MINECART
STRING
STRUCTURE_BLOCK
STRUCTURE_VOID
SUGAR
SUGAR_CANE
SUGAR_CANE_BLOCK
SULPHUR
THIN_GLASS
TIPPED_ARROW
TNT
TORCH
TRAP_DOOR
TRAPPED_CHEST
TRIPWIRE
TRIPWIRE_HOOK
VINE
WALL_BANNER
WALL_SIGN
WATCH
WATER
WATER_BUCKET
WATER_LILY
WEB
WHEAT
WOOD
WOOD_AXE
WOOD_BUTTON
WOOD_DOOR
WOOD_DOUBLE_STEP
WOOD_HOE
WOOD_PICKAXE
WOOD_PLATE
WOOD_SPADE
WOOD_STAIRS
WOOD_STEP
WOOD_SWORD
WOODEN_DOOR
WOOL
WORKBENCH
WRITTEN_BOOK
YELLOW_FLOWER

View File

@ -2,7 +2,6 @@ package de.epiceric.shopchest;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.interfaces.JsonBuilder;
import de.epiceric.shopchest.utils.Utils;
import de.epiceric.shopchest.interfaces.jsonbuilder.*;
import de.epiceric.shopchest.shop.Shop.ShopType;
import de.epiceric.shopchest.utils.ClickType;
@ -10,6 +9,7 @@ import de.epiceric.shopchest.utils.ClickType.EnumClickType;
import de.epiceric.shopchest.utils.ShopUtils;
import de.epiceric.shopchest.utils.UpdateChecker;
import de.epiceric.shopchest.utils.UpdateChecker.UpdateCheckerResult;
import de.epiceric.shopchest.utils.Utils;
import net.milkbowl.vault.economy.EconomyResponse;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
@ -153,6 +153,9 @@ public class Commands extends BukkitCommand {
case "v1_9_R2":
jb = new JsonBuilder_1_9_R2(Config.update_available(ShopChest.latestVersion));
break;
case "v1_10_R1":
jb = new JsonBuilder_1_10_R1(Config.update_available(ShopChest.latestVersion));
break;
default:
return;
}

View File

@ -3,7 +3,6 @@ package de.epiceric.shopchest;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.event.*;
import de.epiceric.shopchest.interfaces.JsonBuilder;
import de.epiceric.shopchest.utils.Utils;
import de.epiceric.shopchest.interfaces.jsonbuilder.*;
import de.epiceric.shopchest.shop.Shop;
import de.epiceric.shopchest.shop.Shop.ShopType;
@ -16,6 +15,7 @@ import de.epiceric.shopchest.utils.Metrics.Plotter;
import de.epiceric.shopchest.utils.ShopUtils;
import de.epiceric.shopchest.utils.UpdateChecker;
import de.epiceric.shopchest.utils.UpdateChecker.UpdateCheckerResult;
import de.epiceric.shopchest.utils.Utils;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.Bukkit;
@ -78,6 +78,20 @@ public class ShopChest extends JavaPlugin {
return;
}
switch (Utils.getVersion(getServer())) {
case "v1_8_R1":
case "v1_8_R2":
case "v1_8_R3":
case "v1_9_R1":
case "v1_9_R2":
case "v1_10_R1":
break;
default:
logger.severe("Incompatible Server Version: " + Utils.getVersion(getServer()) + "!");
getServer().getPluginManager().disablePlugin(this);
return;
}
try {
Metrics metrics = new Metrics(this);
Graph shopType = metrics.createGraph("Shop Type");
@ -153,20 +167,6 @@ public class ShopChest extends JavaPlugin {
database = new MySQL(this);
}
switch (Utils.getVersion(getServer())) {
case "v1_8_R1":
case "v1_8_R2":
case "v1_8_R3":
case "v1_9_R1":
case "v1_9_R2":
break;
default:
logger.severe("Incompatible Server Version: " + Utils.getVersion(getServer()) + "!");
getServer().getPluginManager().disablePlugin(this);
return;
}
lockette = getServer().getPluginManager().getPlugin("Lockette") != null;
lwc = getServer().getPluginManager().getPlugin("LWC") != null;
@ -203,6 +203,9 @@ public class ShopChest extends JavaPlugin {
case "v1_9_R2":
jb = new JsonBuilder_1_9_R2(Config.update_available(latestVersion));
break;
case "v1_10_R1":
jb = new JsonBuilder_1_10_R1(Config.update_available(latestVersion));
break;
default:
return;
}

View File

@ -3,8 +3,8 @@ package de.epiceric.shopchest.event;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.interfaces.JsonBuilder;
import de.epiceric.shopchest.utils.Utils;
import de.epiceric.shopchest.interfaces.jsonbuilder.*;
import de.epiceric.shopchest.utils.Utils;
import net.milkbowl.vault.permission.Permission;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -43,6 +43,9 @@ public class NotifyUpdate implements Listener {
case "v1_9_R2":
jb = new JsonBuilder_1_9_R2(Config.update_available(ShopChest.latestVersion));
break;
case "v1_10_R1":
jb = new JsonBuilder_1_10_R1(Config.update_available(ShopChest.latestVersion));
break;
default:
return;
}

View File

@ -0,0 +1,94 @@
package de.epiceric.shopchest.interfaces.hologram;
import de.epiceric.shopchest.interfaces.Hologram;
import net.minecraft.server.v1_10_R1.EntityArmorStand;
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class Hologram_1_10_R1 implements Hologram {
private boolean exists = false;
private int count;
private List<EntityArmorStand> entitylist = new ArrayList<EntityArmorStand>();
private String[] text;
private Location location;
private double DISTANCE = 0.25D;
private HashMap<OfflinePlayer, Boolean> visible = new HashMap<OfflinePlayer, Boolean>();
public Hologram_1_10_R1(String[] text, Location location) {
this.text = text;
this.location = location;
create();
}
public Location getLocation() {
return location;
}
public List<EntityArmorStand> getEntities() {
return entitylist;
}
public void showPlayer(OfflinePlayer p) {
for (Object o : entitylist) {
EntityArmorStand armor = (EntityArmorStand) o;
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
}
visible.put(p, true);
}
public void hidePlayer(OfflinePlayer p) {
for (Object o : entitylist) {
EntityArmorStand armor = (EntityArmorStand) o;
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
}
visible.put(p, false);
}
public boolean isVisible(OfflinePlayer p) {
if (visible.containsKey(p)) return visible.get(p);
else return false;
}
private void create() {
for (String text : this.text) {
EntityArmorStand entity = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(), this.location.getX(), this.location.getY(), this.location.getZ());
entity.setCustomName(text);
entity.setCustomNameVisible(true);
entity.setInvisible(true);
entity.setNoGravity(true);
entitylist.add(entity);
this.location.subtract(0, this.DISTANCE, 0);
count++;
}
for (int i = 0; i < count; i++) {
this.location.add(0, this.DISTANCE, 0);
}
count = 0;
exists = true;
}
public boolean exists() {
return exists;
}
public void remove() {
for (EntityArmorStand e : entitylist) {
e.die();
}
exists = false;
}
}

View File

@ -0,0 +1,111 @@
package de.epiceric.shopchest.interfaces.jsonbuilder;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.interfaces.JsonBuilder;
import net.minecraft.server.v1_10_R1.IChatBaseComponent.ChatSerializer;
import net.minecraft.server.v1_10_R1.PacketPlayOutChat;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
public class JsonBuilder_1_10_R1 implements JsonBuilder {
/* JsonBuilder by FisheyLP */
private List<String> extras = new ArrayList<String>();
public JsonBuilder_1_10_R1(String... text) {
for (String extra : text)
parse(extra);
}
@Override
public JsonBuilder_1_10_R1 parse(String text) {
String regex = "[&<26>]{1}([a-fA-Fl-oL-O0-9]){1}";
text = text.replaceAll(regex, "<EFBFBD>$1");
if (!Pattern.compile(regex).matcher(text).find()) {
withText(text).withHoverEvent(HoverAction.SHOW_TEXT, Config.click_to_download()).withClickEvent(ClickAction.OPEN_URL, ShopChest.downloadLink);
return this;
}
String[] words = text.split(regex);
int index = words[0].length();
for (String word : words) {
try {
if (index != words[0].length())
withText(word).withColor("<EFBFBD>" + text.charAt(index - 1)).withHoverEvent(HoverAction.SHOW_TEXT, Config.click_to_download()).withClickEvent(ClickAction.OPEN_URL, ShopChest.downloadLink);
} catch (Exception e) {
}
index += word.length() + 2;
}
return this;
}
@Override
public JsonBuilder_1_10_R1 withText(String text) {
extras.add("{\"text\":\"" + text + "\"}");
return this;
}
@Override
public JsonBuilder_1_10_R1 withColor(ChatColor color) {
String c = color.name().toLowerCase();
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
return this;
}
@Override
public JsonBuilder_1_10_R1 withColor(String color) {
while (color.length() != 1) color = color.substring(1).trim();
withColor(ChatColor.getByChar(color));
return this;
}
@Override
public JsonBuilder_1_10_R1 withClickEvent(ClickAction action, String value) {
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
+ "\",\"value\":\"" + value + "\"}");
return this;
}
@Override
public JsonBuilder_1_10_R1 withHoverEvent(HoverAction action, String value) {
addSegment("\"hoverEvent\":{\"action\":\"" + action.toString().toLowerCase()
+ "\",\"value\":\"" + value + "\"}");
return this;
}
private void addSegment(String segment) {
String lastText = extras.get(extras.size() - 1);
lastText = lastText.substring(0, lastText.length() - 1)
+ "," + segment + "}";
extras.remove(extras.size() - 1);
extras.add(lastText);
}
@Override
public String toString() {
if (extras.size() <= 1) return extras.size() == 0 ? "{\"text\":\"\"}" : extras.get(0);
String text = extras.get(0).substring(0, extras.get(0).length() - 1) + ",\"extra\":[";
extras.remove(0);
for (String extra : extras)
text = text + extra + ",";
text = text.substring(0, text.length() - 1) + "]}";
return text;
}
@Override
public void sendJson(Player p) {
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
new PacketPlayOutChat(ChatSerializer.a(toString())));
}
}

View File

@ -3,9 +3,9 @@ package de.epiceric.shopchest.shop;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.interfaces.Hologram;
import de.epiceric.shopchest.utils.Utils;
import de.epiceric.shopchest.interfaces.hologram.*;
import de.epiceric.shopchest.utils.ItemNames;
import de.epiceric.shopchest.utils.Utils;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -178,8 +178,9 @@ public class Shop {
case "v1_9_R2":
hologram = new Hologram_1_9_R2(holoText, holoLocation);
break;
default:
return;
case "v1_10_R1":
hologram = new Hologram_1_10_R1(holoText, holoLocation);
break;
}
}
@ -218,7 +219,7 @@ public class Shop {
public enum ShopType {
NORMAL,
ADMIN;
ADMIN
}
}

View File

@ -312,6 +312,11 @@ public class ItemNames {
.put("210", "Repeating Command Block")
.put("211", "Chain Command Block")
.put("212", "Frosted Ice")
.put("213", "Magma Block")
.put("214", "Nether Wart Block")
.put("215", "Red Nether Brick")
.put("216", "Bone Block")
.put("217", "Structure Void")
.put("255", "Structure Block")
.put("256", "Iron Shovel")
.put("257", "Iron Pickaxe")