Fixed flag text and descriptions.

This commit is contained in:
tastybento 2018-06-09 17:22:38 -07:00
parent 27639f673a
commit 1fc1780fd1
4 changed files with 179 additions and 103 deletions

View File

@ -269,115 +269,187 @@ ranks:
mod: "Mod"
protection:
protected: "&cIsland protected!"
locked: "&cThis island is locked!"
flags:
ANIMAL_SPAWN:
description: "Toggle spawning"
name: "Animal spawning"
ANVIL:
name: "Anvils"
description: "Toggle interaction with anvils"
description: "Toggle interaction"
name: Anvils
ARMOR_STAND:
description: "Toggle interaction"
name: "Armor stands"
description: "Toggle interaction with armor stands"
BEACON:
name: "Beacons"
description: "Toggle interaction with beacons"
description: "Toggle interaction"
name: Beacons
BED:
name: "Beds"
description: "Toggle interaction with beds"
description: "Toggle interaction"
name: Beds
BREAK_BLOCKS:
description: "Toggle breaking"
name: "Break blocks"
description: "Toggle block breaking"
BREEDING:
description: "Toggle breeding"
name: "Breed animals"
description: "Toggle animal breeding"
BREWING:
description: "Toggle interaction"
name: "Brewing stands"
description: "Toggle interaction with brewing stands"
BUCKET:
name: "Buckets"
description: "Toggle interaction with buckets"
COLLECT_WATER:
name: "Collect water"
description: |
Toggle collecting water using buckets
(override Buckets)
COLLECT_LAVA:
name: "Collect lava"
description: |
Toggle collecting lava using buckets
(override Buckets)
description: "Toggle interaction"
name: Buckets
CHEST:
description: "Toggle chest access"
name: Chests
CHORUS_FRUIT:
description: "Toggle teleportation"
name: "Chorus fruits"
description: "Toggle teleportation using Chorus fruits"
COLLECT_LAVA:
description: |
Toggle collecting lava
(override Buckets)
name: "Collect lava"
COLLECT_WATER:
description: |
Toggle collecting water
(override Buckets)
name: "Collect water"
CRAFTING:
name: "Workbenches"
description: "Toggle interaction with workbenches"
CROP_TRAMPLE: "Trample crops"
DOOR: "Use doors"
ELYTRA: "Use elytras"
ENCHANTING: "Use enchanting table"
description: "Toggle use"
name: Workbenches
CROP_TRAMPLE:
description: "Toggle crop trampling"
name: "Trample crops"
DOOR:
description: "Toggle door usage"
name: "Use doors"
EGGS:
description: "Toggle egg throwing"
name: "Egg throwing"
ELYTRA:
description: "Toggle use on island"
name: "Elytras"
ENCHANTING:
description: "Toggle use"
name: "Enchanting table"
ENDER_PEARL:
description: "Toggle use"
name: "EnderPearls"
ENTER_EXIT_MESSAGES:
name: "Enter/Exit messages"
description: "Display entry and exit messages"
now-leaving: "Now leaving [name]"
now-entering: "Now entering [name]"
island: "[name]'s island"
FIRE: "FIRE"
FIRE_EXTINGUISH: "FIRE_EXTINGUISH"
FIRE_SPREAD: "FIRE_SPREAD"
FURNACE: "FURNACE"
GATE: "GATE"
HURT_ANIMALS: "HURT_ANIMALS"
HURT_MONSTERS: "HURT_MONSTERS"
HURT_VILLAGERS: "HURT_VILLAGERS"
ITEM_DROP: "ITEM_DROP"
ITEM_PICKUP: "ITEM_PICKUP"
name: "Enter/Exit messages"
now-entering: "Now entering [name]"
now-leaving: "Now leaving [name]"
FIRE:
description: "Allow fire to exist or not"
name: Fire
FIRE_EXTINGUISH:
description: "Toggle extinguishing"
name: "Fire extinguish"
FIRE_SPREAD:
description: "Toggle spread"
name: "Fire spread"
FURNACE:
description: "Toggle use"
name: Furnace
GATE:
description: "Toggle use"
name: Gates
HURT_ANIMALS:
description: "Toggle hurting"
name: "Hurt animals"
HURT_MONSTERS:
description: "Toggle hurting"
name: "Hurt monsters"
HURT_VILLAGERS:
description: "Toggle hurting"
name: "Hurt villagers"
INVINCIBLE_VISITORS:
description: |
&aConfigure invincible visitor
&asettings.
name: "Invincible Visitors"
description: |
Configure invincible visitor
settings.
visitors-protected: "&cVisitors protected"
LEASH: "LEASH"
ITEM_DROP:
description: "Toggle dropping"
name: "Item drop"
ITEM_PICKUP:
description: "Toggle pickup"
name: "Item pickup"
LEASH:
description: "Toggle use"
name: "Leash use"
LEVER_BUTTON:
description: "Toggle use"
name: "Leaver or button use"
LOCK:
description: "Toggle lock"
name: "Lock island"
description: "Toggle island lock"
MILKING: "MILKING"
MOB_SPAWN: "MOB_SPAWN"
MONSTER_SPAWN: "MONSTER_SPAWN"
MOUNT_INVENTORY: "MOUNT_INVENTORY"
RIDING: "RIDING"
MUSIC: "MUSIC"
CHEST: "CHEST"
MILKING:
description: "Toggle cow milking"
name: Milking
MONSTER_SPAWN:
description: "Toggle spawning"
name: "Monster spawning"
MOUNT_INVENTORY:
description: |
&aToggle access
&ato mount inventory
name: "Mount inventory"
MUSIC:
description: "Toggle access"
name: Music
PISTON_PUSH:
description: |
&aAllow pistons to push
&ablocks outside island
name: "Piston Push"
description: |
&aAllow pistons to push
&ablocks outside island
PLACE_BLOCKS: "PLACE_BLOCKS"
PORTAL: "PORTAL"
PRESSURE_PLATE: "PRESSURE_PLATE"
PVP_OVERWORLD:
name: "Overworld PVP"
description: |
Enable/Disable PVP
on island.
pvp-not-allowed: "&cPVP is not allowed"
PVP_NETHER:
name: "Nether PVP"
description: |
Enable/Disable PVP
in nether.
PLACE_BLOCKS:
description: "Toggle placing"
name: "Place blocks"
PORTAL:
description: "Toggle use"
name: Portal
PRESSURE_PLATE:
description: "Toggle usage"
name: "Pressure Plates"
PVP_END:
name: "End PVP"
description: |
Enable/Disable PVP
in the End.
REDSTONE: "REDSTONE"
SPAWN_EGGS: "SPAWN_EGGS"
SHEARING: "SHEARING"
EGGS: "EGGS"
TRADING: "TRADING"
&cEnable/Disable PVP
&cin the End.
name: "End PVP"
PVP_NETHER:
description: |
&cEnable/Disable PVP
&cin nether.
name: "Nether PVP"
PVP_OVERWORLD:
description: |
&cEnable/Disable PVP
&con island.
name: "Overworld PVP"
pvp-not-allowed: "&cPVP is not allowed"
REDSTONE:
description: "Toggle use"
name: "Redstone items"
RIDING:
description: "Toggle riding"
name: "Animal riding"
SHEARING:
description: "Toggle sheering"
name: Shearing
SPAWN_EGGS:
description: "Toggle use"
name: "Spawn eggs"
TRADING:
description: "Toggle trading"
name: "Village trading"
TRAPDOOR:
description: "Toggle access"
name: "Trap doors"
locked: "&cThis island is locked!"
protected: "&cIsland protected!"
panel:
title: "Island flags"
flag-item:
@ -389,6 +461,7 @@ protection:
allowed_rank: "&3- &a"
blocked_rank: "&3- &c"
minimal_rank: "&3- &2"
menu-layout: "&a[description]"
setting-layout: |+
&a[description]

