mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-12-24 18:17:41 +01:00
Rewrote island calculations to be cleaner.
This commit is contained in:
parent
181cb25357
commit
5137efb7f0
636
config.yml
636
config.yml
@ -35,273 +35,605 @@ teamjoindeathreset: true
|
||||
# This section lists the limits for any particular block. Blocks over this amount
|
||||
# are not counted.
|
||||
# Format:
|
||||
# MATERIAL: limit or MATERIAL:DATA: limit.
|
||||
# If DATA is used, there MUST be a corresponding block:data value in the blocks list.
|
||||
# For example, if you limit Jungle Logs LOG:3, then there must be a value for LOG:3
|
||||
# in the blocks section. If there is not, then LOG:3 would have no value.
|
||||
# MATERIAL: limit
|
||||
limits:
|
||||
COBBLESTONE: 10000
|
||||
NETHERRACK: 1000
|
||||
#LOG:3: 10
|
||||
|
||||
# This section lists the value of a block. Value must be an integer.
|
||||
# Any blocks not listed will have a value of zero.
|
||||
# Format is MATERIAL: value or MATERIAL:DATA: value.
|
||||
# Any blocks not listed will have a value of 1. AIR is always zero.
|
||||
# Format is MATERIAL: value
|
||||
|
||||
blocks:
|
||||
ACACIA_BUTTON: 1
|
||||
ACACIA_DOOR: 1
|
||||
ACACIA_STAIRS: 1
|
||||
ACACIA_FENCE: 1
|
||||
ACACIA_FENCE: 2
|
||||
ACACIA_FENCE_GATE: 1
|
||||
ACACIA_LEAVES: 0
|
||||
ACACIA_LOG: 0
|
||||
ACACIA_PLANKS: 1
|
||||
ACACIA_PRESSURE_PLATE: 1
|
||||
ACACIA_SAPLING: 1
|
||||
ACACIA_SLAB: 1
|
||||
ACACIA_STAIRS: 2
|
||||
ACTIVATOR_RAIL: 10
|
||||
AIR: 0
|
||||
ACACIA_TRAPDOOR: 1
|
||||
ACACIA_WOOD: 1
|
||||
ACTIVATOR_RAIL: 1
|
||||
ALLIUM: 1
|
||||
ANDESITE: 1
|
||||
ANVIL: 10
|
||||
ARMOR_STAND: 2
|
||||
BANNER: 2
|
||||
ATTACHED_MELON_STEM: 1
|
||||
ATTACHED_PUMPKIN_STEM: 1
|
||||
AZURE_BLUET: 1
|
||||
BARRIER: 0
|
||||
BEACON: 500
|
||||
BED_BLOCK: 1
|
||||
BEDROCK: 0
|
||||
BEETROOT_BLOCK: 1
|
||||
BEETROOTS: 1
|
||||
BIRCH_BUTTON: 1
|
||||
BIRCH_DOOR: 1
|
||||
BIRCH_FENCE: 1
|
||||
BIRCH_FENCE: 2
|
||||
BIRCH_FENCE_GATE: 1
|
||||
BIRCH_WOOD_STAIRS: 1
|
||||
BIRCH_LEAVES: 0
|
||||
BIRCH_LOG: 0
|
||||
BIRCH_PLANKS: 1
|
||||
BIRCH_PRESSURE_PLATE: 1
|
||||
BIRCH_SAPLING: 1
|
||||
BIRCH_SLAB: 1
|
||||
BIRCH_STAIRS: 2
|
||||
BIRCH_TRAPDOOR: 1
|
||||
BIRCH_WOOD: 1
|
||||
BLACK_BANNER: 2
|
||||
BLACK_BED: 2
|
||||
BLACK_CARPET: 1
|
||||
BLACK_CONCRETE: 1
|
||||
BLACK_CONCRETE_POWDER: 1
|
||||
BLACK_GLAZED_TERRACOTTA: 1
|
||||
BLACK_SHULKER_BOX: 1
|
||||
BLACK_STAINED_GLASS: 2
|
||||
BLACK_STAINED_GLASS_PANE: 1
|
||||
BLACK_TERRACOTTA: 1
|
||||
BLACK_WALL_BANNER: 2
|
||||
BLACK_WOOL: 1
|
||||
BLUE_BANNER: 2
|
||||
BLUE_BED: 2
|
||||
BLUE_CARPET: 1
|
||||
BLUE_CONCRETE: 1
|
||||
BLUE_CONCRETE_POWDER: 1
|
||||
BLUE_GLAZED_TERRACOTTA: 1
|
||||
BLUE_ICE: 1
|
||||
BLUE_ORCHID: 1
|
||||
BLUE_SHULKER_BOX: 1
|
||||
BOAT: 2
|
||||
BOAT_ACACIA: 2
|
||||
BOAT_BIRCH: 2
|
||||
BOAT_DARK_OAK: 2
|
||||
BOAT_JUNGLE: 2
|
||||
BOAT_SPRUCE: 2
|
||||
BLUE_STAINED_GLASS: 2
|
||||
BLUE_STAINED_GLASS_PANE: 1
|
||||
BLUE_TERRACOTTA: 1
|
||||
BLUE_WALL_BANNER: 2
|
||||
BLUE_WOOL: 1
|
||||
BONE_BLOCK: 1
|
||||
BOOKSHELF: 5
|
||||
BRAIN_CORAL: 1
|
||||
BRAIN_CORAL_BLOCK: 1
|
||||
BRAIN_CORAL_FAN: 1
|
||||
BRAIN_CORAL_WALL_FAN: 1
|
||||
BREWING_STAND: 20
|
||||
BRICK: 5
|
||||
BRICKS: 5
|
||||
BRICK_SLAB: 3
|
||||
BRICK_STAIRS: 5
|
||||
BROWN_BANNER: 2
|
||||
BROWN_BED: 2
|
||||
BROWN_CARPET: 1
|
||||
BROWN_CONCRETE: 1
|
||||
BROWN_CONCRETE_POWDER: 1
|
||||
BROWN_GLAZED_TERRACOTTA: 1
|
||||
BROWN_MUSHROOM: 1
|
||||
BROWN_MUSHROOM_BLOCK: 1
|
||||
BROWN_SHULKER_BOX: 1
|
||||
BURNING_FURNACE: 10
|
||||
BROWN_STAINED_GLASS: 2
|
||||
BROWN_STAINED_GLASS_PANE: 1
|
||||
BROWN_TERRACOTTA: 1
|
||||
BROWN_WALL_BANNER: 2
|
||||
BROWN_WOOL: 1
|
||||
BUBBLE_COLUMN: 1
|
||||
BUBBLE_CORAL: 1
|
||||
BUBBLE_CORAL_BLOCK: 1
|
||||
BUBBLE_CORAL_FAN: 1
|
||||
BUBBLE_CORAL_WALL_FAN: 1
|
||||
CACTUS: 1
|
||||
CAKE_BLOCK: 1
|
||||
CARPET: 1
|
||||
CAKE: 1
|
||||
CARROTS: 1
|
||||
CARVED_PUMPKIN: 1
|
||||
CAULDRON: 10
|
||||
CAVE_AIR: 1
|
||||
CHAIN_COMMAND_BLOCK: 1
|
||||
CHEST: 2
|
||||
CHIPPED_ANVIL: 9
|
||||
CHISELED_QUARTZ_BLOCK: 1
|
||||
CHISELED_RED_SANDSTONE: 1
|
||||
CHISELED_SANDSTONE: 1
|
||||
CHISELED_STONE_BRICKS: 2
|
||||
CHORUS_FLOWER: 1
|
||||
CHORUS_PLANT: 1
|
||||
CLAY: 2
|
||||
COAL_BLOCK: 9
|
||||
COAL_ORE: 0
|
||||
COBBLE_WALL: 1
|
||||
COAL_ORE: 1
|
||||
COARSE_DIRT: 1
|
||||
COBBLESTONE: 1
|
||||
COBBLESTONE_STAIRS: 1
|
||||
COBBLESTONE_SLAB: 1
|
||||
COBBLESTONE_STAIRS: 2
|
||||
COBBLESTONE_WALL: 1
|
||||
COBWEB: 10
|
||||
COCOA: 1
|
||||
CONCRETE: 1
|
||||
CONCRETE_POWDER: 1
|
||||
COMMAND_BLOCK: 1
|
||||
COMPARATOR: 10
|
||||
CONDUIT: 1
|
||||
CRACKED_STONE_BRICKS: 2
|
||||
CRAFTING_TABLE: 1
|
||||
CREEPER_HEAD: 1
|
||||
CREEPER_WALL_HEAD: 1
|
||||
CUT_RED_SANDSTONE: 1
|
||||
CUT_SANDSTONE: 1
|
||||
CYAN_BANNER: 2
|
||||
CYAN_BED: 2
|
||||
CYAN_CARPET: 1
|
||||
CYAN_CONCRETE: 1
|
||||
CYAN_CONCRETE_POWDER: 1
|
||||
CYAN_GLAZED_TERRACOTTA: 1
|
||||
CYAN_SHULKER_BOX: 1
|
||||
CYAN_STAINED_GLASS: 2
|
||||
CYAN_STAINED_GLASS_PANE: 1
|
||||
CYAN_TERRACOTTA: 1
|
||||
CYAN_WALL_BANNER: 2
|
||||
CYAN_WOOL: 1
|
||||
DAMAGED_ANVIL: 5
|
||||
DANDELION: 1
|
||||
DARK_OAK_BUTTON: 1
|
||||
DARK_OAK_DOOR: 1
|
||||
DARK_OAK_FENCE: 1
|
||||
DARK_OAK_FENCE: 2
|
||||
DARK_OAK_FENCE_GATE: 1
|
||||
DARK_OAK_STAIRS: 1
|
||||
DARK_OAK_LEAVES: 0
|
||||
DARK_OAK_LOG: 0
|
||||
DARK_OAK_PLANKS: 1
|
||||
DARK_OAK_PRESSURE_PLATE: 1
|
||||
DARK_OAK_SAPLING: 1
|
||||
DARK_OAK_SLAB: 1
|
||||
DARK_OAK_STAIRS: 2
|
||||
DARK_OAK_TRAPDOOR: 1
|
||||
DARK_OAK_WOOD: 1
|
||||
DARK_PRISMARINE: 1
|
||||
DARK_PRISMARINE_SLAB: 1
|
||||
DARK_PRISMARINE_STAIRS: 2
|
||||
DAYLIGHT_DETECTOR: 10
|
||||
DAYLIGHT_DETECTOR_INVERTED: 10
|
||||
DEAD_BRAIN_CORAL_BLOCK: 1
|
||||
DEAD_BRAIN_CORAL_FAN: 1
|
||||
DEAD_BRAIN_CORAL_WALL_FAN: 1
|
||||
DEAD_BUBBLE_CORAL_BLOCK: 1
|
||||
DEAD_BUBBLE_CORAL_FAN: 1
|
||||
DEAD_BUBBLE_CORAL_WALL_FAN: 1
|
||||
DEAD_BUSH: 1
|
||||
DEAD_FIRE_CORAL_BLOCK: 1
|
||||
DEAD_FIRE_CORAL_FAN: 1
|
||||
DEAD_FIRE_CORAL_WALL_FAN: 1
|
||||
DEAD_HORN_CORAL_BLOCK: 1
|
||||
DEAD_HORN_CORAL_FAN: 1
|
||||
DEAD_HORN_CORAL_WALL_FAN: 1
|
||||
DEAD_TUBE_CORAL_BLOCK: 1
|
||||
DEAD_TUBE_CORAL_FAN: 1
|
||||
DEAD_TUBE_CORAL_WALL_FAN: 1
|
||||
DETECTOR_RAIL: 10
|
||||
DIAMOND_BLOCK: 300
|
||||
DIODE: 5
|
||||
DIODE_BLOCK_OFF: 5
|
||||
DIODE_BLOCK_ON: 5
|
||||
DIRT: 2
|
||||
DIAMOND_ORE: 1
|
||||
DIORITE: 1
|
||||
DIRT: 1
|
||||
DISPENSER: 5
|
||||
DOUBLE_PLANT: 2
|
||||
DOUBLE_STEP: 1
|
||||
DOUBLE_STONE_SLAB2: 1
|
||||
DRAGON_EGG: 150
|
||||
DRAGON_HEAD: 1
|
||||
DRAGON_WALL_HEAD: 1
|
||||
DRIED_KELP_BLOCK: 1
|
||||
DROPPER: 5
|
||||
EMERALD_BLOCK: 150
|
||||
EMERALD_ORE: 0
|
||||
ENCHANTMENT_TABLE: 150
|
||||
END_BRICKS: 2
|
||||
EMERALD_ORE: 1
|
||||
ENCHANTING_TABLE: 150
|
||||
ENDER_CHEST: 150
|
||||
ENDER_PORTAL_FRAME: 0
|
||||
ENDER_PORTAL: 0
|
||||
ENDER_STONE: 2
|
||||
EXPLOSIVE_MINECART: 10
|
||||
FENCE: 1
|
||||
FENCE_GATE: 1
|
||||
END_GATEWAY: 0
|
||||
END_PORTAL: 0
|
||||
END_PORTAL_FRAME: 0
|
||||
END_ROD: 1
|
||||
END_STONE: 1
|
||||
END_STONE_BRICKS: 2
|
||||
FARMLAND: 1
|
||||
FERN: 1
|
||||
FIRE: 0
|
||||
FLOWER_POT: 5
|
||||
FIRE_CORAL: 1
|
||||
FIRE_CORAL_BLOCK: 1
|
||||
FIRE_CORAL_FAN: 1
|
||||
FIRE_CORAL_WALL_FAN: 1
|
||||
FLOWER_POT: 1
|
||||
FROSTED_ICE: 1
|
||||
FURNACE: 10
|
||||
FURNACE: 8
|
||||
GLASS: 2
|
||||
GLASS_PANE: 1
|
||||
GLOWSTONE: 1
|
||||
GOLD_BLOCK: 150
|
||||
GOLD_ORE: 0
|
||||
GRASS: 5
|
||||
GRASS_PATH: 5
|
||||
GOLD_ORE: 1
|
||||
GRANITE: 1
|
||||
GRASS: 1
|
||||
GRASS_BLOCK: 1
|
||||
GRASS_PATH: 1
|
||||
GRAVEL: 1
|
||||
GRAY_BANNER: 2
|
||||
GRAY_BED: 2
|
||||
GRAY_CARPET: 1
|
||||
GRAY_CONCRETE: 1
|
||||
GRAY_CONCRETE_POWDER: 1
|
||||
GRAY_GLAZED_TERRACOTTA: 1
|
||||
GRAY_SHULKER_BOX: 1
|
||||
GRAVEL: 1
|
||||
GRAY_STAINED_GLASS: 2
|
||||
GRAY_STAINED_GLASS_PANE: 1
|
||||
GRAY_TERRACOTTA: 1
|
||||
GRAY_WALL_BANNER: 2
|
||||
GRAY_WOOL: 1
|
||||
GREEN_BANNER: 2
|
||||
GREEN_BED: 2
|
||||
GREEN_CARPET: 1
|
||||
GREEN_CONCRETE: 1
|
||||
GREEN_CONCRETE_POWDER: 1
|
||||
GREEN_GLAZED_TERRACOTTA: 1
|
||||
GREEN_SHULKER_BOX: 1
|
||||
HARD_CLAY: 2
|
||||
GREEN_STAINED_GLASS: 2
|
||||
GREEN_STAINED_GLASS_PANE: 1
|
||||
GREEN_TERRACOTTA: 1
|
||||
GREEN_WALL_BANNER: 2
|
||||
GREEN_WOOL: 1
|
||||
HAY_BLOCK: 2
|
||||
HOPPER: 10
|
||||
HOPPER_MINECART: 20
|
||||
HUGE_MUSHROOM_1: 1
|
||||
HUGE_MUSHROOM_2: 1
|
||||
HEAVY_WEIGHTED_PRESSURE_PLATE: 1
|
||||
HOPPER: -10
|
||||
HORN_CORAL: 1
|
||||
HORN_CORAL_BLOCK: 1
|
||||
HORN_CORAL_FAN: 1
|
||||
HORN_CORAL_WALL_FAN: 1
|
||||
ICE: 5
|
||||
INFESTED_CHISELED_STONE_BRICKS: 2
|
||||
INFESTED_COBBLESTONE: 1
|
||||
INFESTED_CRACKED_STONE_BRICKS: 2
|
||||
INFESTED_MOSSY_STONE_BRICKS: 2
|
||||
INFESTED_STONE: 1
|
||||
INFESTED_STONE_BRICKS: 2
|
||||
IRON_BARS: 1
|
||||
IRON_BLOCK: 10
|
||||
IRON_DOOR_BLOCK: 5
|
||||
IRON_FENCE: 5
|
||||
IRON_ORE: 0
|
||||
IRON_PLATE: 5
|
||||
IRON_DOOR: 5
|
||||
IRON_ORE: 1
|
||||
IRON_TRAPDOOR: 1
|
||||
ITEM_FRAME: 2
|
||||
JACK_O_LANTERN: 1
|
||||
JUKEBOX: 10
|
||||
JUNGLE_BUTTON: 1
|
||||
JUNGLE_DOOR: 1
|
||||
JUNGLE_FENCE: 1
|
||||
JUNGLE_FENCE: 2
|
||||
JUNGLE_FENCE_GATE: 1
|
||||
JUNGLE_WOOD_STAIRS: 1
|
||||
JUNGLE_LEAVES: 0
|
||||
JUNGLE_LOG: 0
|
||||
JUNGLE_PLANKS: 1
|
||||
JUNGLE_PRESSURE_PLATE: 1
|
||||
JUNGLE_SAPLING: 1
|
||||
JUNGLE_SLAB: 1
|
||||
JUNGLE_STAIRS: 2
|
||||
JUNGLE_TRAPDOOR: 1
|
||||
JUNGLE_WOOD: 1
|
||||
KELP: 1
|
||||
KELP_PLANT: 1
|
||||
LADDER: 1
|
||||
LAPIS_BLOCK: 10
|
||||
LAPIS_ORE: 0
|
||||
LAPIS_ORE: 1
|
||||
LARGE_FERN: 1
|
||||
LAVA: 0
|
||||
LEAVES_2: 1
|
||||
LEAVES: 1
|
||||
LEVER: 1
|
||||
LIGHT_BLUE_BANNER: 2
|
||||
LIGHT_BLUE_BED: 2
|
||||
LIGHT_BLUE_CARPET: 1
|
||||
LIGHT_BLUE_CONCRETE: 1
|
||||
LIGHT_BLUE_CONCRETE_POWDER: 1
|
||||
LIGHT_BLUE_GLAZED_TERRACOTTA: 1
|
||||
LIGHT_BLUE_SHULKER_BOX: 1
|
||||
LIGHT_BLUE_STAINED_GLASS: 2
|
||||
LIGHT_BLUE_STAINED_GLASS_PANE: 1
|
||||
LIGHT_BLUE_TERRACOTTA: 1
|
||||
LIGHT_BLUE_WALL_BANNER: 2
|
||||
LIGHT_BLUE_WOOL: 1
|
||||
LIGHT_GRAY_BANNER: 2
|
||||
LIGHT_GRAY_BED: 2
|
||||
LIGHT_GRAY_CARPET: 1
|
||||
LIGHT_GRAY_CONCRETE: 1
|
||||
LIGHT_GRAY_CONCRETE_POWDER: 1
|
||||
LIGHT_GRAY_GLAZED_TERRACOTTA: 1
|
||||
LIGHT_GRAY_SHULKER_BOX: 1
|
||||
LIGHT_GRAY_STAINED_GLASS: 2
|
||||
LIGHT_GRAY_STAINED_GLASS_PANE: 1
|
||||
LIGHT_GRAY_TERRACOTTA: 1
|
||||
LIGHT_GRAY_WALL_BANNER: 2
|
||||
LIGHT_GRAY_WOOL: 1
|
||||
LIGHT_WEIGHTED_PRESSURE_PLATE: 1
|
||||
LILAC: 1
|
||||
LILY_PAD: 5
|
||||
LIME_BANNER: 2
|
||||
LIME_BED: 2
|
||||
LIME_CARPET: 1
|
||||
LIME_CONCRETE: 1
|
||||
LIME_CONCRETE_POWDER: 1
|
||||
LIME_GLAZED_TERRACOTTA: 1
|
||||
LIME_SHULKER_BOX: 1
|
||||
LOG: 1
|
||||
#Other log types - examples
|
||||
#LOG:3: 2
|
||||
LOG_2: 1
|
||||
LONG_GRASS: 1
|
||||
LIME_STAINED_GLASS: 2
|
||||
LIME_STAINED_GLASS_PANE: 1
|
||||
LIME_TERRACOTTA: 1
|
||||
LIME_WALL_BANNER: 2
|
||||
LIME_WOOL: 1
|
||||
MAGENTA_BANNER: 2
|
||||
MAGENTA_BED: 2
|
||||
MAGENTA_CARPET: 1
|
||||
MAGENTA_CONCRETE: 1
|
||||
MAGENTA_CONCRETE_POWDER: 1
|
||||
MAGENTA_GLAZED_TERRACOTTA: 1
|
||||
MAGENTA_SHULKER_BOX: 1
|
||||
MAGMA: 1
|
||||
MELON_BLOCK: 1
|
||||
MAGENTA_STAINED_GLASS: 2
|
||||
MAGENTA_STAINED_GLASS_PANE: 1
|
||||
MAGENTA_TERRACOTTA: 1
|
||||
MAGENTA_WALL_BANNER: 2
|
||||
MAGENTA_WOOL: 1
|
||||
MAGMA_BLOCK: 1
|
||||
MELON: 1
|
||||
MELON_STEM: 1
|
||||
MINECART: 10
|
||||
MOB_SPAWNER: 0
|
||||
MOSSY_COBBLESTONE: 2
|
||||
MYCEL: 5
|
||||
NETHER_BRICK: 2
|
||||
NETHER_BRICK_STAIRS: 2
|
||||
NETHER_FENCE: 2
|
||||
NETHER_STALK: 1
|
||||
NETHER_WART_BLOCK: 2
|
||||
MOSSY_COBBLESTONE: 1
|
||||
MOSSY_COBBLESTONE_WALL: 1
|
||||
MOSSY_STONE_BRICKS: 2
|
||||
MOVING_PISTON: 1
|
||||
MUSHROOM_STEM: 1
|
||||
MYCELIUM: 5
|
||||
NETHERRACK: 1
|
||||
NETHER_BRICKS: 2
|
||||
NETHER_BRICK_FENCE: 2
|
||||
NETHER_BRICK_SLAB: 1
|
||||
NETHER_BRICK_STAIRS: 2
|
||||
NETHER_PORTAL: 1
|
||||
NETHER_QUARTZ_ORE: 1
|
||||
NETHER_WART: 1
|
||||
NETHER_WART_BLOCK: 2
|
||||
NOTE_BLOCK: 10
|
||||
OAK_BUTTON: 1
|
||||
OAK_DOOR: 1
|
||||
OAK_FENCE: 2
|
||||
OAK_FENCE_GATE: 1
|
||||
OAK_LEAVES: 0
|
||||
OAK_LOG: 0
|
||||
OAK_PLANKS: 1
|
||||
OAK_PRESSURE_PLATE: 1
|
||||
OAK_SAPLING: 1
|
||||
OAK_SLAB: 1
|
||||
OAK_STAIRS: 2
|
||||
OAK_TRAPDOOR: 1
|
||||
OAK_WOOD: 1
|
||||
OBSERVER: 1
|
||||
OBSIDIAN: 10
|
||||
ORANGE_BANNER: 2
|
||||
ORANGE_BED: 2
|
||||
ORANGE_CARPET: 1
|
||||
ORANGE_CONCRETE: 1
|
||||
ORANGE_CONCRETE_POWDER: 1
|
||||
ORANGE_GLAZED_TERRACOTTA: 1
|
||||
ORANGE_SHULKER_BOX: 1
|
||||
ORANGE_STAINED_GLASS: 2
|
||||
ORANGE_STAINED_GLASS_PANE: 1
|
||||
ORANGE_TERRACOTTA: 1
|
||||
ORANGE_TULIP: 1
|
||||
ORANGE_WALL_BANNER: 2
|
||||
ORANGE_WOOL: 1
|
||||
OXEYE_DAISY: 1
|
||||
PACKED_ICE: 5
|
||||
PAINTING: 2
|
||||
PEONY: 1
|
||||
PETRIFIED_OAK_SLAB: 1
|
||||
PINK_BANNER: 2
|
||||
PINK_BED: 2
|
||||
PINK_CARPET: 1
|
||||
PINK_CONCRETE: 1
|
||||
PINK_CONCRETE_POWDER: 1
|
||||
PINK_GLAZED_TERRACOTTA: 1
|
||||
PINK_SHULKER_BOX: 1
|
||||
PISTON_BASE: 2
|
||||
PISTON_STICKY_BASE: 2
|
||||
PORTAL: 0
|
||||
POWERED_MINECART: 10
|
||||
POWERED_RAIL: 10
|
||||
PRISMARINE: 10
|
||||
PUMPKIN_STEM: 1
|
||||
PINK_STAINED_GLASS: 2
|
||||
PINK_STAINED_GLASS_PANE: 1
|
||||
PINK_TERRACOTTA: 1
|
||||
PINK_TULIP: 1
|
||||
PINK_WALL_BANNER: 2
|
||||
PINK_WOOL: 1
|
||||
PISTON: 2
|
||||
PISTON_HEAD: 1
|
||||
PLAYER_HEAD: 1
|
||||
PLAYER_WALL_HEAD: 1
|
||||
PODZOL: 1
|
||||
POLISHED_ANDESITE: 1
|
||||
POLISHED_DIORITE: 1
|
||||
POLISHED_GRANITE: 1
|
||||
POPPY: 1
|
||||
POTATOES: 1
|
||||
POTTED_ACACIA_SAPLING: 1
|
||||
POTTED_ALLIUM: 1
|
||||
POTTED_AZURE_BLUET: 1
|
||||
POTTED_BIRCH_SAPLING: 1
|
||||
POTTED_BLUE_ORCHID: 1
|
||||
POTTED_BROWN_MUSHROOM: 1
|
||||
POTTED_CACTUS: 1
|
||||
POTTED_DANDELION: 1
|
||||
POTTED_DARK_OAK_SAPLING: 1
|
||||
POTTED_DEAD_BUSH: 1
|
||||
POTTED_FERN: 1
|
||||
POTTED_JUNGLE_SAPLING: 1
|
||||
POTTED_OAK_SAPLING: 1
|
||||
POTTED_ORANGE_TULIP: 1
|
||||
POTTED_OXEYE_DAISY: 1
|
||||
POTTED_PINK_TULIP: 1
|
||||
POTTED_POPPY: 1
|
||||
POTTED_RED_MUSHROOM: 1
|
||||
POTTED_RED_TULIP: 1
|
||||
POTTED_SPRUCE_SAPLING: 1
|
||||
POTTED_WHITE_TULIP: 1
|
||||
POWERED_RAIL: 1
|
||||
PRISMARINE: 1
|
||||
PRISMARINE_BRICKS: 2
|
||||
PRISMARINE_BRICK_SLAB: 1
|
||||
PRISMARINE_BRICK_STAIRS: 2
|
||||
PRISMARINE_SLAB: 1
|
||||
PRISMARINE_STAIRS: 2
|
||||
PUMPKIN: 1
|
||||
PUMPKIN_STEM: 1
|
||||
PURPLE_BANNER: 2
|
||||
PURPLE_BED: 2
|
||||
PURPLE_CARPET: 1
|
||||
PURPLE_CONCRETE: 1
|
||||
PURPLE_CONCRETE_POWDER: 1
|
||||
PURPLE_GLAZED_TERRACOTTA: 1
|
||||
PURPLE_SHULKER_BOX: 1
|
||||
PURPLE_STAINED_GLASS: 2
|
||||
PURPLE_STAINED_GLASS_PANE: 1
|
||||
PURPLE_TERRACOTTA: 1
|
||||
PURPLE_WALL_BANNER: 2
|
||||
PURPLE_WOOL: 1
|
||||
PURPUR_BLOCK: 1
|
||||
PURPUR_DOUBLE_SLAB: 1
|
||||
PURPUR_PILLAR: 1
|
||||
PURPUR_SLAB: 1
|
||||
PURPUR_STAIRS: 1
|
||||
PURPUR_STAIRS: 2
|
||||
QUARTZ_BLOCK: 1
|
||||
QUARTZ_ORE: 0
|
||||
QUARTZ_STAIRS: 1
|
||||
QUARTZ: 1
|
||||
RAILS: 1
|
||||
QUARTZ_PILLAR: 1
|
||||
QUARTZ_SLAB: 1
|
||||
QUARTZ_STAIRS: 2
|
||||
RAIL: 1
|
||||
REDSTONE_BLOCK: 10
|
||||
REDSTONE_LAMP: 10
|
||||
REDSTONE_ORE: 1
|
||||
REDSTONE_TORCH: 5
|
||||
REDSTONE_WALL_TORCH: 5
|
||||
REDSTONE_WIRE: 1
|
||||
RED_BED: 2
|
||||
RED_CARPET: 1
|
||||
RED_CONCRETE: 1
|
||||
RED_CONCRETE_POWDER: 1
|
||||
RED_GLAZED_TERRACOTTA: 1
|
||||
RED_MUSHROOM: 1
|
||||
RED_NETHER_BRICK: 2
|
||||
RED_ROSE: 1
|
||||
RED_MUSHROOM_BLOCK: 1
|
||||
RED_NETHER_BRICKS: 2
|
||||
RED_SAND: 1
|
||||
RED_SANDSTONE: 1
|
||||
RED_SANDSTONE_STAIRS: 1
|
||||
RED_SANDSTONE_SLAB: 1
|
||||
RED_SANDSTONE_STAIRS: 2
|
||||
RED_SHULKER_BOX: 1
|
||||
REDSTONE_BLOCK: 10
|
||||
REDSTONE_COMPARATOR_OFF: 10
|
||||
REDSTONE_COMPARATOR_ON: 10
|
||||
REDSTONE_COMPARATOR: 10
|
||||
REDSTONE_LAMP_OFF: 10
|
||||
REDSTONE_LAMP_ON: 10
|
||||
REDSTONE_ORE: 0
|
||||
REDSTONE_TORCH_OFF: 5
|
||||
REDSTONE_TORCH_ON: 5
|
||||
REDSTONE_WIRE: 1
|
||||
RED_STAINED_GLASS: 2
|
||||
RED_STAINED_GLASS_PANE: 1
|
||||
RED_TERRACOTTA: 1
|
||||
RED_TULIP: 1
|
||||
RED_WALL_BANNER: 2
|
||||
RED_WOOL: 1
|
||||
REPEATER: 1
|
||||
REPEATING_COMMAND_BLOCK: 1
|
||||
ROSE_BUSH: 1
|
||||
SAND: 1
|
||||
SANDSTONE: 1
|
||||
SANDSTONE_STAIRS: 1
|
||||
SANDSTONE_SLAB: 1
|
||||
SANDSTONE_STAIRS: 2
|
||||
SEAGRASS: 1
|
||||
SEA_LANTERN: 1
|
||||
SIGN_POST: 1
|
||||
SILVER_GLAZED_TERRACOTTA: 1
|
||||
SILVER_SHULKER_BOX: 1
|
||||
SKULL: 10
|
||||
SEA_PICKLE: 1
|
||||
SHULKER_BOX: 1
|
||||
SIGN: 1
|
||||
SKELETON_SKULL: 10
|
||||
SKELETON_WALL_SKULL: 100
|
||||
SLIME_BLOCK: 10
|
||||
SMOOTH_BRICK: 2
|
||||
SMOOTH_STAIRS: 2
|
||||
SMOOTH_QUARTZ: 1
|
||||
SMOOTH_RED_SANDSTONE: 1
|
||||
SMOOTH_SANDSTONE: 1
|
||||
SMOOTH_STONE: 1
|
||||
SNOW: 1
|
||||
SNOW_BLOCK: 1
|
||||
SOIL: 2
|
||||
SOUL_SAND: 2
|
||||
SPAWNER: 1
|
||||
SPONGE: 10
|
||||
SPRUCE_BUTTON: 1
|
||||
SPRUCE_DOOR: 1
|
||||
SPRUCE_FENCE: 1
|
||||
SPRUCE_FENCE: 2
|
||||
SPRUCE_FENCE_GATE: 1
|
||||
SPRUCE_WOOD_STAIRS: 1
|
||||
STAINED_CLAY: 2
|
||||
STAINED_GLASS: 2
|
||||
STAINED_GLASS_PANE: 1
|
||||
STATIONARY_LAVA: 0
|
||||
STATIONARY_WATER: 0
|
||||
STEP: 1
|
||||
SPRUCE_LEAVES: 0
|
||||
SPRUCE_LOG: 0
|
||||
SPRUCE_PLANKS: 1
|
||||
SPRUCE_PRESSURE_PLATE: 1
|
||||
SPRUCE_SAPLING: 1
|
||||
SPRUCE_SLAB: 1
|
||||
SPRUCE_STAIRS: 2
|
||||
SPRUCE_TRAPDOOR: 1
|
||||
SPRUCE_WOOD: 1
|
||||
STICKY_PISTON: 1
|
||||
STONE: 1
|
||||
STONE_BRICKS: 2
|
||||
STONE_BRICK_SLAB: 1
|
||||
STONE_BRICK_STAIRS: 2
|
||||
STONE_BUTTON: 1
|
||||
STONE_PLATE: 2
|
||||
STORAGE_MINECART: 10
|
||||
SUGAR_CANE_BLOCK: 1
|
||||
THIN_GLASS: 1
|
||||
STONE_PRESSURE_PLATE: 1
|
||||
STONE_SLAB: 1
|
||||
STRIPPED_ACACIA_LOG: 0
|
||||
STRIPPED_ACACIA_WOOD: 1
|
||||
STRIPPED_BIRCH_LOG: 0
|
||||
STRIPPED_BIRCH_WOOD: 1
|
||||
STRIPPED_DARK_OAK_LOG: 0
|
||||
STRIPPED_DARK_OAK_WOOD: 1
|
||||
STRIPPED_JUNGLE_LOG: 0
|
||||
STRIPPED_JUNGLE_WOOD: 1
|
||||
STRIPPED_OAK_LOG: 0
|
||||
STRIPPED_OAK_WOOD: 1
|
||||
STRIPPED_SPRUCE_LOG: 0
|
||||
STRIPPED_SPRUCE_WOOD: 1
|
||||
SUGAR_CANE: 1
|
||||
SUNFLOWER: 1
|
||||
TALL_GRASS: 1
|
||||
TALL_SEAGRASS: 1
|
||||
TERRACOTTA: 1
|
||||
TNT: 5
|
||||
TORCH: 2
|
||||
TRAP_DOOR: 5
|
||||
TRAPPED_CHEST: 10
|
||||
TRIPWIRE_HOOK: 2
|
||||
TORCH: 1
|
||||
TRAPPED_CHEST: 5
|
||||
TRIPWIRE: 2
|
||||
TRIPWIRE_HOOK: 2
|
||||
TUBE_CORAL: 1
|
||||
TUBE_CORAL_BLOCK: 1
|
||||
TUBE_CORAL_FAN: 1
|
||||
TUBE_CORAL_WALL_FAN: 1
|
||||
TURTLE_EGG: 1
|
||||
VINE: 1
|
||||
VOID_AIR: 1
|
||||
WALL_SIGN: 1
|
||||
WATER_LILY: 5
|
||||
WEB: 10
|
||||
WALL_TORCH: 1
|
||||
WATER: 0
|
||||
WET_SPONGE: 10
|
||||
WHEAT: 1
|
||||
WHITE_BANNER: 2
|
||||
WHITE_BED: 2
|
||||
WHITE_CARPET: 1
|
||||
WHITE_CONCRETE: 1
|
||||
WHITE_CONCRETE_POWDER: 1
|
||||
WHITE_GLAZED_TERRACOTTA: 1
|
||||
WHITE_SHULKER_BOX: 1
|
||||
WOOD: 1
|
||||
WOOD_BUTTON: 1
|
||||
WOOD_DOOR: 1
|
||||
WOOD_DOUBLE_STEP: 1
|
||||
WOOD_PLATE: 1
|
||||
WOOD_STAIRS: 1
|
||||
WOOD_STEP: 1
|
||||
WOODEN_DOOR: 1
|
||||
WOOL: 1
|
||||
WORKBENCH: 1
|
||||
YELLOW_FLOWER: 1
|
||||
WHITE_STAINED_GLASS: 2
|
||||
WHITE_STAINED_GLASS_PANE: 1
|
||||
WHITE_TERRACOTTA: 1
|
||||
WHITE_TULIP: 1
|
||||
WHITE_WALL_BANNER: 2
|
||||
WHITE_WOOL: 1
|
||||
WITHER_SKELETON_SKULL: 10
|
||||
WITHER_SKELETON_WALL_SKULL: 10
|
||||
YELLOW_BANNER: 2
|
||||
YELLOW_BED: 2
|
||||
YELLOW_CARPET: 1
|
||||
YELLOW_CONCRETE: 1
|
||||
YELLOW_CONCRETE_POWDER: 1
|
||||
YELLOW_GLAZED_TERRACOTTA: 1
|
||||
YELLOW_SHULKER_BOX: 1
|
||||
YELLOW_STAINED_GLASS: 2
|
||||
YELLOW_STAINED_GLASS_PANE: 1
|
||||
YELLOW_TERRACOTTA: 1
|
||||
YELLOW_WALL_BANNER: 2
|
||||
YELLOW_WOOL: 1
|
||||
ZOMBIE_HEAD: 1
|
||||
ZOMBIE_WALL_HEAD: 1
|
||||
|
||||
# World differences
|
||||
# List any blocks that have a different value in a specific world
|
||||
|
20
pom.xml
20
pom.xml
@ -40,11 +40,12 @@
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.13-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>us.tastybento</groupId>
|
||||
<artifactId>bskyblock</artifactId>
|
||||
@ -64,13 +65,4 @@
|
||||
</repository>
|
||||
</repositories>
|
||||
<groupId>bskyblock.addon</groupId>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.12.2-R0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
@ -12,10 +12,12 @@ import bskyblock.addon.level.commands.IslandLevel;
|
||||
import bskyblock.addon.level.commands.IslandTop;
|
||||
import bskyblock.addon.level.config.Settings;
|
||||
import bskyblock.addon.level.database.object.LevelsData;
|
||||
import bskyblock.addon.level.listeners.NewIslandListener;
|
||||
import us.tastybento.bskyblock.api.addons.Addon;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
|
||||
/**
|
||||
@ -31,7 +33,7 @@ public class Level extends Addon {
|
||||
// Database handler for level data
|
||||
private BSBDatabase<LevelsData> handler;
|
||||
|
||||
// A cache of island levels.
|
||||
// A cache of island levels.
|
||||
private Map<UUID, LevelsData> levelsCache;
|
||||
|
||||
// The Top Ten object
|
||||
@ -42,14 +44,12 @@ public class Level extends Addon {
|
||||
|
||||
/**
|
||||
* Calculates a user's island
|
||||
* @param world
|
||||
* @param user
|
||||
* @param playerUUID - the player's UUID
|
||||
* @param b
|
||||
* @param permPrefix
|
||||
* @param world - the world where this island is
|
||||
* @param user - the user who is asking, or null if none
|
||||
* @param playerUUID - the target island member's UUID
|
||||
*/
|
||||
public void calculateIslandLevel(World world, User user, UUID playerUUID, boolean b, String permPrefix) {
|
||||
levelCalc.calculateIslandLevel(world, user, playerUUID, b, permPrefix);
|
||||
public void calculateIslandLevel(World world, User user, UUID playerUUID) {
|
||||
levelCalc.calculateIslandLevel(world, user, playerUUID);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -57,7 +57,7 @@ public class Level extends Addon {
|
||||
* @param targetPlayer
|
||||
* @return Level of player
|
||||
*/
|
||||
public long getIslandLevel(World world, UUID targetPlayer) {
|
||||
public long getIslandLevel(World world, UUID targetPlayer) {
|
||||
LevelsData ld = getLevelsData(targetPlayer);
|
||||
return ld == null ? 0L : ld.getLevel(world);
|
||||
}
|
||||
@ -129,7 +129,10 @@ public class Level extends Addon {
|
||||
CompositeCommand bsbAdminCmd = getBSkyBlock().getCommandsManager().getCommand("bsbadmin");
|
||||
new AdminLevel(this, bsbAdminCmd);
|
||||
new AdminTop(this, bsbAdminCmd);
|
||||
// Register new island listener
|
||||
registerListener(new NewIslandListener(this));
|
||||
// Done
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,12 +150,11 @@ public class Level extends Addon {
|
||||
|
||||
/**
|
||||
* Sets the player's level to a value
|
||||
* @param world
|
||||
* @param world
|
||||
* @param targetPlayer
|
||||
* @param level
|
||||
* @param permPrefix
|
||||
*/
|
||||
protected void setIslandLevel(World world, UUID targetPlayer, long level, String permPrefix) {
|
||||
public void setIslandLevel(World world, UUID targetPlayer, long level) {
|
||||
LevelsData ld = getLevelsData(targetPlayer);
|
||||
if (ld == null) {
|
||||
ld = new LevelsData(targetPlayer, level, world);
|
||||
@ -161,9 +163,20 @@ public class Level extends Addon {
|
||||
}
|
||||
// Add to cache
|
||||
levelsCache.put(targetPlayer, ld);
|
||||
topTen.addEntry(world, targetPlayer, level, permPrefix);
|
||||
topTen.addEntry(world, targetPlayer, getIslandLevel(world, targetPlayer));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the initial island level
|
||||
* @param island - island
|
||||
* @param level - initial calculated island level
|
||||
*/
|
||||
public void setInitialIslandLevel(Island island, long level) {
|
||||
setIslandLevel(island.getWorld(), island.getOwner(), level);
|
||||
levelsCache.get(island.getOwner()).setInitialIslandLevel(level);
|
||||
}
|
||||
|
||||
|
||||
public BSBDatabase<LevelsData> getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
@ -6,20 +6,21 @@ import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import bskyblock.addon.level.calculators.PlayerLevel;
|
||||
import us.tastybento.bskyblock.BSkyBlock;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
|
||||
public class LevelPresenter {
|
||||
|
||||
private int levelWait;
|
||||
private final Level plugin;
|
||||
private final Level addon;
|
||||
private final BSkyBlock bSkyBlock;
|
||||
|
||||
// Level calc cool down
|
||||
private HashMap<UUID, Long> levelWaitTime = new HashMap<UUID, Long>();
|
||||
|
||||
public LevelPresenter(Level plugin, BSkyBlock bSkyBlock) {
|
||||
this.plugin = plugin;
|
||||
this.addon = plugin;
|
||||
this.bSkyBlock = bSkyBlock;
|
||||
}
|
||||
|
||||
@ -28,12 +29,12 @@ public class LevelPresenter {
|
||||
* @param world - world to check
|
||||
* @param sender - asker of the level info
|
||||
* @param targetPlayer
|
||||
* @param report - if true, a detailed report will be provided
|
||||
* @param permPrefix - per prefix for this player
|
||||
* @return - false if this is cannot be done
|
||||
*/
|
||||
public boolean calculateIslandLevel(World world, final User sender, UUID targetPlayer, boolean report, String permPrefix) {
|
||||
// Check if sender has island
|
||||
public boolean calculateIslandLevel(World world, final User sender, UUID targetPlayer) {
|
||||
// Get permission prefix for this world
|
||||
String permPrefix = bSkyBlock.getIWM().getPermissionPrefix(world);
|
||||
// Check if target has island
|
||||
boolean inTeam = false;
|
||||
if (!bSkyBlock.getIslands().hasIsland(world, targetPlayer)) {
|
||||
// Player may be in a team
|
||||
@ -51,7 +52,7 @@ public class LevelPresenter {
|
||||
if (!onLevelWaitTime(sender) || levelWait <= 0 || sender.isOp() || sender.hasPermission(permPrefix + "mod.info")) {
|
||||
sender.sendMessage("island.level.calculating");
|
||||
setLevelWaitTime(sender);
|
||||
new LevelCalcByChunk(plugin, bSkyBlock.getIslands().getIsland(world, targetPlayer), targetPlayer, sender, report, permPrefix);
|
||||
new PlayerLevel(addon, bSkyBlock.getIslands().getIsland(world, targetPlayer), targetPlayer, sender);
|
||||
} else {
|
||||
// Cooldown
|
||||
sender.sendMessage("island.level.cooldown", "[time]", String.valueOf(getLevelWaitTime(sender)));
|
||||
@ -59,14 +60,14 @@ public class LevelPresenter {
|
||||
|
||||
} else {
|
||||
// Asking for the level of another player
|
||||
sender.sendMessage("island.level.island-level-is","[level]", String.valueOf(plugin.getIslandLevel(world, targetPlayer)));
|
||||
sender.sendMessage("island.level.island-level-is","[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets cool down for the level command
|
||||
*
|
||||
*
|
||||
* @param player
|
||||
*/
|
||||
private void setLevelWaitTime(final User player) {
|
||||
|
@ -26,9 +26,9 @@ import us.tastybento.bskyblock.database.BSBDatabase;
|
||||
|
||||
/**
|
||||
* Handles all Top Ten List functions
|
||||
*
|
||||
*
|
||||
* @author tastybento
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class TopTen implements Listener {
|
||||
private Level addon;
|
||||
@ -48,11 +48,11 @@ public class TopTen implements Listener {
|
||||
|
||||
/**
|
||||
* Adds a player to the top ten, if the level is good enough
|
||||
*
|
||||
*
|
||||
* @param ownerUUID
|
||||
* @param l
|
||||
*/
|
||||
public void addEntry(World world, UUID ownerUUID, long l, String permPrefix) {
|
||||
public void addEntry(World world, UUID ownerUUID, long l) {
|
||||
// Check if player is an island owner or not
|
||||
if (!addon.getIslands().isOwner(world, ownerUUID)) {
|
||||
return;
|
||||
@ -60,12 +60,12 @@ public class TopTen implements Listener {
|
||||
// Set up world data
|
||||
topTenList.putIfAbsent(world, new TopTenData());
|
||||
topTenList.get(world).setUniqueId(world.getName());
|
||||
|
||||
|
||||
// Try and see if the player is online
|
||||
Player player = addon.getServer().getPlayer(ownerUUID);
|
||||
if (player != null) {
|
||||
// Online
|
||||
if (!player.hasPermission(permPrefix + "intopten")) {
|
||||
if (!player.hasPermission(addon.getBSkyBlock().getIWM().getPermissionPrefix(world) + ".intopten")) {
|
||||
topTenList.get(world).remove(ownerUUID);
|
||||
return;
|
||||
}
|
||||
@ -89,15 +89,15 @@ public class TopTen implements Listener {
|
||||
// Convert to UUID
|
||||
UUID playerUUID = UUID.fromString(lv.getUniqueId());
|
||||
// Get the world
|
||||
lv.getLevels().forEach((k,v) -> addEntry(Bukkit.getWorld(k), playerUUID, v, permPrefix));
|
||||
lv.getLevels().forEach((k,v) -> addEntry(Bukkit.getWorld(k), playerUUID, v));
|
||||
}
|
||||
saveTopTen();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the Top Ten list
|
||||
* @param world
|
||||
*
|
||||
* @param world
|
||||
*
|
||||
* @param user
|
||||
* - the requesting player
|
||||
* @return - true if successful, false if no Top Ten list exists
|
||||
@ -201,7 +201,7 @@ public class TopTen implements Listener {
|
||||
|
||||
/**
|
||||
* Removes ownerUUID from the top ten list
|
||||
*
|
||||
*
|
||||
* @param ownerUUID
|
||||
*/
|
||||
public void removeEntry(World world, UUID ownerUUID) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
package bskyblock.addon.level;
|
||||
package bskyblock.addon.level.calculators;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -7,15 +7,11 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChunkSnapshot;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import com.google.common.collect.HashMultiset;
|
||||
@ -23,14 +19,13 @@ import com.google.common.collect.Multiset;
|
||||
import com.google.common.collect.Multiset.Entry;
|
||||
import com.google.common.collect.Multisets;
|
||||
|
||||
import bskyblock.addon.level.event.IslandPostLevelEvent;
|
||||
import bskyblock.addon.level.event.IslandPreLevelEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import bskyblock.addon.level.Level;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
import us.tastybento.bskyblock.util.Pair;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
|
||||
public class LevelCalcByChunk {
|
||||
public class CalcIslandLevel {
|
||||
|
||||
private static final int MAX_CHUNKS = 200;
|
||||
private static final long SPEED = 1;
|
||||
@ -42,27 +37,26 @@ public class LevelCalcByChunk {
|
||||
private Set<Pair<Integer, Integer>> chunksToScan;
|
||||
private Island island;
|
||||
private World world;
|
||||
private User asker;
|
||||
private UUID targetPlayer;
|
||||
private Results result;
|
||||
private Runnable onExit;
|
||||
|
||||
// Copy the limits hashmap
|
||||
HashMap<MaterialData, Integer> limitCount;
|
||||
private boolean report;
|
||||
private long oldLevel;
|
||||
private String permPrefix;
|
||||
HashMap<Material, Integer> limitCount;
|
||||
|
||||
|
||||
public LevelCalcByChunk(final Level addon, final Island island, final UUID targetPlayer, final User asker, final boolean report, String permPrefix) {
|
||||
/**
|
||||
* Calculate the island's level
|
||||
* Results are available in {@link CalcIslandLevel.Results}
|
||||
* @param addon - Level addon
|
||||
* @param island - island to be calculated
|
||||
* @param onExit - what to run when done
|
||||
*/
|
||||
public CalcIslandLevel(final Level addon, final Island island, final Runnable onExit) {
|
||||
this.addon = addon;
|
||||
this.island = island;
|
||||
this.world = island != null ? island.getCenter().getWorld() : null;
|
||||
this.asker = asker;
|
||||
this.targetPlayer = targetPlayer;
|
||||
this.limitCount = new HashMap<>(addon.getSettings().getBlockLimits());
|
||||
this.report = report;
|
||||
this.oldLevel = addon.getIslandLevel(world, targetPlayer);
|
||||
this.permPrefix = permPrefix;
|
||||
this.onExit = onExit;
|
||||
|
||||
// Results go here
|
||||
result = new Results();
|
||||
@ -110,13 +104,12 @@ public class LevelCalcByChunk {
|
||||
}
|
||||
// Nothing happened, change state
|
||||
checking = true;
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private void scanChunk(ChunkSnapshot chunk) {
|
||||
for (int x = 0; x< 16; x++) {
|
||||
for (int x = 0; x< 16; x++) {
|
||||
// Check if the block coord is inside the protection zone and if not, don't count it
|
||||
if (chunk.getX() * 16 + x < island.getMinProtectedX() || chunk.getX() * 16 + x >= island.getMinProtectedX() + island.getProtectionRange() * 2) {
|
||||
continue;
|
||||
@ -128,28 +121,25 @@ public class LevelCalcByChunk {
|
||||
}
|
||||
|
||||
for (int y = 0; y < island.getCenter().getWorld().getMaxHeight(); y++) {
|
||||
Material blockType = chunk.getBlockType(x, y, z);
|
||||
Material blockData = chunk.getBlockType(x, y, z);
|
||||
boolean belowSeaLevel = (addon.getSettings().getSeaHeight() > 0 && y<=addon.getSettings().getSeaHeight()) ? true : false;
|
||||
// Air is free
|
||||
if (!blockType.equals(Material.AIR)) {
|
||||
checkBlock(blockType, chunk.getBlockData(x, y, z), belowSeaLevel);
|
||||
if (!blockData.equals(Material.AIR)) {
|
||||
checkBlock(blockData, belowSeaLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBlock(Material type, int blockData, boolean belowSeaLevel) {
|
||||
// Currently, there is no alternative to using block data (Feb 2018)
|
||||
@SuppressWarnings("deprecation")
|
||||
MaterialData md = new MaterialData(type, (byte) blockData);
|
||||
private void checkBlock(Material md, boolean belowSeaLevel) {
|
||||
int count = limitCount(md);
|
||||
if (belowSeaLevel) {
|
||||
result.underWaterBlockCount += count;
|
||||
result.underWaterBlockCount += count;
|
||||
result.uwCount.add(md);
|
||||
} else {
|
||||
result.rawBlockCount += count;
|
||||
result.mdCount.add(md);
|
||||
result.mdCount.add(md);
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,8 +148,7 @@ public class LevelCalcByChunk {
|
||||
* @param md
|
||||
* @return value of the block if can be counted
|
||||
*/
|
||||
private int limitCount(MaterialData md) {
|
||||
MaterialData generic = new MaterialData(md.getItemType());
|
||||
private int limitCount(Material md) {
|
||||
if (limitCount.containsKey(md)) {
|
||||
int count = limitCount.get(md);
|
||||
if (count > 0) {
|
||||
@ -169,34 +158,24 @@ public class LevelCalcByChunk {
|
||||
result.ofCount.add(md);
|
||||
return 0;
|
||||
}
|
||||
} else if (limitCount.containsKey(generic)) {
|
||||
int count = limitCount.get(generic);
|
||||
if (count > 0) {
|
||||
limitCount.put(generic, --count);
|
||||
return getValue(generic);
|
||||
} else {
|
||||
result.ofCount.add(md);
|
||||
return 0;
|
||||
}
|
||||
} else if (addon.getSettings().getBlockValues().containsKey(md)) {
|
||||
return getValue(md);
|
||||
} else if (addon.getSettings().getBlockValues().containsKey(generic)) {
|
||||
return getValue(generic);
|
||||
} else {
|
||||
result.ncCount.add(md);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get value of a material
|
||||
* World blocks trump regular block values
|
||||
* @param md
|
||||
* @return
|
||||
* @return value of a material
|
||||
*/
|
||||
private int getValue(MaterialData md) {
|
||||
private int getValue(Material md) {
|
||||
if (addon.getSettings().getWorldBlockValues().containsKey(world) && addon.getSettings().getWorldBlockValues().get(world).containsKey(md)) {
|
||||
return addon.getSettings().getWorldBlockValues().get(world).get(md);
|
||||
}
|
||||
return addon.getSettings().getWorldBlockValues().get(world).get(md);
|
||||
}
|
||||
return addon.getSettings().getBlockValues().getOrDefault(md, 0);
|
||||
}
|
||||
|
||||
@ -220,121 +199,33 @@ public class LevelCalcByChunk {
|
||||
// Cancel
|
||||
task.cancel();
|
||||
// Finalize calculations
|
||||
result.rawBlockCount += (long)((double)result.underWaterBlockCount * addon.getSettings().getUnderWaterMultiplier());
|
||||
result.rawBlockCount += (long)(result.underWaterBlockCount * addon.getSettings().getUnderWaterMultiplier());
|
||||
// Set the death penalty
|
||||
result.deathHandicap = addon.getPlayers().getDeaths(island.getOwner());
|
||||
// Set final score
|
||||
result.score = (result.rawBlockCount / addon.getSettings().getLevelCost()) - result.deathHandicap - island.getLevelHandicap();
|
||||
// Run any modifications
|
||||
// Get the permission multiplier if it is available
|
||||
int levelMultiplier = 1;
|
||||
Player player = addon.getServer().getPlayer(targetPlayer);
|
||||
if (player != null) {
|
||||
// Get permission multiplier
|
||||
for (PermissionAttachmentInfo perms : player.getEffectivePermissions()) {
|
||||
if (perms.getPermission().startsWith(permPrefix + "island.multiplier.")) {
|
||||
String spl[] = perms.getPermission().split(permPrefix + "island.multiplier.");
|
||||
if (spl.length > 1) {
|
||||
if (!NumberUtils.isDigits(spl[1])) {
|
||||
addon.getLogger().severe("Player " + player.getName() + " has permission: " + perms.getPermission() + " <-- the last part MUST be a number! Ignoring...");
|
||||
} else {
|
||||
// Get the max value should there be more than one
|
||||
levelMultiplier = Math.max(levelMultiplier, Integer.valueOf(spl[1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Do some sanity checking
|
||||
if (levelMultiplier < 1) {
|
||||
levelMultiplier = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
result.level = (result.rawBlockCount / addon.getSettings().getLevelCost()) - result.deathHandicap - island.getLevelHandicap();
|
||||
// Calculate how many points are required to get to the next level
|
||||
long pointsToNextLevel = (addon.getSettings().getLevelCost() * (result.score + 1 + island.getLevelHandicap())) - ((result.rawBlockCount * levelMultiplier) - (result.deathHandicap * addon.getSettings().getDeathPenalty()));
|
||||
result.pointsToNextLevel = (addon.getSettings().getLevelCost() * (result.level + 1 + island.getLevelHandicap())) - (result.rawBlockCount - (result.deathHandicap * addon.getSettings().getDeathPenalty()));
|
||||
// Sometimes it will return 0, so calculate again to make sure it will display a good value
|
||||
if(pointsToNextLevel == 0) pointsToNextLevel = (addon.getSettings().getLevelCost() * (result.score + 2 + island.getLevelHandicap()) - ((result.rawBlockCount * levelMultiplier) - (result.deathHandicap * addon.getSettings().getDeathPenalty())));
|
||||
|
||||
if(result.pointsToNextLevel == 0) result.pointsToNextLevel = (addon.getSettings().getLevelCost() * (result.level + 2 + island.getLevelHandicap()) - (result.rawBlockCount - (result.deathHandicap * addon.getSettings().getDeathPenalty())));
|
||||
// Report
|
||||
result.report = getReport();
|
||||
// All done.
|
||||
informPlayers(saveLevel(island, targetPlayer, pointsToNextLevel));
|
||||
|
||||
}
|
||||
|
||||
private void informPlayers(IslandPreLevelEvent event) {
|
||||
// Fire the island post level calculation event
|
||||
final IslandPostLevelEvent event3 = new IslandPostLevelEvent(targetPlayer, island, event.getLevel(), event.getPointsToNextLevel());
|
||||
addon.getServer().getPluginManager().callEvent(event3);
|
||||
|
||||
if(event3.isCancelled() || asker == null) {
|
||||
return;
|
||||
}
|
||||
// Tell the asker
|
||||
asker.sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
|
||||
// Console
|
||||
if (report) {
|
||||
sendConsoleReport(asker);
|
||||
}
|
||||
// Check if player - if so show some more info
|
||||
if (!(asker instanceof Player)) {
|
||||
return;
|
||||
}
|
||||
// Player
|
||||
if (addon.getSettings().getDeathPenalty() != 0) {
|
||||
asker.sendMessage("island.level.deaths", "[number]", String.valueOf(result.deathHandicap));
|
||||
}
|
||||
// Send player how many points are required to reach next island level
|
||||
if (event.getPointsToNextLevel() >= 0) {
|
||||
asker.sendMessage("island.level.required-points-to-next-level", "[points]", String.valueOf(event.getPointsToNextLevel()));
|
||||
}
|
||||
// Tell other team members
|
||||
if (addon.getIslandLevel(world, targetPlayer) != oldLevel) {
|
||||
for (UUID member : island.getMemberSet()) {
|
||||
if (!member.equals(asker.getUniqueId())) {
|
||||
User.getInstance(member).sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
|
||||
}
|
||||
}
|
||||
if (onExit != null) {
|
||||
Bukkit.getScheduler().runTask(addon.getBSkyBlock(), onExit);
|
||||
}
|
||||
}
|
||||
|
||||
private IslandPreLevelEvent saveLevel(Island island, UUID targetPlayer, long pointsToNextLevel) {
|
||||
// Fire the pre-level event
|
||||
final IslandPreLevelEvent event = new IslandPreLevelEvent(targetPlayer, island, result.score);
|
||||
event.setPointsToNextLevel(pointsToNextLevel);
|
||||
addon.getServer().getPluginManager().callEvent(event);
|
||||
if (!event.isCancelled()) {
|
||||
// Save the value
|
||||
addon.setIslandLevel(world, island.getOwner(), event.getLevel(), permPrefix);
|
||||
if (addon.getIslands().inTeam(island.getWorld(), targetPlayer)) {
|
||||
//plugin.getLogger().info("DEBUG: player is in team");
|
||||
for (UUID member : addon.getIslands().getMembers(island.getWorld(), targetPlayer)) {
|
||||
//plugin.getLogger().info("DEBUG: updating team member level too");
|
||||
if (addon.getIslandLevel(world, member) != event.getLevel()) {
|
||||
addon.setIslandLevel(world, member, event.getLevel(), permPrefix);
|
||||
}
|
||||
}
|
||||
if (addon.getIslands().inTeam(island.getWorld(), targetPlayer)) {
|
||||
UUID leader = addon.getIslands().getTeamLeader(island.getWorld(), targetPlayer);
|
||||
if (leader != null) {
|
||||
addon.getTopTen().addEntry(world, leader, event.getLevel(), permPrefix);
|
||||
}
|
||||
} else {
|
||||
addon.getTopTen().addEntry(world, targetPlayer, event.getLevel(), permPrefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
private void sendConsoleReport(User asker) {
|
||||
private List<String> getReport() {
|
||||
List<String> reportLines = new ArrayList<>();
|
||||
// provide counts
|
||||
reportLines.add("Level Log for island at " + island.getCenter());
|
||||
reportLines.add("Level Log for island in " + addon.getBSkyBlock().getIWM().getFriendlyName(island.getWorld()) + " at " + Util.xyz(island.getCenter().toVector()));
|
||||
reportLines.add("Island owner UUID = " + island.getOwner());
|
||||
reportLines.add("Total block value count = " + String.format("%,d",result.rawBlockCount));
|
||||
reportLines.add("Level cost = " + addon.getSettings().getLevelCost());
|
||||
//reportLines.add("Level multiplier = " + levelMultiplier + " (Player must be online to get a permission multiplier)");
|
||||
//reportLines.add("Schematic level handicap = " + levelHandicap + " (level is reduced by this amount)");
|
||||
reportLines.add("Deaths handicap = " + result.deathHandicap);
|
||||
reportLines.add("Level calculated = " + result.score);
|
||||
reportLines.add("Level calculated = " + result.level);
|
||||
reportLines.add("==================================");
|
||||
int total = 0;
|
||||
if (!result.uwCount.isEmpty()) {
|
||||
@ -348,14 +239,14 @@ public class LevelCalcByChunk {
|
||||
|
||||
reportLines.add("Blocks not counted because they exceeded limits: " + String.format("%,d",result.ofCount.size()));
|
||||
//entriesSortedByCount = Multisets.copyHighestCountFirst(ofCount).entrySet();
|
||||
Iterable<Multiset.Entry<MaterialData>> entriesSortedByCount = result.ofCount.entrySet();
|
||||
Iterator<Entry<MaterialData>> it = entriesSortedByCount.iterator();
|
||||
Iterable<Multiset.Entry<Material>> entriesSortedByCount = result.ofCount.entrySet();
|
||||
Iterator<Entry<Material>> it = entriesSortedByCount.iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<MaterialData> type = it.next();
|
||||
Entry<Material> type = it.next();
|
||||
Integer limit = addon.getSettings().getBlockLimits().get(type.getElement());
|
||||
String explain = ")";
|
||||
if (limit == null) {
|
||||
MaterialData generic = new MaterialData(type.getElement().getItemType());
|
||||
Material generic = type.getElement();
|
||||
limit = addon.getSettings().getBlockLimits().get(generic);
|
||||
explain = " - All types)";
|
||||
}
|
||||
@ -368,33 +259,28 @@ public class LevelCalcByChunk {
|
||||
entriesSortedByCount = result.ncCount.entrySet();
|
||||
it = entriesSortedByCount.iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<MaterialData> type = it.next();
|
||||
Entry<Material> type = it.next();
|
||||
reportLines.add(type.getElement().toString() + ": " + String.format("%,d",type.getCount()) + " blocks");
|
||||
}
|
||||
}
|
||||
reportLines.add("=================================");
|
||||
|
||||
for (String line : reportLines) {
|
||||
asker.sendRawMessage(line);
|
||||
}
|
||||
return reportLines;
|
||||
}
|
||||
|
||||
private Collection<String> sortedReport(int total, Multiset<MaterialData> materialDataCount) {
|
||||
private Collection<String> sortedReport(int total, Multiset<Material> MaterialCount) {
|
||||
Collection<String> result = new ArrayList<>();
|
||||
Iterable<Multiset.Entry<MaterialData>> entriesSortedByCount = Multisets.copyHighestCountFirst(materialDataCount).entrySet();
|
||||
Iterator<Entry<MaterialData>> it = entriesSortedByCount.iterator();
|
||||
Iterable<Multiset.Entry<Material>> entriesSortedByCount = Multisets.copyHighestCountFirst(MaterialCount).entrySet();
|
||||
Iterator<Entry<Material>> it = entriesSortedByCount.iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<MaterialData> en = it.next();
|
||||
MaterialData type = en.getElement();
|
||||
Entry<Material> en = it.next();
|
||||
Material type = en.getElement();
|
||||
|
||||
int value = 0;
|
||||
if (addon.getSettings().getBlockValues().containsKey(type)) {
|
||||
// Specific
|
||||
value = addon.getSettings().getBlockValues().get(type);
|
||||
} else if (addon.getSettings().getBlockValues().containsKey(new MaterialData(type.getItemType()))) {
|
||||
// Generic
|
||||
value = addon.getSettings().getBlockValues().get(new MaterialData(type.getItemType()));
|
||||
}
|
||||
result.add(type.toString() + ":"
|
||||
result.add(type.toString() + ":"
|
||||
+ String.format("%,d",en.getCount()) + " blocks x " + value + " = " + (value * en.getCount()));
|
||||
total += (value * en.getCount());
|
||||
}
|
||||
@ -403,19 +289,76 @@ public class LevelCalcByChunk {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the result
|
||||
*/
|
||||
public Results getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Results class
|
||||
*
|
||||
*/
|
||||
public class Results {
|
||||
Multiset<MaterialData> mdCount = HashMultiset.create();
|
||||
Multiset<MaterialData> uwCount = HashMultiset.create();
|
||||
Multiset<MaterialData> ncCount = HashMultiset.create();
|
||||
Multiset<MaterialData> ofCount = HashMultiset.create();
|
||||
long rawBlockCount = 0;
|
||||
Island island;
|
||||
long underWaterBlockCount = 0;
|
||||
long score = 0;
|
||||
int deathHandicap = 0;
|
||||
private List<String> report;
|
||||
private Multiset<Material> mdCount = HashMultiset.create();
|
||||
private Multiset<Material> uwCount = HashMultiset.create();
|
||||
private Multiset<Material> ncCount = HashMultiset.create();
|
||||
private Multiset<Material> ofCount = HashMultiset.create();
|
||||
private long rawBlockCount = 0;
|
||||
private long underWaterBlockCount = 0;
|
||||
private long level = 0;
|
||||
private int deathHandicap = 0;
|
||||
private long pointsToNextLevel = 0;
|
||||
/**
|
||||
* @return the deathHandicap
|
||||
*/
|
||||
public int getDeathHandicap() {
|
||||
return deathHandicap;
|
||||
}
|
||||
/**
|
||||
* @param deathHandicap the deathHandicap to set
|
||||
*/
|
||||
public void setDeathHandicap(int deathHandicap) {
|
||||
this.deathHandicap = deathHandicap;
|
||||
}
|
||||
/**
|
||||
* @return the report
|
||||
*/
|
||||
public List<String> getReport() {
|
||||
return report;
|
||||
}
|
||||
/**
|
||||
* @return the level
|
||||
*/
|
||||
public long getLevel() {
|
||||
return level;
|
||||
}
|
||||
/**
|
||||
* @return the pointsToNextLevel
|
||||
*/
|
||||
public long getPointsToNextLevel() {
|
||||
return pointsToNextLevel;
|
||||
}
|
||||
/**
|
||||
* @param report the report to set
|
||||
*/
|
||||
public void setReport(List<String> report) {
|
||||
this.report = report;
|
||||
}
|
||||
/**
|
||||
* @param level the level to set
|
||||
*/
|
||||
public void setLevel(long level) {
|
||||
this.level = level;
|
||||
}
|
||||
/**
|
||||
* @param pointsToNextLevel the pointsToNextLevel to set
|
||||
*/
|
||||
public void setPointsToNextLevel(long pointsToNextLevel) {
|
||||
this.pointsToNextLevel = pointsToNextLevel;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package bskyblock.addon.level.calculators;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import bskyblock.addon.level.Level;
|
||||
import bskyblock.addon.level.calculators.CalcIslandLevel.Results;
|
||||
import bskyblock.addon.level.event.IslandLevelCalculatedEvent;
|
||||
import bskyblock.addon.level.event.IslandPreLevelEvent;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
|
||||
/**
|
||||
* Gets the player's island level. For admin or players
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class PlayerLevel {
|
||||
|
||||
private Level addon;
|
||||
|
||||
private Island island;
|
||||
private World world;
|
||||
private User asker;
|
||||
private UUID targetPlayer;
|
||||
|
||||
private long oldLevel;
|
||||
|
||||
private CalcIslandLevel calc;
|
||||
|
||||
|
||||
public PlayerLevel(final Level addon, final Island island, final UUID targetPlayer, final User asker) {
|
||||
this.addon = addon;
|
||||
this.island = island;
|
||||
this.world = island != null ? island.getCenter().getWorld() : null;
|
||||
this.asker = asker;
|
||||
this.targetPlayer = targetPlayer;
|
||||
this.oldLevel = addon.getIslandLevel(world, targetPlayer);
|
||||
|
||||
// Fire pre-level calc event
|
||||
IslandPreLevelEvent e = new IslandPreLevelEvent(targetPlayer, island);
|
||||
addon.getServer().getPluginManager().callEvent(e);
|
||||
if (!e.isCancelled()) {
|
||||
// Calculate if not cancelled
|
||||
calc = new CalcIslandLevel(addon, island, ()-> informPlayers());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void informPlayers() {
|
||||
// Fire post calculation event
|
||||
IslandLevelCalculatedEvent ilce = new IslandLevelCalculatedEvent(targetPlayer, island, calc.getResult());
|
||||
addon.getServer().getPluginManager().callEvent(ilce);
|
||||
Results results = ilce.getResults();
|
||||
// Save the results
|
||||
island.getMemberSet().forEach(m -> addon.setIslandLevel(world, m, results.getLevel()));
|
||||
// Display result
|
||||
if (!ilce.isCancelled()) {
|
||||
// Tell the asker
|
||||
asker.sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
|
||||
// Console
|
||||
if (!asker.isPlayer()) {
|
||||
results.getReport().forEach(asker::sendRawMessage);
|
||||
return;
|
||||
}
|
||||
// Player
|
||||
if (addon.getSettings().getDeathPenalty() != 0) {
|
||||
asker.sendMessage("island.level.deaths", "[number]", String.valueOf(results.getDeathHandicap()));
|
||||
}
|
||||
// Send player how many points are required to reach next island level
|
||||
if (results.getPointsToNextLevel() >= 0) {
|
||||
asker.sendMessage("island.level.required-points-to-next-level", "[points]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
|
||||
}
|
||||
// Tell other team members
|
||||
if (addon.getIslandLevel(world, targetPlayer) != oldLevel) {
|
||||
for (UUID member : island.getMemberSet()) {
|
||||
if (!member.equals(asker.getUniqueId())) {
|
||||
User.getInstance(member).sendMessage("island.level.island-level-is", "[level]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -3,8 +3,6 @@ package bskyblock.addon.level.commands;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.World;
|
||||
|
||||
import bskyblock.addon.level.Level;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
@ -20,15 +18,7 @@ public class AdminLevel extends CompositeCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(User user, String label, List<String> args) {
|
||||
if (args.size() == 2) {
|
||||
// Get world
|
||||
World world = null;
|
||||
if (getPlugin().getIWM().isOverWorld(args.get(0))) {
|
||||
world = getPlugin().getIWM().getIslandWorld(args.get(0));
|
||||
} else {
|
||||
user.sendMessage("commands.admin.top.unknown-world");
|
||||
return false;
|
||||
}
|
||||
if (args.size() == 1) {
|
||||
// Asking for another player's level?
|
||||
// Convert name to a UUID
|
||||
final UUID playerUUID = getPlugin().getPlayers().getUUID(args.get(0));
|
||||
@ -37,11 +27,7 @@ public class AdminLevel extends CompositeCommand {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
return true;
|
||||
} else {
|
||||
if (user.isPlayer()) {
|
||||
levelPlugin.calculateIslandLevel(world, user, playerUUID, false, getPermissionPrefix());
|
||||
} else {
|
||||
levelPlugin.calculateIslandLevel(world, user, playerUUID, true, getPermissionPrefix());
|
||||
}
|
||||
levelPlugin.calculateIslandLevel(getWorld(), user, playerUUID);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
|
@ -28,14 +28,14 @@ public class IslandLevel extends CompositeCommand {
|
||||
return true;
|
||||
} else if (user.getUniqueId().equals(playerUUID) ) {
|
||||
// Self level request
|
||||
levelPlugin.calculateIslandLevel(getWorld(), user, user.getUniqueId(), false, this.getPermissionPrefix());
|
||||
levelPlugin.calculateIslandLevel(getWorld(), user, user.getUniqueId());
|
||||
} else {
|
||||
user.sendMessage("island.level.island-level-is", "[level]", String.valueOf(levelPlugin.getIslandLevel(getWorld(), playerUUID)));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
// Self level request
|
||||
levelPlugin.calculateIslandLevel(getWorld(), user, user.getUniqueId(), false, this.getPermissionPrefix());
|
||||
levelPlugin.calculateIslandLevel(getWorld(), user, user.getUniqueId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -3,23 +3,20 @@ package bskyblock.addon.level.config;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import bskyblock.addon.level.Level;
|
||||
|
||||
public class Settings {
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
private boolean sumTeamDeaths;
|
||||
private int seaHeight;
|
||||
private Map<MaterialData, Integer> blockLimits = new HashMap<>();
|
||||
private Map<MaterialData, Integer> blockValues = new HashMap<>();
|
||||
private Map<World, Map<MaterialData, Integer>> worldBlockValues = new HashMap<>();
|
||||
private Map<Material, Integer> blockLimits = new HashMap<>();
|
||||
private Map<Material, Integer> blockValues = new HashMap<>();
|
||||
private Map<World, Map<Material, Integer>> worldBlockValues = new HashMap<>();
|
||||
private double underWaterMultiplier;
|
||||
private int deathpenalty;
|
||||
private long levelCost;
|
||||
@ -30,6 +27,7 @@ public class Settings {
|
||||
private boolean teamJoinDeathReset;
|
||||
|
||||
public Settings(Level level) {
|
||||
|
||||
level.saveDefaultConfig();
|
||||
|
||||
setLevelWait(level.getConfig().getInt("levelwait", 60));
|
||||
@ -49,14 +47,11 @@ public class Settings {
|
||||
}
|
||||
|
||||
if (level.getConfig().isSet("limits")) {
|
||||
HashMap<MaterialData, Integer> blockLimits = new HashMap<>();
|
||||
HashMap<Material, Integer> blockLimits = new HashMap<>();
|
||||
for (String material : level.getConfig().getConfigurationSection("limits").getKeys(false)) {
|
||||
try {
|
||||
MaterialData materialData = getMaterialData(material);
|
||||
blockLimits.put(materialData, level.getConfig().getInt("limits." + material, 0));
|
||||
if (DEBUG) {
|
||||
level.getLogger().info("Maximum number of " + materialData + " will be " + blockLimits.get(materialData));
|
||||
}
|
||||
Material mat = Material.valueOf(material);
|
||||
blockLimits.put(mat, level.getConfig().getInt("limits." + material, 0));
|
||||
} catch (Exception e) {
|
||||
level.getLogger().warning("Unknown material (" + material + ") in blockvalues.yml Limits section. Skipping...");
|
||||
}
|
||||
@ -64,23 +59,20 @@ public class Settings {
|
||||
setBlockLimits(blockLimits);
|
||||
}
|
||||
if (level.getConfig().isSet("blocks")) {
|
||||
Map<MaterialData, Integer> blockValues = new HashMap<>();
|
||||
Map<Material, Integer> blockValues = new HashMap<>();
|
||||
for (String material : level.getConfig().getConfigurationSection("blocks").getKeys(false)) {
|
||||
|
||||
try {
|
||||
MaterialData materialData = getMaterialData(material);
|
||||
blockValues.put(materialData, level.getConfig().getInt("blocks." + material, 0));
|
||||
if (DEBUG) {
|
||||
level.getLogger().info(materialData.toString() + " value = " + blockValues.get(materialData));
|
||||
}
|
||||
Material mat = Material.valueOf(material);
|
||||
blockValues.put(mat, level.getConfig().getInt("blocks." + material, 0));
|
||||
} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
level.getLogger().warning("Unknown material (" + material + ") in blockvalues.yml blocks section. Skipping...");
|
||||
level.getLogger().warning("Unknown material (" + material + ") in config.yml blocks section. Skipping...");
|
||||
}
|
||||
}
|
||||
setBlockValues(blockValues);
|
||||
} else {
|
||||
level.getLogger().severe("No block values in blockvalues.yml! All island levels will be zero!");
|
||||
level.getLogger().severe("No block values in config.yml! All island levels will be zero!");
|
||||
}
|
||||
// Worlds
|
||||
if (level.getConfig().isSet("worlds")) {
|
||||
@ -90,9 +82,9 @@ public class Settings {
|
||||
if (bWorld != null) {
|
||||
ConfigurationSection worldValues = worlds.getConfigurationSection(world);
|
||||
for (String material : worldValues.getKeys(false)) {
|
||||
MaterialData materialData = getMaterialData(material);
|
||||
Map<MaterialData, Integer> values = worldBlockValues.getOrDefault(bWorld, new HashMap<>());
|
||||
values.put(materialData, worldValues.getInt("blocks." + material, 0));
|
||||
Material mat = Material.valueOf(material);
|
||||
Map<Material, Integer> values = worldBlockValues.getOrDefault(bWorld, new HashMap<>());
|
||||
values.put(mat, worldValues.getInt("blocks." + material, 0));
|
||||
worldBlockValues.put(bWorld, values);
|
||||
}
|
||||
} else {
|
||||
@ -103,24 +95,6 @@ public class Settings {
|
||||
// All done
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private MaterialData getMaterialData(String material) {
|
||||
String[] split = material.split(":");
|
||||
byte data = 0;
|
||||
if (split.length>1) {
|
||||
data = Byte.valueOf(split[1]);
|
||||
}
|
||||
MaterialData materialData = null;
|
||||
if (StringUtils.isNumeric(split[0])) {
|
||||
materialData = new MaterialData(Integer.parseInt(split[0]));
|
||||
} else {
|
||||
materialData = new MaterialData(Material.valueOf(split[0].toUpperCase()));
|
||||
}
|
||||
|
||||
materialData.setData(data);
|
||||
return materialData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sumTeamDeaths
|
||||
*/
|
||||
@ -148,25 +122,25 @@ public class Settings {
|
||||
/**
|
||||
* @return the blockLimits
|
||||
*/
|
||||
public final Map<MaterialData, Integer> getBlockLimits() {
|
||||
public final Map<Material, Integer> getBlockLimits() {
|
||||
return blockLimits;
|
||||
}
|
||||
/**
|
||||
* @param blockLimits the blockLimits to set
|
||||
* @param blockLimits2 the blockLimits to set
|
||||
*/
|
||||
public final void setBlockLimits(HashMap<MaterialData, Integer> blockLimits) {
|
||||
this.blockLimits = blockLimits;
|
||||
public final void setBlockLimits(HashMap<Material, Integer> blockLimits2) {
|
||||
this.blockLimits = blockLimits2;
|
||||
}
|
||||
/**
|
||||
* @return the blockValues
|
||||
*/
|
||||
public final Map<MaterialData, Integer> getBlockValues() {
|
||||
public final Map<Material, Integer> getBlockValues() {
|
||||
return blockValues;
|
||||
}
|
||||
/**
|
||||
* @param blockValues2 the blockValues to set
|
||||
*/
|
||||
public final void setBlockValues(Map<MaterialData, Integer> blockValues2) {
|
||||
public final void setBlockValues(Map<Material, Integer> blockValues2) {
|
||||
this.blockValues = blockValues2;
|
||||
}
|
||||
/**
|
||||
@ -269,7 +243,7 @@ public class Settings {
|
||||
/**
|
||||
* @return the worldBlockValues
|
||||
*/
|
||||
public Map<World, Map<MaterialData, Integer>> getWorldBlockValues() {
|
||||
public Map<World, Map<Material, Integer>> getWorldBlockValues() {
|
||||
return worldBlockValues;
|
||||
}
|
||||
|
||||
|
@ -11,15 +11,17 @@ import com.google.gson.annotations.Expose;
|
||||
import us.tastybento.bskyblock.database.objects.DataObject;
|
||||
|
||||
public class LevelsData implements DataObject {
|
||||
|
||||
|
||||
// uniqueId is the player's UUID
|
||||
@Expose
|
||||
private String uniqueId = "";
|
||||
|
||||
|
||||
// Map - world name, level
|
||||
@Expose
|
||||
private Map<String, Long> levels = new HashMap<>();
|
||||
|
||||
@Expose
|
||||
private long initialIslandLevel = 0;
|
||||
|
||||
public LevelsData() {} // For Bean loading
|
||||
|
||||
/**
|
||||
@ -36,6 +38,7 @@ public class LevelsData implements DataObject {
|
||||
/* (non-Javadoc)
|
||||
* @see us.tastybento.bskyblock.database.objects.DataObject#getUniqueId()
|
||||
*/
|
||||
@Override
|
||||
public String getUniqueId() {
|
||||
return uniqueId;
|
||||
}
|
||||
@ -43,14 +46,20 @@ public class LevelsData implements DataObject {
|
||||
/* (non-Javadoc)
|
||||
* @see us.tastybento.bskyblock.database.objects.DataObject#setUniqueId(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setUniqueId(String uniqueId) {
|
||||
this.uniqueId = uniqueId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the island level for this world
|
||||
* @param world - world
|
||||
* @return island level, less the initialIslandLevel
|
||||
*/
|
||||
public Long getLevel(World world) {
|
||||
return world == null ? 0L : levels.getOrDefault(world.getName(), 0L);
|
||||
return world == null ? -initialIslandLevel : levels.getOrDefault(world.getName(), 0L) - initialIslandLevel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the levels
|
||||
*/
|
||||
@ -68,4 +77,18 @@ public class LevelsData implements DataObject {
|
||||
public void setLevel(World world, Long lv) {
|
||||
levels.put(world.getName(),lv);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the initialIslandLevel
|
||||
*/
|
||||
public long getInitialIslandLevel() {
|
||||
return initialIslandLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param initialIslandLevel the initialIslandLevel to set
|
||||
*/
|
||||
public void setInitialIslandLevel(long initialIslandLevel) {
|
||||
this.initialIslandLevel = initialIslandLevel;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,59 @@
|
||||
package bskyblock.addon.level.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import bskyblock.addon.level.calculators.CalcIslandLevel.Results;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* This event is fired after the island level is calculated and before the results are saved.
|
||||
* If this event is cancelled, results will saved, but not communicated. i.e., the result will be silent.
|
||||
*
|
||||
* @author tastybento
|
||||
*/
|
||||
public class IslandLevelCalculatedEvent extends IslandBaseEvent {
|
||||
private Results results;
|
||||
|
||||
private UUID targetPlayer;
|
||||
|
||||
/**
|
||||
* @param targetPlayer
|
||||
* @param island
|
||||
* @param results
|
||||
*/
|
||||
public IslandLevelCalculatedEvent(UUID targetPlayer, Island island, Results results) {
|
||||
super(island);
|
||||
this.targetPlayer = targetPlayer;
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the results
|
||||
*/
|
||||
public Results getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetPlayer
|
||||
*/
|
||||
public UUID getTargetPlayer() {
|
||||
return targetPlayer;
|
||||
}
|
||||
/**
|
||||
* @param results the results to set
|
||||
*/
|
||||
public void setResults(Results results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetPlayer the targetPlayer to set
|
||||
*/
|
||||
public void setTargetPlayer(UUID targetPlayer) {
|
||||
this.targetPlayer = targetPlayer;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
package bskyblock.addon.level.event;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* This event is fired after ASkyBlock calculates an island level and when it sends notification to the player.
|
||||
* Use getLevel() to see the level calculated and getPointsToNextLevel() to see how much points are needed to reach next level.
|
||||
* Canceling this event will result in no notifications to the player.
|
||||
*
|
||||
* @author Poslovitch, tastybento
|
||||
*/
|
||||
public class IslandPostLevelEvent extends IslandBaseEvent {
|
||||
private long level;
|
||||
private long pointsToNextLevel;
|
||||
|
||||
/**
|
||||
* @param player
|
||||
* @param island
|
||||
* @param l
|
||||
*/
|
||||
public IslandPostLevelEvent(UUID player, Island island, long l, long m) {
|
||||
super(island);
|
||||
this.level = l;
|
||||
this.pointsToNextLevel = m;
|
||||
}
|
||||
|
||||
public long getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(long level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public long getPointsToNextLevel() {
|
||||
return pointsToNextLevel;
|
||||
}
|
||||
|
||||
public void setPointsToNextLevel(long pointsToNextLevel) {
|
||||
this.pointsToNextLevel = pointsToNextLevel;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -5,41 +5,28 @@ import java.util.UUID;
|
||||
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Called when an island level is going to be calculated
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class IslandPreLevelEvent extends IslandBaseEvent {
|
||||
|
||||
private UUID targetPlayer;
|
||||
private long level;
|
||||
private long pointsToNextLevel;
|
||||
|
||||
|
||||
public IslandPreLevelEvent(UUID targetPlayer, Island island, long level) {
|
||||
private UUID targetPlayer;
|
||||
|
||||
|
||||
/**
|
||||
* Called when an island level is going to be calculated
|
||||
* @param targetPlayer - the player who is being tagetted (owner or team member)
|
||||
* @param island - the island
|
||||
*/
|
||||
public IslandPreLevelEvent(UUID targetPlayer, Island island) {
|
||||
super(island);
|
||||
this.targetPlayer = targetPlayer;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public long getPointsToNextLevel() {
|
||||
return pointsToNextLevel;
|
||||
}
|
||||
|
||||
public void setPointsToNextLevel(long pointsToNextLevel) {
|
||||
this.pointsToNextLevel = pointsToNextLevel;
|
||||
}
|
||||
|
||||
public UUID getTargetPlayer() {
|
||||
return targetPlayer;
|
||||
}
|
||||
|
||||
public void setTargetPlayer(UUID targetPlayer) {
|
||||
this.targetPlayer = targetPlayer;
|
||||
}
|
||||
|
||||
public long getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(long level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
package bskyblock.addon.level.listeners;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import bskyblock.addon.level.Level;
|
||||
import bskyblock.addon.level.calculators.CalcIslandLevel;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.IslandCreatedEvent;
|
||||
import us.tastybento.bskyblock.api.events.island.IslandEvent.IslandResettedEvent;
|
||||
import us.tastybento.bskyblock.database.objects.Island;
|
||||
|
||||
/**
|
||||
* Listens for new islands and sets the level to zero automatically
|
||||
* @author tastybento
|
||||
*
|
||||
*/
|
||||
public class NewIslandListener implements Listener {
|
||||
|
||||
private Level addon;
|
||||
private Map<Island, CalcIslandLevel> cil;
|
||||
|
||||
/**
|
||||
* @param addon
|
||||
*/
|
||||
public NewIslandListener(Level addon) {
|
||||
this.addon = addon;
|
||||
cil = new HashMap<>();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onNewIsland(IslandCreatedEvent e) {
|
||||
cil.putIfAbsent(e.getIsland(), new CalcIslandLevel(addon, e.getIsland(), () -> zeroLevel(e.getIsland())));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||
public void onNewIsland(IslandResettedEvent e) {
|
||||
cil.putIfAbsent(e.getIsland(), new CalcIslandLevel(addon, e.getIsland(), () -> zeroLevel(e.getIsland())));
|
||||
}
|
||||
|
||||
private void zeroLevel(Island island) {
|
||||
if (cil.containsKey(island)) {
|
||||
addon.setInitialIslandLevel(island, cil.get(island).getResult().getLevel());
|
||||
cil.remove(island);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user