View File

@ -23,7 +23,7 @@ public class Flag implements Comparable<Flag> {
public enum Type {
PROTECTION,
SETTING,
SUB_MENU,
MENU,
WORLD_SETTING
}
@ -148,8 +148,12 @@ public class Flag implements Comparable<Flag> {
.icon(new ItemStack(icon))
.name(user.getTranslation("protection.panel.flag-item.name-layout", TextVariables.NAME, user.getTranslation("protection.flags." + id + ".name")))
.clickHandler(clickHandler);
if (getType().equals(Type.MENU)) {
pib.description(user.getTranslation("protection.panel.flag-item.menu-layout", "[description]", user.getTranslation("protection.flags." + id + ".description")));
return pib.build();
}
// Check if this is a setting or world setting
if (this.getType().equals(Type.WORLD_SETTING)) {
if (getType().equals(Type.WORLD_SETTING)) {
String setting = this.isSetForWorld(user.getWorld()) ? user.getTranslation("protection.panel.flag-item.setting-active")
: user.getTranslation("protection.panel.flag-item.setting-disabled");
pib.description(user.getTranslation("protection.panel.flag-item.setting-layout", "[description]", user.getTranslation("protection.flags." + id + ".description")
@ -160,7 +164,7 @@ public class Flag implements Comparable<Flag> {
// Get the island this user is on or their own
Island island = plugin.getIslands().getIslandAt(user.getLocation()).orElse(plugin.getIslands().getIsland(user.getWorld(), user.getUniqueId()));
if (island != null) {
if (this.getType().equals(Type.SETTING)) {
if (getType().equals(Type.SETTING)) {
String setting = island.isAllowed(this) ? user.getTranslation("protection.panel.flag-item.setting-active")
: user.getTranslation("protection.panel.flag-item.setting-disabled");
pib.description(user.getTranslation("protection.panel.flag-item.setting-layout", "[description]", user.getTranslation("protection.flags." + id + ".description")
@ -169,7 +173,7 @@ public class Flag implements Comparable<Flag> {
}
// TODO: Get the world settings - the player has no island and is not in an island location
// Dynamic rank list
if (this.getType().equals(Type.PROTECTION)) {
if (getType().equals(Type.PROTECTION)) {
// Protection flag
pib.description(user.getTranslation("protection.panel.flag-item.description-layout", "[description]", user.getTranslation("protection.flags." + id + ".description")));
plugin.getRanksManager().getRanks().forEach((reference, score) -> {

View File

@ -155,7 +155,7 @@ public class Flags {
.onClick(new WorldToggleClickListener("PISTON_PUSH"))
.build();
static InvincibleVisitorsListener ilv = new InvincibleVisitorsListener();
public static final Flag INVINCIBLE_VISITORS = new FlagBuilder().id("INVINCIBLE_VISITORS").icon(Material.DIAMOND_CHESTPLATE).type(Type.SUB_MENU)
public static final Flag INVINCIBLE_VISITORS = new FlagBuilder().id("INVINCIBLE_VISITORS").icon(Material.DIAMOND_CHESTPLATE).type(Type.MENU)
.listener(ilv).onClick(ilv).build();
/**

View File

@ -18,9 +18,8 @@ public class SettingsPanel {
PanelBuilder panelBuilder = new PanelBuilder()
.name(user.getTranslation("protection.panel.title"));
// Add flags after position 8, i.e., from second row
plugin.getFlagsManager().getFlags().forEach((f -> panelBuilder.item(f.toPanelItem(plugin, user))));
// Add flags, sorted
plugin.getFlagsManager().getFlags().stream().sorted((e1, e2) -> e1.getID().compareTo(e2.getID())).forEach((f -> panelBuilder.item(f.toPanelItem(plugin, user))));
// Make the panel
panelBuilder.build().open(user);
}