Initial commit - copy over from BSkyBlock.

This commit is contained in:
tastybento 2018-07-29 13:42:25 -07:00
parent e62f0c8537
commit fbdd39e53b
279 changed files with 44486 additions and 2 deletions

0
LICENSE Normal file → Executable file
View File

63
README.md Normal file → Executable file
View File

@ -1,2 +1,61 @@
# addon-bskyblock
BSkyBlock add-on for BentoBox
BSkyBlock
==========
[![Build Status](https://travis-ci.org/tastybento/bskyblock.svg?branch=master)](https://travis-ci.org/tastybento/bskyblock)
![Lines Of Code](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=ncloc)
![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=sqale_rating)
![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=reliability_rating)
![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=security_rating)
![Bugs](https://sonarcloud.io/api/project_badges/measure?project=us.tastybento%3Abskyblock&metric=bugs)
A skyblock Bukkit plugin for Minecraft derived from the well-known ASkyBlock!
This is a survival game where the player starts with an island in the sky.
BSkyBlock (Better SkyBlock) represents a turning point on ASkyBlock's history : Tastybento and Poslovitch thought and designed together this complete rewrite in order to provide a whole new way to play Skyblock.
**Discover today BSkyBlock, its gameplay overhaul, and enjoy the Skyblock revival!**
Add-ons
=======
BSkyBlock is built to enable add-ons (plugins that use the BSkyBlock API). Here is a list of the current ones:
* Level - provides island level calculation and a top ten
* Welcome Warps - provides the warp sign feature
You can find the projects on tastybento's GitHub.
Bugs and Feature requests
=========================
File bug and feature requests here: https://github.com/tastybento/bskyblock/issues
Note for developers
===================
This is an actively developed project but we are not currently accepting Pull Requests from non-collaborators. Once we have finished the main development, we'll be open to PR's.
Development Builds
==================
Jenkins: https://ci.codemc.org/job/Tastybento/job/bskyblock/
API
===
Maven dependency:
```xml
<repositories>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>us.tastybento</groupId>
<artifactId>bskyblock</artifactId>
<version>FC-0.74</version>
<scope>provided</scope>
</dependency>
</dependencies>
```
You can find the javadoc here: https://ci.codemc.org/job/Tastybento/job/bskyblock/javadoc/

300
REFERENCES.md Normal file
View File

@ -0,0 +1,300 @@
# Locale References
This file contains a list of the locale references in the source code. See the commit date/time for the last update.
## References
/!\ Most command-related references are not listed at the moment.
```
commands.admin.setrange.range-updated
commands.help.description
commands.help.end
commands.help.header
commands.help.parameters
commands.help.syntax
commands.island.about.description
commands.island.create.creating-island
commands.island.create.unable-create-island
commands.island.go.description
commands.island.go.parameters
commands.island.go.teleport
commands.island.go.teleported
commands.island.reset.must-remove-members
commands.island.sethome.home-set
commands.island.sethome.must-be-on-your-island
commands.island.sethome.num-homes
commands.island.setname.too-long
commands.island.setname.too-short
commands.island.team.demote.failure
commands.island.team.demote.success
commands.island.team.invite.accept.name-joined-your-island
commands.island.team.invite.accept.you-joined-island
commands.island.team.invite.already-on-team
commands.island.team.invite.cannot-invite-self
commands.island.team.invite.cooldown
commands.island.team.invite.errors.invalid-invite
commands.island.team.invite.errors.island-is-full
commands.island.team.invite.errors.none-invited-you
commands.island.team.invite.errors.you-already-are-in-team
commands.island.team.invite.invitation-sent
commands.island.team.invite.name-has-invited-you
commands.island.team.invite.reject.name-rejected-your-invite
commands.island.team.invite.reject.you-rejected-invite
commands.island.team.invite.removing-invite
commands.island.team.invite.to-accept-or-reject
commands.island.team.invite.you-can-invite
commands.island.team.invite.you-will-lose-your-island
commands.island.team.kick.leader-kicked
commands.island.team.kick.type-again
commands.island.team.leave.left-your-island
commands.island.team.leave.type-again
commands.island.team.promote.failure
commands.island.team.promote.success
commands.island.team.setowner.errors.cant-transfer-to-yourself
commands.island.team.setowner.errors.target-is-not-member
commands.island.team.setowner.name-is-the-owner
commands.island.team.setowner.you-are-the-owner
commands.help.end
commands.help.description
commands.help.header
commands.help.parameters
commands.help.syntax
general.confirm
general.errors.already-have-island
general.errors.command-cancelled
general.errors.general
general.errors.no-island
general.errors.no-permission
general.errors.no-team
general.errors.not-in-team
general.errors.not-leader
general.errors.offline-player
general.errors.player-has-island
general.errors.player-has-no-island
general.errors.unknown-command
general.errors.unknown-player
general.errors.unknown-player-name
general.errors.use-in-game
general.errors.warp-not-safe
general.errors.wrong-world
general.errors.you-must-wait
general.errors.you-need
general.previous-request-cancelled
general.request-cancelled
general.success
general.tips.changing-obsidian-to-lava
language.edited
language.panel-title
language.selected
protection.command-is-banned
protection.flags.ANIMAL_SPAWN.description
protection.flags.ANIMAL_SPAWN.name
protection.flags.ANVIL.description
protection.flags.ANVIL.hint
protection.flags.ANVIL.name
protection.flags.ARMOR_STAND.description
protection.flags.ARMOR_STAND.hint
protection.flags.ARMOR_STAND.name
protection.flags.BEACON.description
protection.flags.BEACON.hint
protection.flags.BEACON.name
protection.flags.BED.description
protection.flags.BED.hint
protection.flags.BED.name
protection.flags.BREAK_BLOCKS.description
protection.flags.BREAK_BLOCKS.hint
protection.flags.BREAK_BLOCKS.name
protection.flags.BREEDING.description
protection.flags.BREEDING.hint
protection.flags.BREEDING.name
protection.flags.BREWING.description
protection.flags.BREWING.hint
protection.flags.BREWING.name
protection.flags.BUCKET.description
protection.flags.BUCKET.hint
protection.flags.BUCKET.name
protection.flags.BUTTON.description
protection.flags.BUTTON.hint
protection.flags.BUTTON.name
protection.flags.CHEST.description
protection.flags.CHEST.hint
protection.flags.CHEST.name
protection.flags.CHEST_DAMAGE.description
protection.flags.CHEST_DAMAGE.name
protection.flags.CHORUS_FRUIT.description
protection.flags.CHORUS_FRUIT.hint
protection.flags.CHORUS_FRUIT.name
protection.flags.CLEAN_SUPER_FLAT.description
protection.flags.CLEAN_SUPER_FLAT.name
protection.flags.COLLECT_LAVA.description
protection.flags.COLLECT_LAVA.hint
protection.flags.COLLECT_LAVA.name
protection.flags.COLLECT_WATER.description
protection.flags.COLLECT_WATER.hint
protection.flags.COLLECT_WATER.name
protection.flags.CRAFTING.description
protection.flags.CRAFTING.hint
protection.flags.CRAFTING.name
protection.flags.CREEPER_DAMAGE.description
protection.flags.CREEPER_DAMAGE.name
protection.flags.CREEPER_GRIEFING.description
protection.flags.CREEPER_GRIEFING.name
protection.flags.CROP_TRAMPLE.description
protection.flags.CROP_TRAMPLE.hint
protection.flags.CROP_TRAMPLE.name
protection.flags.DOOR.description
protection.flags.DOOR.hint
protection.flags.DOOR.name
protection.flags.EGGS.description
protection.flags.EGGS.hint
protection.flags.EGGS.name
protection.flags.ELYTRA.description
protection.flags.ELYTRA.hint
protection.flags.ELYTRA.name
protection.flags.ENCHANTING.description
protection.flags.ENCHANTING.hint
protection.flags.ENCHANTING.name
protection.flags.ENDERMAN_DEATH_DROP.description
protection.flags.ENDERMAN_DEATH_DROP.name
protection.flags.ENDERMAN_GRIEFING.description
protection.flags.ENDERMAN_GRIEFING.name
protection.flags.ENDER_PEARL.description
protection.flags.ENDER_PEARL.hint
protection.flags.ENDER_PEARL.name
protection.flags.ENTER_EXIT_MESSAGES.description
protection.flags.ENTER_EXIT_MESSAGES.island
protection.flags.ENTER_EXIT_MESSAGES.name
protection.flags.ENTER_EXIT_MESSAGES.now-entering
protection.flags.ENTER_EXIT_MESSAGES.now-leaving
protection.flags.FIRE.description
protection.flags.FIRE.hint
protection.flags.FIRE.name
protection.flags.FIRE_EXTINGUISH.description
protection.flags.FIRE_EXTINGUISH.hint
protection.flags.FIRE_EXTINGUISH.name
protection.flags.FIRE_SPREAD.description
protection.flags.FIRE_SPREAD.hint
protection.flags.FIRE_SPREAD.name
protection.flags.FURNACE.description
protection.flags.FURNACE.hint
protection.flags.FURNACE.name
protection.flags.GATE.description
protection.flags.GATE.hint
protection.flags.GATE.name
protection.flags.GEO_LIMIT_MOBS.description
protection.flags.GEO_LIMIT_MOBS.name
protection.flags.HURT_ANIMALS.description
protection.flags.HURT_ANIMALS.hint
protection.flags.HURT_ANIMALS.name
protection.flags.HURT_MONSTERS.description
protection.flags.HURT_MONSTERS.hint
protection.flags.HURT_MONSTERS.name
protection.flags.HURT_VILLAGERS.description
protection.flags.HURT_VILLAGERS.hint
protection.flags.HURT_VILLAGERS.name
protection.flags.ITEM_FRAME_DAMAGE.description
protection.flags.ITEM_FRAME_DAMAGE.name
protection.flags.INVINCIBLE_VISITORS.description
protection.flags.INVINCIBLE_VISITORS.hint
protection.flags.INVINCIBLE_VISITORS.name
protection.flags.ISLAND_RESPAWN.description
protection.flags.ISLAND_RESPAWN.name
protection.flags.ITEM_DROP.description
protection.flags.ITEM_DROP.hint
protection.flags.ITEM_DROP.name
protection.flags.ITEM_PICKUP.description
protection.flags.ITEM_PICKUP.hint
protection.flags.ITEM_PICKUP.name
protection.flags.JUKEBOX.description
protection.flags.JUKEBOX.hint
protection.flags.JUKEBOX.name
protection.flags.LEASH.description
protection.flags.LEASH.hint
protection.flags.LEASH.name
protection.flags.LEVER.description
protection.flags.LEVER.hint
protection.flags.LEVER.name
protection.flags.LOCK.description
protection.flags.LOCK.name
protection.flags.MILKING.description
protection.flags.MILKING.hint
protection.flags.MILKING.name
protection.flags.MONSTER_SPAWN.description
protection.flags.MONSTER_SPAWN.name
protection.flags.MOUNT_INVENTORY.description
protection.flags.MOUNT_INVENTORY.hint
protection.flags.MOUNT_INVENTORY.name
protection.flags.NOTE_BLOCK.description
protection.flags.NOTE_BLOCK.hint
protection.flags.NOTE_BLOCK.name
protection.flags.OFFLINE_REDSTONE.description
protection.flags.OFFLINE_REDSTONE.name
protection.flags.PISTON_PUSH.description
protection.flags.PISTON_PUSH.name
protection.flags.PLACE_BLOCKS.description
protection.flags.PLACE_BLOCKS.hint
protection.flags.PLACE_BLOCKS.name
protection.flags.PORTAL.description
protection.flags.PORTAL.hint
protection.flags.PORTAL.name
protection.flags.PRESSURE_PLATE.description
protection.flags.PRESSURE_PLATE.hint
protection.flags.PRESSURE_PLATE.name
protection.flags.PVP_END.description
protection.flags.PVP_END.hint
protection.flags.PVP_END.name
protection.flags.PVP_NETHER.description
protection.flags.PVP_NETHER.hint
protection.flags.PVP_NETHER.name
protection.flags.PVP_OVERWORLD.description
protection.flags.PVP_OVERWORLD.hint
protection.flags.PVP_OVERWORLD.name
protection.flags.REDSTONE.description
protection.flags.REDSTONE.hint
protection.flags.REDSTONE.name
protection.flags.RIDING.description
protection.flags.RIDING.hint
protection.flags.RIDING.name
protection.flags.REMOVE_MOBS.description
protection.flags.REMOVE_MOBS.name
protection.flags.SHEARING.description
protection.flags.SHEARING.hint
protection.flags.SHEARING.name
protection.flags.SPAWN_EGGS.description
protection.flags.SPAWN_EGGS.hint
protection.flags.SPAWN_EGGS.name
protection.flags.TNT.description
protection.flags.TNT.hint
protection.flags.TNT.name
protection.flags.TRADING.description
protection.flags.TRADING.hint
protection.flags.TRADING.name
protection.flags.TRAPDOOR.description
protection.flags.TRAPDOOR.hint
protection.flags.TRAPDOOR.name
protection.locked
protection.panel.flag-item.allowed_rank
protection.panel.flag-item.blocked_rank
protection.panel.flag-item.description-layout
protection.panel.flag-item.name-layout
protection.panel.flag-item.menu-layout
protection.panel.flag-item.minimal_rank
protection.panel.flag-item.setting-active
protection.panel.flag-item.setting-disabled
protection.panel.flag-item.setting-layout
protection.panel.PROTECTION.description
protection.panel.PROTECTION.title
protection.panel.SETTING.description
protection.panel.SETTING.title
protection.panel.WORLD_SETTING.description
protection.panel.WORLD_SETTING.title
protection.protected
ranks.admin
ranks.banned
ranks.coop
ranks.member
ranks.mod
ranks.owner
ranks.visitor
```

333
config.yml Normal file
View File

@ -0,0 +1,333 @@
# BSkyBlock Configuration FC-0.7
# This config file is dynamic and saved when the server is shutdown.
# You cannot edit it while the server is running because changes will
# be lost! Use in-game settings GUI or edit when server is offline.
#
general:
# BSkyBlock uses bStats.org to get global data about the plugin to help improving it.
# bStats has nearly no effect on your server's performance and the sent data is completely
# anonymous so please consider twice if you really want to disable it.
metrics: true
# Check for updates - this will tell Ops and the console if there is a new
# version available. It contacts dev.bukkit.org to request the latest version
# info. It does not download the latest version or change any files
check-updates: true
# Default language for new players.
# This is the filename in the locale folder without .yml.
# If this does not exist, the default en-US will be used.
default-language: en-US
# Use economy or not. If true, an economy plugin is required. If false, no money is used or give.
# If there is no economy plugin present anyway, money will be automatically disabled.
use-economy: true
# Starting money - this is how much money new players will have as their
# balance at the start of an island.
starting-money: 10.0
purge:
# Only islands below this level will be removed if they are abandoned and admins issue the purge command
max-island-level: 50
# Remove user data when its island gets purged.
# Helps a lot to avoid huge backups and can save some performance on startup,
# but the player settings and data will be reset.
remove-user-data: false
database:
# FLATFILE, MYSQL, MONGO
# if you use MONGO, you must also run the BSBMongo plugin (not addon)
# See https://github.com/tastybento/bsbMongo/releases/
type: FLATFILE
host: localhost
# Port 3306 is MySQL's default. Port 27017 is MongoDB's default.
port: 3306
name: BSkyBlock
username: username
password: password
# How often the data will be saved to file in mins. Default is 5 minutes.
# This helps prevent issues if the server crashes.
# Data is also saved at important points in the game.
backup-period: 5
# Recover super flat - if the generator does not run for some reason, you can get
# super flat chunks (grass). To remove automatically, select this option. Turn off
# if there are no more because it may cause lag.
# This will regenerate any chunks with bedrock at y=0 when they are loaded
recover-super-flat: false
# Mute death messages
mute-death-messages: false
# Allow FTB Autonomous Activator to work (will allow a pseudo player [CoFH] to place and break blocks and hang items)
# Add other fake player names here if required
fakeplayers:
- '[CoFH]'
# Allow obsidian to be scooped up with an empty bucket back into lava
# This only works if there is a single block of obsidian (no obsidian within 10 blocks)
# Recommendation is to keep this true so that newbies don't bother you or reset their
# island unnecessarily.
allow-obsidian-scooping: true
# Time in seconds that players have to confirm sensitive commands, e.g. island reset
confirmation-time: 20
world:
# Friendly name for this world. Used in admin commands. Must be a single word
friendly-name: BSkyBlock
# Name of the world - if it does not exist then it will be generated.
# It acts like a prefix for nether and end (e.g. BSkyBlock, BSkyBlock_nether, BSkyBlock_end)
world-name: BSkyBlock_world
# World difficulty setting - PEACEFUL, EASY, NORMAL, HARD
# Other plugins may override this setting
difficulty: NORMAL
# Radius of island in blocks. (So distance between islands is twice this)
# Will be rounded up to the nearest 16 blocks.
# It is the same for every dimension : Overworld, Nether and End.
# This value cannot be changed mid-game and the plugin will not start if it is different.
distance-between-islands: 64
# Default protection range radius in blocks. Cannot be larger than distance.
# Admins can change protection sizes for players individually using /bsadmin setrange
# or set this permission: bskyblock.island.range.<number>
protection-range: 50
# Start islands at these coordinates. This is where new islands will start in the
# world. These must be a factor of your island distance, but the plugin will auto
# calculate the closest location on the grid. Islands develop around this location
# both positively and negatively in a square grid.
# If none of this makes sense, leave it at 0,0.
start-x: 0
start-z: 0
offset-x: 0
offset-z: 0
# Island height - Lowest is 5.
# It is the y coordinate of the bedrock block in the schem
island-height: 120
# Use your own world generator for this world. In this case, the plugin will not generate
# anything.
use-own-generator: false
# Sea height (don't changes this mid-game unless you delete the world)
# Minimum is 0, which means you are playing Skyblock!
# If sea height is less than about 10, then players will drop right through it
# if it exists. Makes for an interesting variation on skyblock.
sea-height: 0
# Maximum number of islands in the world. Set to 0 for unlimited.
# If the number of islands is greater than this number, no new island will be created.
max-islands: 0
# The default game mode for this world. Players will be set to this mode when they create
# a new island for example. Options are SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR
default-game-mode: SURVIVAL
nether:
# Generate Nether - if this is false, the nether world will not be made and access to
# the nether will not occur. Other plugins may still enable portal usage.
# Note: Some challenges will not be possible if there is no nether.
# Note that with a standard nether all players arrive at the same portal and entering a
# portal will return them back to their islands.
generate: true
# Islands in Nether. Change to false for standard vanilla nether.
islands: true
# Nether trees are made if a player grows a tree in the nether (gravel and glowstone)
# Applies to both vanilla and islands Nether
trees: true
# Make the nether roof, if false, there is nothing up there
# Change to false if lag is a problem from the generation
# Only applies to islands Nether
roof: true
# Nether spawn protection radius - this is the distance around the nether spawn
# that will be protected from player interaction (breaking blocks, pouring lava etc.)
# Minimum is 0 (not recommended), maximum is 100. Default is 25.
# Only applies to vanilla nether
spawn-radius: 25
end:
generate: true
islands: true
dragon-spawn: false
# Removing mobs - this kills all monsters in the vicinity. Benefit is that it helps
# players return to their island if the island has been overrun by monsters.
# This setting is toggled in world flags and set by the settings GUI.
# Mob white list - these mobs will NOT be removed when logging in or doing /island
remove-mobs-whitelist:
- ZOMBIE_VILLAGER
- WITHER
- PIG_ZOMBIE
- ENDERMAN
# World flags. These are boolean settings for various flags for this world
flags:
ENTER_EXIT_MESSAGES: true
ISLAND_RESPAWN: true
OFFLINE_REDSTONE: true
REMOVE_MOBS: true
# These are the default protection settings for new islands.
# The value is the minimum island rank required allowed to do the action
# Ranks are: Visitor = 0, Member = 900, Owner = 1000
default-island-flags:
HURT_ANIMALS: 900
COLLECT_WATER: 900
REDSTONE: 900
BUCKET: 900
BUTTON: 900
LOCK: 0
FIRE_EXTINGUISH: 900
ENDER_PEARL: 900
DOOR: 900
BEACON: 900
TRAPDOOR: 900
PRESSURE_PLATE: 900
FURNACE: 900
PLACE_BLOCKS: 900
ANVIL: 900
FIRE: 900
CRAFTING: 900
BREEDING: 900
SHEARING: 900
ENCHANTING: 900
HURT_VILLAGERS: 900
SPAWN_EGGS: 900
BED: 900
COLLECT_LAVA: 900
MILKING: 900
LEVER: 900
RIDING: 900
HURT_MONSTERS: 900
ARMOR_STAND: 900
GATE: 900
TRADING: 900
EGGS: 900
ITEM_DROP: 900
PORTAL: 900
CHEST: 900
NOTE_BLOCK: 900
LEASH: 900
MOUNT_INVENTORY: 900
BREAK_BLOCKS: 900
CHORUS_FRUIT: 900
ITEM_PICKUP: 900
CROP_TRAMPLE: 900
JUKEBOX: 900
BREWING: 900
# These are the default settings for new islands
default-island-settings:
PVP_END: false
ANIMAL_SPAWN: true
PVP_NETHER: false
MONSTER_SPAWN: true
FIRE_SPREAD: true
PVP_OVERWORLD: false
# These are the settings visible to users.
visible-settings: []
# Visitor banned commands - Visitors to islands cannot use these commands in this world
visitor-banned-commands:
- spawner
- spawnmob
island:
limits:
entities: {}
tile-entities: {}
# Default max team size
# Use this permission to set for specific user groups: askyblock.team.maxsize.<number>
# Permission size cannot be less than the default below.
max-team-size: 4
# Default maximum number of homes a player can have. Min = 1
# Accessed via sethome <number> or go <number>
# Use this permission to set for specific user groups: askyblock.island.maxhomes.<number>
max-homes: 1
name:
# Island naming
# Only players with the TODO can name their island
# It is displayed in the top ten and enter and exit announcements
# It replaces the owner's name. Players can use & for color coding if they have the TODO permission
# These set the minimum and maximum size of a name.
min-length: 0
max-length: 20
# How long a player must wait until they can rejoin a team island after being
# kicked in minutes. This slows the effectiveness of players repeating challenges
# by repetitively being invited to a team island.
invite-wait: 60
reset:
# How many resets a player is allowed (override with /asadmin clearreset <player>)
# Value of -1 means unlimited, 0 means hardcore - no resets.
# Example, 2 resets means they get 2 resets or 3 islands lifetime
reset-limit: -1
# Kicked or leaving players lose resets
# Players who leave a team will lose an island reset chance
# If a player has zero resets left and leaves a team, they cannot make a new
# island by themselves and can only join a team.
# Leave this true to avoid players exploiting free islands
leavers-lose-reset: false
# Allow kicked players to keep their inventory.
# If false, kicked player's inventory will be thrown at the island leader if the
# kicked player is online and in the island world.
kicked-keep-inventory: false
on-join:
# What the plugin should reset when the player joins or creates an island
# Reset Money - if this is true, will reset the player's money to the starting money
# Recommendation is that this is set to true, but if you run multi-worlds
# make sure your economy handles multi-worlds too.
money: false
# Reset inventory - if true, the player's inventory will be cleared.
# Note: if you have MultiInv running or a similar inventory control plugin, that
# plugin may still reset the inventory when the world changes.
inventory: false
# Reset Ender Chest - if true, the player's Ender Chest will be cleared.
ender-chest: false
on-leave:
# What the plugin should reset when the player leaves or is kicked from an island
# Reset Money - if this is true, will reset the player's money to the starting money
# Recommendation is that this is set to true, but if you run multi-worlds
# make sure your economy handles multi-worlds too.
money: false
# Reset inventory - if true, the player's inventory will be cleared.
# Note: if you have MultiInv running or a similar inventory control plugin, that
# plugin may still reset the inventory when the world changes.
inventory: false
# Reset Ender Chest - if true, the player's Ender Chest will be cleared.
ender-chest: false
require-confirmation:
reset: true
# Ask the player to confirm the command he is using by typing it again.
# The 'wait' value is the number of seconds to wait for confirmation.
kick: true
kick-wait: 10
leave: true
leave-wait: 10
# How long a player must wait before they can reset their island again in second
reset-wait: 300
make-island-if-none: false
# Immediately teleport player to their island (home 1 if it exists) when entering the world
immediate-teleport-on-island: false
# Have player's respawn on their island if they die
respawn-on-island: false
deaths:
# Maximum number of deaths to count. The death count can be used by add-ons.
max: 10
sum-team: false
# When a player joins a team, reset their death count
team-join-reset: true
customranks: {}
protection:
# Geo restrict mobs.
# Mobs that exit the island space where they were spawned will be removed.
geo-limit-settings:
- GHAST
- BAT
- BLAZE
# Invincible visitors. List of damages that will not affect visitors.
# Make list blank if visitors should receive all damages
invincible-visitors:
- BLOCK_EXPLOSION
- CONTACT
- CUSTOM
- DROWNING
- ENTITY_ATTACK
- ENTITY_EXPLOSION
- FALL
- FALLING_BLOCK
- FIRE
- FIRE_TICK
- LAVA
- LIGHTNING
- MAGIC
- POISON
- PROJECTILE
- STARVATION
- SUFFOCATION
- THORNS
- WITHER
- DRAGON_BREATH
- FLY_INTO_WALL
- HOT_FLOOR
- CRAMMING
- VOID
togglePvPCooldown: 0
panel:
close-on-click-outside: true
uniqueId: config

583
locales/de-DE.yml Normal file
View File

@ -0,0 +1,583 @@
###########################################################################################
# This is a YML file. Be careful when editing. Check your edits in a YAML checker like #
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# Tastybento: maintainer
# Poslovitch: maintainer
# markusmarkusz: translator
#
# This translation is adapted to version : [alpha-1]
banner: "BANNER:1:RED:STRIPE_RIGHT:BLACK:STRIPE_LEFT:YELLOW"
not-setup:
header: |-
Es werden weitere Einstellungen benötigt, bevor das Plugin genutzt werden kann...
Bearbeite die config.yml. Starte danach den Server neu.
distance: "Stelle sicher, dass du die Insel-Abstände festgelegt hast. Solltest das Plugin aktualisiert worden sein, müssen die Insel-Abstände auf ihren alten Wert gesetzt werden."
generator: |-
Der Welt-Generator für die Insel-Welt ist nicht registriert.
Mögliche Gründe sind:
1. Überprüfe, ob du die Welt in der bukkit.yml hinzugefügt hast, falls du die Insel-Welt als einzige Server Welt festgelegt hast.
2. Der Server wurde reloaded und nicht restartet. Starte den Server neu und versuche es nochmal.
generator-multiverse: " 3. Dein Multiverse Plugin ist veraltet. Aktualisiere es auf die neuste Version."
world-name: |-
Der Name der Welt in der config.yml unterscheidet sich vom Namen der Welt in der islands.yml.
Sollte dies gewollt ist, nehmen wir an, dass du alles zurücksetzen willst.
Falls ja, lösche die islands.yml und die vorherige Welt.
Fallls nicht, korrigiere den Namen der Welt in der config.yml und restarte den Server. Das ist möglicherweise passiert, während ein Update durchgeführt wurde.
config-outdated: |-
Die config.yml sieht veraltet aus.
Stelle sicher, dass du die Konfiguration, nach dem Update, aktualisiert hast.
Sollte diser Fehler immer noch auftreten, hast du wahrscheinlich die alte, anstatt der neuen Konfiguration bearbeitet.
Bitte entferne die aktuelle config.yml, bearbeite die config.new.yml und nenne diese dann in config.yml um, falls dies der Fall ist.
general:
success: "Erfolg!"
errors:
no-permission: "Du hast keine Berechtigung, um diesen Befehl zu nutzen."
use-in-game: "Dieser Befehl ist nur In-Game verfügbar."
# TODO: These are legacy strings and should be converted to a better format but will do for now
acidBottle: "Säure Flasche"
acidBucket: "Säure Eimer"
acidLore: |
Trink
das
nicht!
Wirklich!
adminDeleteIsland:
error: "Benutze &l/[label] deleteisland confirm &r&cum die Insel auf der du bist zu löschen."
noid: "Kann Insel nicht identifizieren."
use: "Benutze &l/[label] delete [name] &r&cum stattdessen den Spieler zu löschen."
adminHelp:
add: "Fügt einen Spieler zum Team des Leiters hinzu."
addrange: "Vergrößert bzw. verkleinert den Schutzbereich der Insel."
clearreset: "Resetlimit für Spieler zurücksetzen."
clearresetall: "Setzt das Insel-Reset-Limit von allen Spielern zurück"
cobblestats: "Zeigt Statistiken des Magic Cobble Generators"
completeChallenge: "Markiert eine Herausforderung als abgeschlossen"
delete: "Löscht eine Insel (entfernt Blöcke)."
help: "Admin Befehle:"
info: "Zeigt die Team-Infos eines Spielers."
infoisland: "Infos über die nächstgelegen Insel."
kick: "Entfernt einen Spieler von jeglichen Teams."
level: "Bietet einen detaillierten Berich über das Insel-Level eines Spielers."
listChallengeResets: "Listet Challenge-Reset Pläne, wenn vorhanden."
lock: "Verschließt/entschließt eine Insel."
purge: "Löscht inaktive Inseln älter als [TimeInDays]."
purgeallowdisallow: "Erlaubt/verbietet dass die Insel gelöscht wird wenn die Purge-Kriterien zutreffen."
purgeholes: "Lösche frei Inselstellen für neue Nutzung."
purgeunowned: "Entfernt unbewohnte Inseln."
name: "Setzt Name der Insel des Spielers."
register: "Setzt die Insel eines Spielers an deinen Standpunkt."
reload: "Lädt die Konfiguration neu."
resetAllChallenges: "Setzt alle Challenges des Spielers zurück."
resetChallenge: "Markiert eine Herausforderung als nicht abgeschlossen"
resetChallengeForAll: "Setzt Challenge für alle Spieler zurück mit optionaler Wiederholung"
resetname: "Setzt Name der Insel des Spielers zurück"
resetsign: "Macht das angesehene Schild zum Warp-Schild des Inselbesitzers."
setbiome: "Setzt das Biom des Inselbesitzers."
setdeaths: "Setzt Anzahl an Toden des Spielers"
setlanguage: "Setzt die Standard-Sprache und ändert von allen Spielern die Sprache auf diese"
setrange: "Ändert den Schutzbereich einer Insel"
setspawn: "Setzt den Insel-Welt Spawn."
settingsreset: "Setzt den Schutzbereich für alle Inseln auf die Standard-Einstellungen zurück."
teamChatSpy: "Team Chats ausspionieren (on/off)"
topTen: "Aktualisiert die Top-Liste manuell"
topbreeders: "Listet die Inseln mit den meisten Mobs welche derzeit geladen sind"
tp: "Teleportiere zu der Insel eines Spielers"
tpnether: "Teleportiere zu der Nether-Insel eines Spielers"
unregister: "Lösche einen Spieler ohne die Insel zu löschen"
adminInfo:
bannedPlayers: "Gebannte Spieler"
errorNullTeamLeader: "Teamleiter sollte null sein!"
errorTeamMembersExist: "Spieler hat Teammitglieder, obwohl er keine haben sollte!"
hoppers: "Insel hat [number] Trichter"
islandLocation: "Insel Position"
isLocked: "Insel ist abgeschlossen"
isProtected: "Insel ist Purge-geschützt"
isSpawn: "Insel ist Spawn"
isUnlocked: "Insel ist nicht abgeschlossen"
isUnprotected: "Insel ist nicht Purge-geschützt"
lastLogin: "Letzter Login"
maxSize: "Insel maximale Größe (Distanz)"
player: "Spieler"
teamLeader: "Teamleiter"
teamMembers: "Teammitglieder"
title: "Dies ist die Spawn Insel"
unowned: "Diese Insel gehört derzeit niemandem."
adminLock:
adminLockedIsland: "Deine Insel wurde von einem Admin abgeschlossen."
adminUnlockedIsland: "Deine Insel wurde von einem aufgeschlossen"
errorInGame: "Befehl muss in-game auf einer Insel benutzt werden!"
adminRegister:
hadIsland: "[name] hatte eine Insel an [location]"
leadsTeam: "[name] leitet ein Team. Entferne dessen Mitglieder zuerst."
noIsland: "In diesem Bereich ist keine bekannte Insel!"
notSpawn: "Du kannst die Herrschaft über den Spawn nicht übernehmen!"
taking: "Entferne die Herrschaft von [name]"
adminResetChallengeForAll:
error: "Format für die Zeit zum Wiederholen ist: [Integer Zahl][m/h/d] (Minuten, Stunden, Tage), z. B. 5h"
repeating: "Wiederholen [duration]"
reset: "Zurücksetzen [date]"
adminResetSign:
errorExists: "Dieses Warp Schild ist bereits aktiv und gehört [name]"
found: "Warp Schild gefunden!"
noSign: "Du musst ein Schild ansehen um diesen Befehl zu benutzen."
rescued: "Warp Schild gerettet und [name] zugewiesen"
adminReserve:
islandExists: "Hier ist bereits eine Insel. Registriere den Spieler einfach!"
adminSetHome:
homeSet: "Home gesetzt auf [location]"
noneFound: "Keine sichere Position gefunden!"
notOnPlayersIsland: "Du bist nicht auf der Insel des Spielers"
notSafe: "Diese Position ist nicht sicher"
adminSetRange:
invalid: "Ungültige Entfernung!"
set: "Setze neue Spannweite auf [number]"
tip: "Benutze 10 bis [max]"
updated: "Insel Range aktualisiert auf [number]"
warning: "Warnung - Entfernung ist größer als Insel Weite [max]"
warning2: "Überlappende Inseln werden wie der Spawn agieren!"
adminSetSpawn:
center: "Insel Zentrum [location]"
coords: "Schutzbereich Koordinaten von [min] bis [max]"
limits: "Insel Limit [min] bis [max]"
locked: "Spawn ist gesichert!"
move: "Bewege dich weiter weg oder entferne den Besitzer."
ownedBy: "Dieser Inselplatz gehört [name]"
range: "Schutzbereich = [number]"
set: "Setze Insel Spawn an deine Position."
setting: "Setze Insel Spawn zu [location]"
adminTeam:
addLeaderNoIsland: "Teamleiter hat keine eigene Insel und kann deswegen kein Team haben!"
addLeaderToOwn: "Kann Leiter nicht seinem eigenen Team hinzufügen."
addedLeader: "Leiter zu diesem Team hinzugefügt!"
addingPlayer: "Spieler zum Team hinzugefügt."
alreadyOnTeam: "Spieler war bereits in diesem Team!"
kickLeader: "Dieser Spieler ist ein Teamleiter. Entferne die Mitglieder zuerst. Benutze '/[label] info [name]' um diese zu finden."
nowUnowned: "[name] hatte eine Insel an [location] diese ist nun unbewohnt. Du möchtest sie eventuell manuell entfernen."
settingHome: "Setze Spielers Home an die Position des Inselleiters."
adminTopBreeders:
checking: "Prüfe [number] Inseln..."
finding: "Finde Inseln mit den meisten Kreaturen..."
nothing: "Keine Kreaturen gefunden."
adminTopTen:
finished: "Generieren der Top Ten Liste abgeschlossen"
generating: "Generiere die Top Ten Liste"
adminTp:
manualWarp: "Kein sicherer Platz gefunden. Bewege dich manuell in die nähe von [location]."
adminUnregister:
keepBlocks: "Entferne Spieler aus der Welt, aber behalte Insel bei [location]"
onTeam: "Spieler ist in einem Team - löse es zuerst auf."
ban:
alreadybanned: "[name] ist bereits von deiner Insel gebannt!"
banned: "Du wurdest von [name]s Insel gebannt!"
fail: "[name] kann nicht gebannt werden!"
helpBan: "banne einen Spieler von deiner Insel."
helpUnban: "entbanne einen Spieler von deiner Insel."
lifted: "Bann aufgehoben von [name]s Insel!"
liftedsuccess: "Bann aufgehoben für [name]!"
notbanned: "[name] ist nicht von deiner Insel gebannt!"
notteammember: "Ein Inselmitglied kannst du nicht bannen!"
notyourself: "Das ist keine Lösung!"
success: "[name] wurde von der Insel gebannt!"
notyourself: "Das kannst du dir nicht antun!"
success: "[name] ist von der Insel gebannt!"
biome:
help: "Öffnet das Biom Menü."
paneltitle: "Wähle ein Biom"
set: "Insel Biom geändert in [biome]!"
unknown: "Unbekanntes Biom!"
youbought: "Gekauft für [cost]!"
boats:
warning: "Es ist gefährlich, das Boot jetzt zu verlassen..."
challenges:
colors: "Challenges haben unterschiedliche Farben, je nachdem ob sie:"
complete: abgeschlossen
completeNotRepeatable: "Abgeschlossen (nicht wiederholbar)"
completeRepeatable: "Abgeschlossen (wiederholbar) sind"
completedtimes: "[donetimes]x von [maxtimes]x abgeschlossen"
errorIslandLevel: "Deine Insel muss auf Level [level] sein, um diese Herausforderung abzuschliessen!"
errorItemsNotThere: "Alle benötigten Items müssen bei deiner Insel sein!"
errorNotCloseEnough: "Du musst innerhalb von [number] Blöcken von den benötigten Items stehen."
errorNotEnoughItems: "Du hast nicht genug von den benötigten Items"
errorNotOnIsland: "Du musst auf deiner Insel sein!"
errorRewardProblem: "Ein Fehler ist aufgetreten. Bitte informiere einen Teamler!"
erroryouaremissing: "Du bist verloren!!!"
expReward: "Exp Belohnung"
firstTimeRewards: "Belohnung (Erstes mal)"
guititle: "BSkyBlock Herausforderungen"
help1: "Benutze /c <name> um Infos über eine Herausforderung zu sehen."
help2: "Benutze /c complete <name> um eine Herausforderung abzuschliessen."
incomplete: "Nicht abgeschlossen"
invalidChallengeName: "Ungültige Herausforderung! Benutze /c help für mehr Infos!"
itemTakeWarning: "Alle benötigten Items werden aus deinem Inventar genommen!"
level: "Level"
maxreached: "[donetimes]x von [maxtimes]x abgeschlossen"
moneyReward: "Geld"
name: "Herausforderung Name"
nameHasCompleted: "[name] hat die Herausforderung [challenge] erfolgreich abgeschlossen!"
navigation: "Click to see [level] challenges!"
notRepeatable: "Diese Challenge ist nicht wiederholbar!"
repeatRewards: "Belohnung"
rewards: "Belohnung(en)"
toComplete: "Bestehe [challengesToDo] weitere Herausforderungen als [thisLevel] um dieses Level frei zu schalten!"
toCompleteUse: "Um diese Herausforderung abzuschliessen, benutze"
unknownChallenge: "Unbekannte Herausforderung (Schreibweise beachten)!"
youHaveCompleted: "Du hast die Herausforderung [challenge] erfolgreich abgeschlossen!"
youHaveNotUnlocked: "Du hast diese Herausforderung noch nicht freigeschaltet!"
youRepeated: "Du hast die Herausforderung [challenge] erneut abgeschlossen!"
changingObsidiantoLava: "Verändere Obsidian zurück in Lava. Vorsicht!"
checkteam:
checkingTeam: "Prüfe Team von [name]"
completechallenge:
challangeCompleted: "Herausforderung: [challengename] wurde von [name] abgeschlossen!"
errorChallengeDoesNotExist: "Herausforderung existiert nicht oder wurde schon abgeschlossen!"
confirm:
errorTimeLimitExpired: "Zeit abgelaufen. Benutze den Befehl erneut."
coop:
cannotcoop: "Nur der Insel-Leiter kann mit Spielern kooperieren."
help: "Temporärer Zugriff für einen Spieler auf deiner Insel."
invited: "[name] ernannte [player] zum temporären Partner! Nutze /expel um ihn zu entfernen!"
listcoops: "Liste kooperierende Spieler"
madeyoucoopy: "[name] hat dich zum temporären Partner gemacht, bis du dich ausloggt oder er dich mit /expel entfernt!"
notincoop: "[name] ist nicht dein Partner!"
onyourteam: "Spieler ist bereits temporärer Partner!"
removed: "[name] entfernte deine Partnerschaft!"
removesuccess: "[name] ist kein Partner mehr!"
success: "[name] ist nun dein temporärer Partner bis er ausloggt oder du ihn mit /expel entfernst!"
uncoop: "entferne vollen Insel Zugriff von einem Spieler"
useexpel: "Nutze /expel um jemand entfernen!"
deaths:
deaths: "Tode"
died: "starb!"
leveldeaths: "&c[[number] Tode]"
delete:
removing: "Entferne [name]s Insel."
drankAcid: "trank Säure."
drankAcidAndDied: "trank Säure und starb."
error:
blockedbyapi: "Ein Plugin, welches die API benutzt, blockierte diese Aktion."
commandNotReady: "Du kannst diesen Befehl jetzt nicht benutzen."
maxIslands: "Die Welt ist voll mit Inseln! Versuche es später erneut!"
noIsland: "Du hast keine Insel!"
noIslandOther: "Dieser Spieler hat keine Insel!"
noPermission: "Du bist nicht berechtigt diesen Befehl zu benutzen."
notABlock: "Das ist kein Block."
noTeam: "Spieler gehört keinem Team an."
notOnIsland: "Du bist nicht in einem Inselraum!"
offlinePlayer: "Dieser Spieler ist offline oder existiert nicht."
tooLong: "Zu weit. Maximale Größe ist [length]."
tooShort: "Zu kurz. Minimale Größe ist [length]."
unknownCommand: "Unbekannter Befehl."
unknownPlayer: "Spieler unbekannt."
useInGame: "Dieser Befehl muss in-game benutzt werden."
wrongWorld: "Das ist die falsche Welt dafür."
minishopDisabled: "Minishop ist deaktiviert."
expel:
expelled: "Du wurdest von der Insel entfernt!"
fail: "[name] kann nicht entfernt werden!"
notonisland: "Spieler ist nicht auf deiner Insel anwesend!"
notyourself: "Du kannst dich nicht selber von deiner Insel vertreiben!"
success: "Du hast [name] entfernt!"
invite:
errorCantJoinIsland: "Du konntest der Insel nicht beitreten. Vielleicht ist sie voll."
errorCoolDown: "Du kannst diesen Spieler in [time] Minuten erneut einladen."
errorThatPlayerIsAlreadyInATeam: "Dieser Spieler ist schon in einem Team."
errorYouCannotInviteYourself: "Du kannst nicht dich selbst einladen!"
errorYouMustHaveIslandToInvite: "Du musst eine Insel haben, um andere einladen zu können!"
errorYourIslandIsFull: "Deine Insel ist voll. Du kannst niemanden mehr einladen."
hasJoinedYourIsland: "[name] ist deiner Insel beigetreten!"
help: "Benutze [/[label] invite <playername>] um einen Spieler zu deiner Insel einzuladen."
inviteSentTo: "Einladung verschickt an [name]"
nameHasInvitedYou: "[name] hat dich eingeladen, seiner Insel beizutreten!"
onlyIslandOwnerCanInvite: "Nur der Leiter kann einladen!"
removingInvite: "Entferne deine vorherige Einladung"
toAcceptOrReject: "um die Einladung anzunehmen oder abzulehnen."
warningYouWillLoseIsland: "WARNUNG: Du wirst deine jetzige Insel verlieren, wenn du akzeptierst!"
youCanInvite: "Du kannst noch [number] weitere Spieler einladen."
youCannotInvite: "Du kannst keine weiteren Spieler einladen."
youHaveJoinedAnIsland: "Du bist einer Insel beigetreten! Benutze /[label] team um die Mitglieder zu sehen."
island:
blockValue: "[name] ist an dieser Position [value] wert."
blockWorthless: "[name] ist wertlos."
cannotTeleport: "Im Fall kannst du dich nicht teleportieren!"
donate: "BSkyBlock von tastybento."
donatecolor: "aqua"
error:
CouldNotCreateIsland: "Insel konnte nicht erstellt werden, bitte melde das einem Moderator."
InvalidPlayer: "Dieser Spieler ist ungültig oder hat keine Insel!"
LevelNotReady: "Du kannst diesen Befehl gerade nicht nutzen! Versuch es in einigen Sekunden."
YouDoNotHavePermission: "Du besitzt keine Rechte dazu!"
YouAlreadyHaveAnIsland: "Du besitzt bereits eine Insel!"
help:
AcceptReject: "Einladung annehmen oder ablehnen."
Challenges: "/challenges: &fZeigt die Herausforderungen"
Color: "&e"
ControlPanel: "Öffnet das Insel GUI."
Expel: "Beendet die Partnerschaft mit einem Spieler."
Invite: "Lade Spieler auf deine Insel ein."
Island: "Teleportiert dich zu deiner Insel, oder erstellt eine für dich."
IslandSpawn: "Teleportiert dich zum Spawn."
Kick: "Entferne einen Spieler von deiner Insel."
Leave: "Verlasse die Insel eines anderen Spielers."
Level: "Berechne dein Insel-Level"
LevelPlayer: "Siehe das Level einer anderen Insel."
Lock: "Sperre deine Insel für Besucher"
MakeLeader: "Übergebe die Insel an <player>."
Name: "Setze einen Namen für deine Insel."
ResetName: "Setze Name deiner Insel zurück."
Restart: "Starte Insel neu und lösche die alte."
SelectLanguage: "Wähle Sprache"
SetHome: "Setze deinen Teleport-Punkt für /[label]."
Settings: "Siehe Insel-Einstellungen"
Team: "Zeigt deine Team-Informationen."
Teleport: "Teleportiert dich auf deine Insel."
Top: "Siehe die besten Inseln."
Value: "Zeige Insel Level Wert von dem Block in deiner Hand"
Warp: "Warpe zu <player>'s Insel."
Warps: "Liste aller verfügbaren Insel-Warps."
islandDeletedLifeboats: "Insel gelöscht! Zu den Rettungskapseln!!!"
islandLevelis: "Insel-Level: "
new: "Es wird eine neue Insel für dich erstellt..."
protected: "Island geschützt."
requiredPointsToNextLevel: "Du brauchst noch [points] Punkte, um das Insel-Level [next] zu erreichen!"
reset:
Confirm: "&4Deine Insel und alles was du besitzt wird gelöscht. Wenn du das wirklich möchtest dann gib &c/[label] confirm&4 innerhalb von [seconds] Sekunden ein!"
MustRemovePlayers: "Du musst alle Mitglieder von der Insel entfernen, um sie neu zu starten (/[label] kick <player>). Eine Liste aller Mitglieder zeigt dir /[label] team."
NoMore: "Du hast alle Resets aufgebraucht!"
OnlyOwner: "Nur der Teamleiter darf diese Insel neu starten. Verlasse diese Insel, um eine eigene zu starten (/[label] leave)."
PleaseWait: "Bitte warten, neue Insel wird erstellt..."
Left: "Resets übrig"
To: "Resetlimit zurückgesetzt!"
Wait: "Du musst noch [time] Sekunden warten bevor du das wieder nutzen kannst."
YouHave: "Es sind noch [number] weitere Resets möglich."
subtitle: "von tastybento"
subtitlecolor: "blue"
teleport: "Du wurdest auf deine Insel teleportiert. (/[label] help für mehr Infos)"
title: "BSkyBlock"
titlecolor: "gold"
unlimited: "Unbegrenzt"
url: ""
islandguardsettings:
TNTdamage: "TNT Schaden"
allowed: "Erlaubt"
aciddamage: "Säure Schaden"
animalspawning: "Erlaube/Verbiete Spawnen von Tieren"
anvil: "Amboss Verwendung"
armorstand: "Rüstungsständer Interaktion"
beacon: "Leuchtfeuer Interaktion"
bed: "Schlafen"
breakblocks: "Blöcke zerstören"
breeding: "Paaren"
brewingstand: "Tränke brauen"
bucket: "Eimer benutzen"
collectlava: "Lava sammeln"
collectwater: "Water sammeln"
chest: "Kisten benutzen"
chestdamage: "Kistenschaden durch TNT"
chorusfruit: "Chorus benutzen"
creeperdamage: "Creeper Schaden"
creepergriefing: "Creeper griefing"
creeperpain: "Creeper Explosionsschaden"
croptrample: "Felder zertrampeln"
disallowed: "Verboten"
door: "Türen benutzen"
eggs: "Eier werfen"
enchantingtable: "Verzaubern"
enderpearl: "Enderperlen benutzen"
fire: "Feuer"
fireextinguish: "Feuer löschen"
firespread: "Feuer verbreiten"
furnace: "Öfen benutzen"
gate: "Zauntore benutzen"
horseinventoryaccess: "Besucher Pferde-Inventar Zugriff"
horseriding: "Besucher Pferde reiten"
hurtanimals: "Tiere verletzen"
hurtmonsters: "Monster verletzen"
joinleaveislandmessages: "Entritte/Ausfahrten Beiträge anzeigen"
jukebox: "Plattenspieler benutzen"
leash: "Leinen benutzen"
lever: "Knöpfe/Hebel benutzen"
milking: "Melken"
monsterspawning: "Spawnen von Monstern umschalten"
netherpvp: "PvP im Nether"
placeblocks: "Blöcke platzieren"
portaluse: "Portale benutzen"
pressureplate: "Besucher aktivieren Druckplatten"
pvp: "PvP"
redstone: "Redstone benutzen"
settingsgeneraltitle: "Generelle Insel-Welt Einstellungen"
settingsgeneraldesc: "Generelle Insel-Welt Einstellungen"
settingsislandtitle: "Insel Einstellungen"
settingsislanddesc: "Diese Regeln greifen für Besucher auf dieser Insel"
settingsspawntitle: "Spawn Einstellungen"
settingsspawndesc: "Diese Regeln greifen am Spawn"
shears: "Scheren benutzen"
spawnegg: "Spawneier benutzen"
teleportwhenfalling: "Beim Fall teleportieren"
title: "Insel Einstellungen"
villagertrading: "Villager trading"
visitordrop: "Besucher Item-drop"
visitorkeepitems: "Items beim Tod auf fremden Inseln behalten"
visitorpickup: "Besucher Item-Aufnahme"
withergriefing: "Wither griefing"
workbench: "Werkbank Benutzung"
kick:
errorNoTeam: "Du hast kein Team!"
errorNotPartOfTeam: "Dieser Spieler ist nicht in deinem Insel-Team!"
errorOnlyLeaderCan: "Nur der Leiter kann Leute von der Insel werfen!"
errorPlayerNotInTeam: "Dieser Spieler ist nicht in deinem Team!"
nameRemoved: "[name] wurde von der Insel entfernt."
nameRemovedYou: "[name] hat dich von der Insel entfernt!"
lavaTip: "Tipp: Falls du kein Obsidian wolltest, führe einen Rechtsklick mit einem Eimer auf das Obsidian aus. Du hast danach Lava im Eimer!"
leave:
canceled: "Leave canceled"
errorLeadersCannotLeave: "Teamleiter können eine Insel nicht verlassen. Ernenne erst jemand anderen zum Teamleiter mit /[label] makeleader <player>"
errorYouAreTheLeader: "Du bist der Teamleiter, benutze stattdessen /[label] remove <player>."
errorYouCannotLeaveIsland: "Du kannst deine Insel nicht verlassen, wenn du die einzige Person bist. Versuche sie neu zu starten, wenn du eine neue willst!"
errorYouMustBeInWorld: "Du musst in der Insel-Welt sein, um dein Team zu verlassen!"
nameHasLeftYourIsland: "[name] hat deine Insel verlassen!"
warning: "Bist du dir sicher, dass du das Team verlassen willst? Nutze '/[label] leave' erneut, um die Entscheidung zu bestätigen."
youHaveLeftTheIsland: "Du hast die Insel verlassen und bist zum Spawn zurückgekehrt."
level:
calculating: "Dein Insel Level wird berechnet. Das kann einen Moment dauern..."
errornotYourIsland: "Nur der Teamleiter kann das."
islandLevel: "Insel-Level"
lock:
enteringspawn: "Du betrittst den Spawn"
islandlocked: "Insel is für Besucher gesperrt"
leavingspawn: "Du verlässt den Spawn"
locking: "Insel für Besucher gesperrt"
nowentering: "Du betrittst nun die Insel von: [name]"
nowleaving: "Du verlässt nun die Insel von: [name]"
unlocking: "Insel für Besucher wieder geöffnet"
makeleader:
errorGeneralError: "Konnte Leiter nicht ändern."
errorNotYourIsland: "Das ist nicht deine Insel. Du kannst sie niemandem geben!"
errorPlayerMustBeOnline: "Der Spieler muss online sein, um die Insel zu übernehmen."
errorRemoveAllPlayersFirst: "Entferne alle Mitglieder ausser die Person, der du die Insel übergeben willst."
errorThatPlayerIsNotInTeam: "Dieser Spieler ist nicht in deinem Insel-Team!"
errorYouMustBeInTeam: "Du musst in einem Team sein, um deine Insel abzugeben."
nameIsNowTheOwner: "[name] ist jetzt der Besitzer deiner Insel!"
youAreNowTheOwner: "Du bist jetzt der Besitzer deiner Insel."
minishop:
buy: "Kaufen (Linksklick)"
buyproblem: "Es gab ein Problem beim Kauf von [description]!"
islandhelpMiniShop: "Öffnet den MiniShop"
outofstock: "Nicht genügend Items!"
sell: "Verkaufen (Rechtsklick)"
sellproblem: "Du hast nicht genügend von [description] um es zu verkaufen!"
title: MiniShop
youbought: "&aDu hast &c[number] &b[description] &afür &c[price] §aEuro gekauft!"
youcannnotafford: "Du hast nicht genügend Geld für [description]!"
yousold: "Du hast [number] [description] für [price] Euro verkauft!"
moblimits:
entity: "Island [entity] limit of [number] reached!"
error: "Insel Paarungslimit von [number] erreicht!"
hopper: "Insel Trichter limit von [number] erreicht!"
villager: "Insel Dorfbewohner Paarungslimit von [number] erreicht!"
nether:
spawnisprotected: "Der Netherspawn-Bereich ist geschützt."
news:
headline: "[BSkyblock News] Während du offline warst..."
purge:
acidFound: "Es gibt [number] unbewohnte Inseln. Tippe '/acid purge unowned confirm' zum entfernen in den nächsten 20 Sekunden."
allowPurge: "Purge-Schutz entfernt"
alreadyRunning: "Löschung läuft bereits! Bitte warten!"
calculating: "Berechne welche Inseln inaktiv waren für mehr als [time] Tage."
countingUnowned: "Zähle unbewohnte Inseln und prüfe Spielerdateien. Das kann ein wenig dauern..."
finished: "Löschen von inaktiven Inseln abgeschlossen."
maxPurge: "Max purge is [number] islands. Run purge again afterwards to purge more."
noneFound: "Keine inaktiven Inseln zu löschen."
nowWaiting: "Warte nun..."
preventPurge: "Insel ist vor dem Löschen geschützt"
purgeCancelled: "Löschen abgebrochen."
removingAt: "Entferne Inseln bei Position [location]"
removingName: "Löschung: Entferne [name]'s Insel"
skyblockFound: "Es gibt [number] unbewohnte Inseln. Tippe '/asadmin purge unowned confirm' zum entfernen in den nächsten 20 Sekunden."
stillChecking: "Prüfe weiterhin Spielerdateien..."
thisWillRemove: "Dies wird [number] inaktive Inseln löschen!"
typeConfirm: "Schreibe /[label] confirm während 10 Sekunden um fortzufahren"
usage: "Benutze: /[label] purge [TimeInDays]"
warning: "GEFAHR! Nicht benutzen, wenn Spieler auf dem Server sind! MACHE BACKUPS DER WELT!"
register:
errorBedrockNotFound: "Insel kann nicht registriert werden!"
settingIsland: "Setze [name]s Insel zu dem nächsten Grundstein."
reject:
nameHasRejectedInvite: "[name] hat deine Insel-Einladung abgelehnt!"
youHaveNotBeenInvited: "Du wurdest nicht in ein Team eingeladen."
youHaveRejectedInvitation: "Du hast die Insel-Einladung abgelehnt."
reload:
configReloaded: "Konfiguration neu geladen."
resetallchallenges:
success: "[name]s Challenges wurden alle zurückgesetzt."
resetchallenge:
challengeReset: "Herausforderung: [challengename] wurde zurückgesetzt für [name]"
errorChallengeDoesNotExist: "Herausforderung existiert nicht oder wurde noch nicht abgeschlossen!"
schematics:
title: "Wähle deine Insel..."
sethome:
errorNoIsland: "Du gehörst zu keiner Insel. Kehre zurück zum Spawn!"
errorNotOnIsland: "Du musst dich auf deiner Insel befinden!"
errorNumHomes: "Die Anzahl deiner homes kann 1 bis [max] betragen."
homeSet: "Dein Insel-Home wurde auf deine aktuelle Position gesetzt."
settingsReset:
done: "Done."
inprogress: "Schutzbereich Einstellungen werden zurückgesetzt. Bitte warte..."
sign:
line1: "&1[BSkyblock]"
line2: "[player]"
line3: "Fall nicht!"
line4: "Pass auf!"
sign-acidisland:
line1: "&1[Acid Insel]"
line2: "[player]"
line3: "Wasser ist Säure!!"
line4: "Pass auf!"
targetInPVPArea: "Ziel befindet sich in einer PvP freien Zone!"
team:
listingMembers: "Liste deiner Insel-Mitglieder"
teamchat:
helpChat: "aktiviere/deaktiviere den Team chat"
noTeam: "Du bist in keinem Team!"
noTeamAround: "Keines deiner Teammitglieder ist online!"
prefix: "[Team Chat]<{ISLAND_PLAYER}> "
spyoff: "Team Chat Spionage aktiviert"
spyon: "Team Chat Spionage deaktviert"
statusOff: "Team Chat deaktiviert"
statusOn: "Team Chat aktiviert"
topTen:
errorExcluded: "Info: Du bist von den Top 10 ausgeschlossen, da dir die Permission [perm] fehlt."
errorNotReady: "Die Top 10 Liste wurde noch nicht generiert!"
guiHeading: "&E&L<!> Island: &6&N[name]&7 (#[rank])"
guiTitle: "Top 10 Inseln"
header: "Das sind die Top 10 Inseln:"
warps:
deactivate: "Das alte Insel-Warp-Schild wurde deaktiviert!"
error:
DoesNotExist: "Dieser Insel-Warp existiert nicht!"
Duplicate: "Sorry! Es gibt schon ein Warp-Schild in diesem Bereich!"
NoPerm: "Du darfst noch kein Insel-Warp-Schild erstellen!"
NoPlace: "Du musst auf deiner Insel sein um ein Insel-Warp-Schild zu erstellen!"
NoRemove: "Du kannst nur dein eigenes Insel-Warp-Schild entfernen!"
NoWarpsYet: "Es gibt noch keine Insel-Warps!"
NotReadyYet: "Dieser Insel-Warp ist noch nicht bereit. Versuch es später erneut."
NotSafe: "Der Insel-Warp ist nicht sicher. Versuch es später erneut."
NotEnoughLevel: "Dein Insel-Level ist zu niedrig, um ein Warp-Schild zu erstellen!"
next: "Nächste"
playerWarped: "[name] &2hat sich zu deinem Warp teleportiert!"
previous: "Vorherige"
removed: "Insel-Warp-Schild entfernt!"
signRemoved: "Dein Insel-Warp-Schild wurde entfernt!"
success: "Insel-Warp-Schild erfolgreich erstellt!"
title: "Insel Warps"
warpTip: "&aErstelle ein Warp-Schild mit &c[WELCOME] &ain der obersten Zeile."
warpToPlayersSign: "Teleportiere zu <player>'s Insel-Warp."
warpsAvailable: "Folgende Insel-Warps sind verfügbar"
welcomeLine: "[WELCOME]"

19
locales/en-GB.yml Normal file
View File

@ -0,0 +1,19 @@
###########################################################################################
# This is a YML file. Be careful when editing. Check your edits in a YAML checker like #
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# Tastybento: maintainer
# Poslovitch: maintainer
#
# This translation is adapted to version : [alpha-1]
banner: "BANNER:1:BLUE:STRIPE_DOWNLEFT:WHITE:STRIPE_DOWNRIGHT:WHITE:STRIPE_CENTER:WHITE:STRIPE_MIDDLE:WHITE:STRAIGHT_CROSS:RED:CROSS:RED"
protection:
flags:
ARMOR_STAND:
description: "Toggle interaction"
name: "Armour stands"
hint: "Armour stand use disabled"

633
locales/en-US.yml Normal file
View File

@ -0,0 +1,633 @@
###########################################################################################
# This is a YML file. Be careful when editing. Check your edits in a YAML checker like #
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# tastybento: maintainer
# Poslovitch: maintainer
#
# This translation is adapted to version : [alpha-2]
banner: "BANNER:1:WHITE:STRIPE_SMALL:RED:SQUARE_TOP_RIGHT:CYAN:SQUARE_TOP_RIGHT:BLUE"
general:
success: "&aSuccess!"
request-cancelled: "&cConfirmation timeout - &brequest cancelled"
previous-request-cancelled: "&6Previous confirmation request cancelled"
confirm: "&cType command again within &b[seconds]s&c to confirm"
errors:
command-cancelled: "&cCommand cancelled"
no-permission: "&cYou don't have permission to execute this command."
use-in-game: "&cThis command is only available in game."
no-team: "&cYou do not have a team!"
no-island: "&cYou do not have an island!"
player-has-island: "&cPlayer already has an island!"
player-has-no-island: "&cThat player has no island!"
already-have-island: "&cYou already have an island!"
no-safe-location: "&cNo safe location found on island!"
not-leader: "&cYou are not the leader of your island!"
not-in-team: "&cThat player is not in your team!"
offline-player: "&cThat player is offline or doesn't exist."
unknown-player: "&cUnknown player!"
unknown-player-name: "&c[name] is an unknown player!"
general: "&cThat command is not ready yet - contact admin"
unknown-command: "&cUnknown command. Do &b/[label] help &cfor help."
warp-not-safe: "&cThat warp is not safe right now!"
wrong-world: "&cYou are not in the right world to do that!"
you-must-wait: "&cYou must wait [number]s before you can do that command again"
you-need: "&cYou need [permission]"
tips:
changing-obsidian-to-lava: "Changing obsidian back into lava. Be careful!"
commands:
# Parameters in <> are required, parameters in [] are optional
help:
header: "&7=========== &c[label] help &7==========="
syntax: "&b[usage] &a[parameters]&7: &e[description]"
end: "&7================================="
parameters: "[command]"
description: "help command"
admin:
help:
parameters: ""
description: "admin command"
clearresets:
parameters: "<player>"
description: "clears player reset count for this world"
cleared: "&2Resets cleared"
clearresetsall:
description: "clears all player reset counts for this world"
team:
add:
parameters: "<leader> <player>"
description: "add player to leader's team"
name-not-leader: "&c[name] is not the leader"
name-has-island: "&c[name] has an island. Unregister or delete them first!"
disband:
parameters: "<team leader>"
description: "disband team leader's team"
user-disband-leader: "&cNot leader! Use disband [leader]"
disbanded: "&cAdmin disbanded your team!"
kick:
parameters: "<team player>"
description: "kick a player from a team"
cannot-kick-leader: "&cYou cannot kick the team leader. Kick members first"
admin-kicked: "&cThe admin kicked you from the team."
makeleader:
parameters: "<player>"
description: "make player the team's leader"
already-leader: "&cPlayer is already the leader!"
range:
description: "Admin island range command"
display:
already-off: "&cIndicators are already off"
already-on: "&cIndicators are already on"
description: "Show/hide island range indicators"
hiding: "&2Hiding range indicators"
hint: |-
&cRed Barrier icons &fshow the current island protected range limit.
&7Gray Particles &fshow the max island limit.
&aGreen Particles &fshow the default protected range if the island protection range differs from it.
showing: "&2Showing range indicators"
set:
parameters: "<player> <range>"
description: "Sets the island protected range"
invalid-value:
not-numeric: "&c[number] is not a whole number!"
too-low: "&cThe protection range must be greater than 1!"
too-high: "&cThe protection range should be equal or less than [number]!"
same-as-before: "&cThe protection range is already set to [number]!"
success: "&2Set island protection range to [number]"
reset:
parameters: "<player>"
description: "Resets the island protected range to the world default"
success: "&2Reset island protection range to [number]"
register:
parameters: "<player>"
description: "register player to unowned island you are on"
registered-island: "&aRegistered player to island at [xyz]."
already-owned: "&cIsland is already owned by another player!"
no-island-here: "&cThere is no island here. Confirm to make one."
unregister:
parameters: "<owner>"
description: "unregister owner from island, but keep island blocks"
unregistered-island: "&aUnregistered player from island at [xyz]."
info:
parameters: "<player>"
description: "get info on where you are or player's island"
no-island: "&cYou are not in an island right now..."
title: "========== Island Info ============"
owner: "Owner: [owner] ([uuid])"
last-login: "Last login: [date]"
deaths: "Deaths: [number]"
resets-left: "Resets: [number] (Max: [total])"
team-members-title: "Team members:"
team-owner-format: "&a[name] [rank]"
team-member-format: "&b[name] [rank]"
island-location: "Island location: [xyz]"
island-coords: "Island coordinates: [xz1] to [xz2]"
protection-range: "Protection range: [range]"
protection-coords: "Protection coordinates: [xz1] to [xz2]"
is-spawn: "Island is a spawn island"
banned-players: "Banned players:"
banned-format: "&c[name]"
unowned: "&cUnonwed"
version:
description: "display %bsb_plugin_name% and addons versions"
setrange:
parameters: "<player> <range>"
description: "set the range of player's island"
range-updated: "Island range updated to [number]"
reload:
description: "reload the plugin"
tp:
parameters: "<player>"
description: "teleport to a player's island"
manual: "&cNo safe warp found! Manually tp near to &b[location] &cand check it out"
getrank:
parameters: "<player>"
description: "get a player's rank on their island"
rank-is: "&aRank is [rank] on their island."
setrank:
parameters: "<player> <rank>"
description: "set a player's rank on their island"
unknown-rank: "&cUnknown rank!"
rank-set: "&aRank set from [from] to [to]."
schem:
parameters: "<load><copy><paste><pos1><pos2><save>"
description: "manipulate schems"
copy-first: "&cCopy a schem first!"
file-exists: "&cFile already exists, overwrite?"
no-such-file: "&cNo such file!"
could-not-load: "&cCould not load that file!"
could-not-save: "&cHmm, something went wrong saving that file: [message]"
set-pos1: "&aPosition 1 set at [vector]"
set-pos2: "&aPosition 2 set at [vector]"
set-different-pos: "&cSet a different location - this pos is already set!"
need-pos1-pos2: "&cSet pos1 and pos2 first!"
copied-blocks: "&bCopied [number] blocks to clipboard"
look-at-a-block: "&cLook at block within 20 blocks to set"
world:
description: "Manage world settings"
island:
about:
description: "display copyright and license info"
go:
parameters: "[home number]"
description: "teleport you to your island"
teleport: "&aTeleporting you to your island."
teleported: "&aTeleported you to home &e#[number]."
tip: "&bType /[label] help &afor help."
help:
description: "The main island command"
pick-world: "&cSpecify world from [worlds]"
spawn:
description: "teleport you to the spawn"
create:
description: "create an island"
unable-create-island: "Your island could not be generated, please contact an administrator."
creating-island: "Creating your island..."
pick-world: "&cPick a world from [worlds]"
info:
description: "display info about your island"
reset:
description: "restart your island and remove the old one"
must-remove-members: "You must remove all members from your island before you can restart it (/island kick <player>)."
none-left: "&cYou have no more resets left!"
resets-left: "&cYou have [number] resets left"
sethome:
description: "set your teleport point for /island"
must-be-on-your-island: "You must be on your island to set home!"
num-homes: "Homes can be 1 to [number]."
home-set: "Your island home has been set to your current location."
parameters: "[home number]"
setname:
description: "set a name for your island"
name-too-short: "&cToo short. Minimum size is [number] characters."
name-too-long: "&cToo long. Maximum size is [number] characters."
parameters: "<name>"
resetname:
description: "reset your island name"
team:
description: "manage your team"
info:
description: "display detailed info about your team"
invite:
description: "invite a player to join your island"
invitation-sent: "Invitation sent to [name]"
removing-invite: "Removing invite"
name-has-invited-you: "[name] has invited you to join their island."
to-accept-or-reject: "Do /island team accept to accept, or /island team reject to reject"
you-will-lose-your-island: "&cWARNING! You will lose your island if you accept!"
errors:
cannot-invite-self: "&cYou cannot invite yourself!"
cooldown: "&cYou cannot invite that person for another [number] seconds"
island-is-full: "&cYour island is full, you can't invite anyone else."
none-invited-you: "&cNo one invited you :c."
you-already-are-in-team: "&cYou are already on a team!"
already-on-team: "&cThat player is already on a team!"
invalid-invite: "&cThat invite is no longer valid, sorry."
parameters: "<player>"
you-can-invite: "You can invite [number] more players."
accept:
description: "accept an invitation"
you-joined-island: "&aYou joined an island! Use /[label] team info to see the other members."
name-joined-your-island: "&a[name] joined your island!"
reject:
description: "reject an invitation"
you-rejected-invite: "&aYou rejected the invitation to join an island."
name-rejected-your-invite: "&c[name] rejected your island invite!"
cancel:
description: "cancel the pending invite to join your island"
leave:
cannot-leave: "&cTeamleaders cannot leave! Become a member first, or kick all members."
description: "leave your island"
left-your-island: "&c[name] left your island"
kick:
description: "remove a member from your island"
parameters: "<player>"
leader-kicked: "&cThe leader kicked you from the island!"
cannot-kick: "&cYou cannot kick yourself!"
demote:
description: "demote a player on your island down a rank"
parameters: "<player>"
failure: "&cPlayer cannot be demoted any further!"
success: "Demoted [name] to [rank]"
promote:
description: "promote a player on your island up a rank"
parameters: "<player>"
failure: "&cPlayer cannot be promoted any further!"
success: "Promoted [name] to [rank]"
setowner:
description: "transfer your island ownership to a member"
errors:
cant-transfer-to-yourself: "&cYou can't transfer ownership to yourself! Well, infact, you could... But we don't want you to. 'Cause it's bad."
target-is-not-member: "&cThat player is not part of your island team!"
name-is-the-owner: "&a[name] is now the island owner!"
parameters: "<player>"
you-are-the-owner: "&aYou are now the island owner!"
ban:
description: "ban a player from your island"
parameters: "<player>"
cannot-ban-yourself: "&cYou cannot ban yourself!"
cannot-ban: "&cThat player cannot be banned."
cannot-ban-member: "&cKick the team member first, then ban."
player-already-banned: "&cPlayer is already banned"
owner-banned-you: "&b[name]&c banned you from their island!"
you-are-banned: "&bYou are banned from this island!"
unban:
description: "unban a player from your island"
parameters: "<player>"
cannot-unban-yourself: "&cYou cannot unban yourself!"
player-not-banned: "&cPlayer is not banned"
you-are-unbanned: "&b[name]&a unbanned you from their island!"
banlist:
description: "list banned players"
noone: "&aNo one is banned on this island"
the-following: "&bThe following players are banned:"
names: "&c[line]"
settings:
description: "display island settings"
language:
description: "select language"
ranks:
owner: "Owner"
member: "Member"
coop: "Coop"
visitor: "Visitor"
banned: "Banned"
admin: "Admin"
mod: "Mod"
protection:
command-is-banned: "Command is banned for visitors"
flags:
ANIMAL_SPAWN:
description: "Toggle spawning"
name: "Animal spawning"
ANVIL:
description: "Toggle interaction"
name: "Anvils"
hint: "Anvil use disabled"
ARMOR_STAND:
description: "Toggle interaction"
name: "Armor stands"
hint: "Armor stand use disabled"
BEACON:
description: "Toggle interaction"
name: "Beacons"
hint: "Beacon use disabled"
BED:
description: "Toggle interaction"
name: "Beds"
hint: "Bed use disabled"
BREAK_BLOCKS:
description: "Toggle breaking"
name: "Break blocks"
hint: "Block breaking disabled"
BREEDING:
description: "Toggle breeding"
name: "Breed animals"
hint: "Animal breeding protected"
BREWING:
description: "Toggle interaction"
name: "Brewing stands"
hint: "No brewing allowed"
BUCKET:
description: "Toggle interaction"
name: "Buckets"
hint: "No bucket use allowed"
BUTTON:
description: "Toggle button use"
name: "Buttons"
hint: "No button use allowed"
CHEST:
description: "Toggle chest access"
name: "Chests"
hint: "Chest access disabled"
CHEST_DAMAGE:
description: "Toggle chest damage from explosions"
name: "Chest Damage"
CHORUS_FRUIT:
description: "Toggle teleportation"
name: "Chorus fruits"
hint: "No teleporting"
CLEAN_SUPER_FLAT:
description: |-
&aEnable to clean any
&asuper-flat chunks in
&aisland worlds
name: "Clean Super Flat"
COLLECT_LAVA:
description: |-
&aToggle collecting lava
&a(override Buckets)
name: "Collect lava"
hint: "No lava collection"
COLLECT_WATER:
description: |-
&aToggle collecting water
&a(override Buckets)
name: "Collect water"
hint: "No water collection"
CRAFTING:
description: "Toggle use"
name: "Workbenches"
hint: "No workbench use"
CREEPER_DAMAGE:
description: "Toggle creeper damage"
name: "Creeper damage"
CREEPER_GRIEFING:
description: "Toggle creeper griefing"
name: "Creeper griefing"
hint: "No creeper griefing allowed"
CROP_TRAMPLE:
description: "Toggle crop trampling"
name: "Trample crops"
hint: "Crops are protected"
DOOR:
description: "Toggle door usage"
name: "Use doors"
hint: "No door use"
EGGS:
description: "Toggle egg throwing"
name: "Egg throwing"
hint: "No egg throwing"
ELYTRA:
description: "Toggle use on island"
name: "Elytra"
hint: "No elytra flying allowed"
ENCHANTING:
description: "Toggle use"
name: "Enchanting table"
hint: "No table use"
ENDER_CHEST:
description: "Toggle use/crafting"
name: "Ender Chests"
hint: "Ender chests are disabled in this world"
ENDERMAN_DEATH_DROP:
description: |
Endermen will drop
any block they are
holding if killed.
name: "Enderman Death Drop"
ENDERMAN_GRIEFING:
description: |
Endermen can remove
blocks from islands
name: "Enderman griefing"
ENDER_PEARL:
description: "Toggle use"
name: "EnderPearls"
hint: "No enderpearl use"
ENTER_EXIT_MESSAGES:
description: "Display entry and exit messages"
island: "[name]'s island"
name: "Enter/Exit messages"
now-entering: "Now entering [name]"
now-leaving: "Now leaving [name]"
FIRE:
description: "Allow fire to exist or not"
name: "Fire"
hint: "No fire allowed"
FIRE_EXTINGUISH:
description: "Toggle extinguishing"
name: "Fire extinguish"
hint: "No fire extinguishing allowed"
FIRE_SPREAD:
description: "Toggle spread"
name: "Fire spread"
hint: "No fire spread allowed"
FURNACE:
description: "Toggle use"
name: "Furnace"
hint: "No furnace use"
GATE:
description: "Toggle use"
name: "Gates"
hint: "No gate use"
GEO_LIMIT_MOBS:
description: |
&eRemove mobs that go
&eoutside protected
&eisland space
name: "Limit mobs to island"
HURT_ANIMALS:
description: "Toggle hurting"
name: "Hurt animals"
hint: "No animal hurting allowed"
HURT_MONSTERS:
description: "Toggle hurting"
name: "Hurt monsters"
hint: "No monster hurting"
HURT_VILLAGERS:
description: "Toggle hurting"
name: "Hurt villagers"
hint: "No villager hurting"
ITEM_FRAME_DAMAGE:
description: |-
&aMobs can damage
&aitem frames
name: "Item Frame Damage"
INVINCIBLE_VISITORS:
description: |-
&aConfigure invincible visitor
&asettings.
name: "Invincible Visitors"
hint: "&cVisitors protected"
ISLAND_RESPAWN:
description: |-
&aPlayers respawn
&aon island
name: "Island respawn"
ITEM_DROP:
description: "Toggle dropping"
name: "Item drop"
hint: "Items cannot be dropped"
ITEM_PICKUP:
description: "Toggle pickup"
name: "Item pickup"
hint: "Items cannot be picked up"
JUKEBOX:
description: "Toggle usage"
name: "Jukebox use"
hint: "No jukebox use allowed"
LEASH:
description: "Toggle use"
name: "Leash use"
LEVER:
description: "Toggle use"
name: "Lever use"
hint: "No lever use"
LOCK:
description: "Toggle lock"
name: "Lock island"
MILKING:
description: "Toggle cow milking"
name: "Milking"
hint: "No milking allowed"
MONSTER_SPAWN:
description: "Toggle spawning"
name: "Monster spawning"
MOUNT_INVENTORY:
description: |-
&aToggle access
&ato mount inventory
name: "Mount inventory"
hint: "No access to mount inventory"
NOTE_BLOCK:
description: "Toggle use"
name: "Note block"
hint: "No note block use"
OFFLINE_REDSTONE:
description: |-
&aWhen disabled, redstone
&awill not operate on islands
&awhere all members are offline.
&aMay help reduce lag.
name: "Offline Redstone"
PISTON_PUSH:
description: |-
&aAllow pistons to push
&ablocks outside island
name: "Piston Push"
PLACE_BLOCKS:
description: "Toggle placing"
name: "Place blocks"
hint: "Not allowed to place blocks"
PORTAL:
description: "Toggle use"
name: "Portal"
hint: "Portal use is disallowed"
PRESSURE_PLATE:
description: "Toggle usage"
name: "Pressure Plates"
hint: "No pressure plate use"
PVP_END:
description: |-
&cEnable/Disable PVP
&cin the End.
name: "End PVP"
hint: "No PVP allowed in the End"
PVP_NETHER:
description: |-
&cEnable/Disable PVP
&cin the Nether.
name: "Nether PVP"
hint: "No PVP allowed in the Nether"
PVP_OVERWORLD:
description: |-
&cEnable/Disable PVP
&con island.
name: "Overworld PVP"
hint: "&cPVP is not allowed"
REDSTONE:
description: "Toggle use"
name: "Redstone items"
hint: "No redstone item use"
RIDING:
description: "Toggle riding"
name: "Animal riding"
hint: "No animal riding allowed"
REMOVE_MOBS:
description: |-
&aRemove monsters when
&ateleporting to island
name: "Remove monsters"
SHEARING:
description: "Toggle sheering"
name: "Shearing"
hint: "No shearing"
SPAWN_EGGS:
description: "Toggle use"
name: "Spawn eggs"
hint: "No throwing spawn eggs"
TNT:
description: "Toggle TNT damage"
name: "TNT damage"
TRADING:
description: "Toggle trading"
name: "Village trading"
hint: "No villager trading"
TRAPDOOR:
description: "Toggle access"
name: "Trap doors"
hint: "No trapdoor use"
locked: "&cThis island is locked!"
protected: "&cIsland protected: [description]"
panel:
PROTECTION:
title: "Protection"
description: |-
Protection settings
for this location
SETTING:
title: "Settings"
description: "General settings"
WORLD_SETTING:
title: "[world_name] Settings"
description: "Settings for this game world"
flag-item:
name-layout: "&a[name]"
description-layout: |
&a[description]
&7Allowed for:
allowed_rank: "&3- &a"
blocked_rank: "&3- &c"
minimal_rank: "&3- &2"
menu-layout: "&a[description]"
setting-layout: |
&a[description]
&7Current setting: [setting]
setting-active: "&aActive"
setting-disabled: "&cDisabled"
language:
panel-title: "Select your language"
selected: "&aCurrently selected."
edited: "&aEdited your language to &e[lang]&a."

271
locales/fr-FR.yml Normal file
View File

@ -0,0 +1,271 @@
###########################################################################################
# Ceci est fichier YAML. Soyez prudents lorsque vous l'éditez et vérifiez la syntaxe en #
# utilisant un parser YAML, tel que http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# MrSheepSheep: translater
# Poslovitch: maintainer
#
# Cette traduction est adaptée pour la version : [alpha-2]
banner: "BANNER:1:WHITE:STRIPE_BOTTOM:RED:STRIPE_TOP:BLUE"
general:
deaths: "morts"
unlimited: "Illimité"
success: "&aAction effectuée!"
errors:
command-cancelled: "&cCommande annulée."
no-permission: "&cVous n'avez pas la permission d'utiliser cette commande."
use-in-game: "&cCette commande doit être exécutée en jeu."
no-team: "&cVous n'avez pas d'équipe!"
no-island: "&cVous n'avez pas d'île!"
player-has-no-island: "&cCe joueur n'a pas d'île!"
already-have-island: "&cVous possédez déjà une île!"
no-safe-location: "&cAucune position sécurisée n'a été trouvée sur cette île!"
not-leader: "&cVous n'êtes oas le leader de votre île!"
not-in-team: "&cCe joueur n'est pas dans votre équipe!"
offline-player: "&cCe joueur est déconnecté ou n'existe pas."
unknown-player: "&cCe joueur est inconnu."
general: "&cImpossible d'exécuter la commande. Contactez un administrateur."
warp-not-safe: "&cCe Warp n'est pas sécurisé."
wrong-world: "&cVous n'êtes pas de le bon monde pour effectuer cette action."
tips:
changing-ob-to-lava: "Transformation de l'obsidienne en lave. Faites attention!"
commands:
help:
header: "&7=========== &c%bsb_plugin_name% &7==========="
syntax: "&b[usage] &a[parameters]&7: &e[description]"
end: "&7================================="
parameters: "[command]"
description: "help command"
admin:
help:
description: "admin command"
version:
description: "display %bsb_plugin_name% and addons versions"
setrange:
parameters: "[player] [range]"
description: "set the range of player's island"
range-updated: "Island range updated to [number]"
reload:
description: "reload the plugin"
tp:
parameters: "[player]"
description: "teleport to a player's island"
manual: "&cNo safe warp found! Manually tp near to &b[location] &cand check it out"
island:
about:
description: "display info about %bsb_plugin_name%"
go:
parameters: "<home number>"
description: "teleport you to your island"
teleport: "&aTeleporting you to your island. &b/[label] help &afor help."
teleported: "&aTeleported you to home &e#[number]."
help:
description: "The main island command"
spawn:
description: "teleport you to the spawn"
create:
description: "create an island"
unable-create-island: "Your island could not be generated, please contact an administrator."
creating-island: "Creating your island..."
info:
description: "display info about your island"
reset:
description: "restart your island and remove the old one"
must-remove-members: "You must remove all members from your island before you can restart it (/island kick <player>)."
sethome:
description: "set your teleport point for /island"
must-be-on-your-island: "You must be on your island to set home!"
num-homes: "Homes can be 1 to [max]."
home-set: "Your island home has been set to your current location."
parameters: "<home number>"
setname:
description: "set a name for your island"
name-too-short: "&cToo short. Minimum size is [length] characters."
name-too-long: "&cToo long. Maximum size is [length] characters."
parameters: "<name>"
resetname:
description: "reset your island name"
team:
description: "manage your team"
info:
description: "display detailed info about your team"
invite:
description: "invite a player to join your island"
invitation-sent: "Invitation sent to [name]"
removing-invite: "Removing invite"
name-has-invited-you: "[name] has invited you to join their island."
to-accept-or-reject: "Do /island team accept to accept, or /island team reject to reject"
you-will-lose-your-island: "&cWARNING! You will lose your island if you accept!"
errors:
cannot-invite-self: "&cYou cannot invite yourself!"
cooldown: "&cYou cannot invite that person for another [time] seconds"
island-is-full: "&cYour island is full, you can't invite anyone else."
none-invited-you: "&cNo one invited you :c."
you-already-are-in-team: "&cYou are already on a team!"
already-on-team: "&cThat player is already on a team!"
invalid-invite: "&cThat invite is no longer valid, sorry."
parameters: "<player>"
you-can-invite: "You can invite [number] more players."
accept:
description: "accept an invitation"
you-joined-island: "&aYou joined an island! Use /[label] team info to see the other members."
name-joined-your-island: "&a[name] joined your island!"
reject:
description: "reject an invitation"
you-rejected-invite: "&aYou rejected the invitation to join an island."
name-rejected-your-invite: "&c[name] rejected your island invite!"
cancel:
description: "cancel the pending invite to join your island"
leave:
description: "leave your island"
type-again: "&cEnter the leave command again to confirm"
left-your-island: "&c[player] left your island"
kick:
description: "remove a member from your island"
parameters: "<player>"
type-again: "&cEnter the kick command again to confirm"
leader-kicked: "&cThe leader kicked you from the island!"
demote:
description: "demote a player on your island down a rank"
parameters: "<player>"
failure: "&cPlayer cannot be demoted any further!"
success: "Demoted [name] to [rank]"
promote:
description: "promote a player on your island up a rank"
parameters: "<player>"
failure: "&cPlayer cannot be promoted any further!"
success: "Promoted [name] to [rank]"
setowner:
description: "transfer your island ownership to a member"
errors:
cant-transfer-to-yourself: "&cYou can't transfer ownership to yourself! Well, infact, you could... But we don't want you to. 'Cause it's bad."
target-is-not-member: "&cThat player is not part of your island team!"
name-is-the-owner: "&a[name] is now the island owner!"
parameters: "<player>"
you-are-the-owner: "&aYou are now the island owner!"
ban:
description: "ban a player from your island"
parameters: "<player>"
unban:
description: "unban a player from your island"
parameters: "<player>"
banlist:
description: "list banned players"
lock:
description: "lock/unlock your island so visitors cannot enter it"
settings:
description: "display island settings"
language:
description: "select language"
ranks:
owner: "Owner"
member: "Member"
coop: "Coop"
visitor: "Visitor"
banned: "Banned"
protection:
protected: "&cIsland protected!"
flags:
ANVIL:
name: "Anvils"
description: "Toggle interaction with anvils"
ARMOR_STAND:
name: "Armor stands"
description: "Toggle interaction with armor stands"
BEACON:
name: "Beacons"
description: "Toggle interaction with beacons"
BED:
name: "Beds"
description: "Toggle interaction with beds"
BREAK_BLOCKS:
name: "Break blocks"
description: "Toggle block breaking"
BREEDING:
name: "Breed animals"
description: "Toggle animal breeding"
BREWING:
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)
CHORUS_FRUIT:
name: "Chorus fruits"
description: "Toggle teleportation using Chorus fruits"
CRAFTING: "Use crafting table"
CROP_TRAMPLE: "Trample crops"
DOOR: "Use doors"
ELYTRA: "Use elytras"
ENCHANTING: "Use enchanting table"
ENTER_EXIT_MESSAGES: "Display entry and exit messages"
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"
LEASH: "LEASH"
MILKING: "MILKING"
MOB_SPAWN: "MOB_SPAWN"
MONSTER_SPAWN: "MONSTER_SPAWN"
MOUNT_INVENTORY: "MOUNT_INVENTORY"
RIDING: "RIDING"
MUSIC: "MUSIC"
CHEST: "CHEST"
PLACE_BLOCKS: "PLACE_BLOCKS"
PORTAL: "PORTAL"
PRESSURE_PLATE: "PRESSURE_PLATE"
PVP_OVERWORLD: "PVP_OVERWORLD"
PVP_NETHER: "PVP_NETHER"
PVP_END: "PVP_END"
REDSTONE: "REDSTONE"
SPAWN_EGGS: "SPAWN_EGGS"
SHEARING: "SHEARING"
EGGS: "EGGS"
TRADING: "TRADING"
panel:
title: "Island flags"
flag-item:
name-layout: "&a[name]"
description-layout: |+
&a[description]
&7Allowed for: &f[rank]
help-item:
name: "&aNeed some help?"
island:
locked: "&cCette île est verrouillée!"
language:
panel-title: "Choisissez votre langue"
selected: "&aActuellement sélectionné."
edited: "&aLangue modifiée en &e[lang]&a."
new-island:
sign:
line0: "&1%bsb_plugin_name%"
line1: "[player]"
line2: "Ne tombez pas!"
line3: "Bon jeu! &c<3"

551
locales/pl-PL.yml Normal file
View File

@ -0,0 +1,551 @@
###########################################################################################
# This is a YML file. Be careful when editing. Check your edits in a YAML checker like #
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# RikoDEV: maintainer
#
# This translation is adapted to version : [alpha-2]
banner: "BANNER:1:WHITE:HALF_VERTICAL:RED"
general:
success: "&aSukces!"
request-cancelled: "&cUpłynął limit czasu na potwierdzenie - &bżądanie anulowane"
previous-request-cancelled: "&6Poprzednie żądanie potwierdzenia zostało anulowane"
confirm: "&cWpisz ponownie polecenie w ciągu &b[seconds]s&c aby potwierdzić."
errors:
command-cancelled: "&cKomenda anulowana"
no-permission: "&cNie masz uprawnień do wykonywania tego polecenia."
use-in-game: "&cTo polecenie jest dostępne tylko w grze."
no-team: "&cNie masz drużyny!"
no-island: "&cNie masz wyspy!"
player-has-island: "&cGracz ma już wyspę!"
player-has-no-island: "&cTen gracz nie ma wyspy!"
already-have-island: "&cMasz już wyspę!"
no-safe-location: "&cNa wyspie nie znaleziono bezpiecznej lokalizacji!"
not-leader: "&cNie jesteś liderem swojej wyspy!"
not-in-team: "&cTen gracz nie jest w twojej drużynie."
offline-player: "&cTen gracz jest offline lub nie istnieje."
unknown-player: "&cNieznany gracz!"
unknown-player-name: "&c[name] jest nieznanym graczem!"
general: "&cTo polecenie nie jest jeszcze gotowe - skontaktuj się z administratorem"
unknown-command: "&cNieznane polecenie. Wpisz &b/[label] help &caby wyświetlić pomoc."
warp-not-safe: "&cTen warp nie jest teraz bezpieczny!"
wrong-world: "&cNie jesteś we właściwym świecie, aby to zrobić!"
you-must-wait: "&cMusisz poczekać [number]s, zanim będziesz mógł wykonać to polecenie ponownie."
you-need: "&cPotrzebujesz [permission]"
tips:
changing-obsidian-to-lava: "Zmiana obsydianu z powrotem w lawę. Bądź ostrożny!"
commands:
# Parameters in <> are required, parameters in [] are optional
help:
header: "&7=========== &cpomoc [label] &7==========="
syntax: "&b[usage] &a[parameters]&7: &e[description]"
end: "&7================================="
parameters: "[command]"
description: "komenda help"
admin:
help:
parameters: ""
description: "komenda admin"
team:
add:
parameters: "<lider> <gracz>"
description: "dodaj gracza do drużyny lidera"
name-not-leader: "&c[name] nie jest liderem"
name-has-island: "&c[name] ma wyspę. Najpierw musi ją wyrejestrować lub usunąć."
disband:
parameters: "<lider drużyny>"
description: "rozwiąż drużynę lidera wyspy"
user-disband-leader: "&cNie jesteś liderem! Użyj disband [leader]"
disbanded: "&cAdministrator rozwiązał Twoją drużyne!"
kick:
parameters: "<gracz z drużyny>"
description: "wyrzuć gracza z drużyny"
cannot-kick-leader: "&cNie możesz wyrzucić lidera drużyny. Najpierw wyrzuć członków."
admin-kicked: "&cAdministrator wyrzucił Cię z drużyny."
makeleader:
parameters: "<gracz>"
description: "uczyń gracza liderem wyspy"
already-leader: "&cGracz jest już liderem!"
register:
parameters: "<gracz>"
description: "zarejestruj gracza na niezamieszkanej wyspie, na której jesteś"
registered-island: "&aZarejestrowano gracza na wyspie na [xyz]."
already-owned: "&cWyspa jest już własnością innego gracza!"
no-island-here: "&cTu nie ma wyspy. Potwierdź, aby ją utworzyć."
unregister:
parameters: "<właściciel>"
description: "wyrejestruj właściciela z wyspy, ale zachowaj bloki wyspy"
unregistered-island: "&aWyrejestrowano gracza z wyspy [xyz]."
info:
parameters: "<gracz>"
description: "zdobądź informacje o tym, gdzie jesteś lub wyspie gracza"
no-island: "&cNie jesteś teraz na wyspie..."
title: "======= Informacje o wyspie ========="
owner: "Lider: [owner] ([uuid])"
last-login: "Ostatnie logowanie: [date]"
deaths: "Śmierci: [number]"
resets-left: "Pozostałe resety: [number]/[total]"
team-members-title: "Członkowie drużyny:"
team-owner-format: "&a[name] [rank]"
team-member-format: "&b[name] [rank]"
island-location: "Lokalizacja wyspy: [xyz]"
island-coords: "Współrzędne wyspy: [xz1] to [xz2]"
protection-range: "Rozmiar ochrony: [range]"
protection-coords: "Współrzędne ochrony: [xz1] to [xz2]"
is-spawn: "Wyspa jest wyspą odradzania"
banned-players: "Zablokowani gracze:"
banned-format: "&c[name]"
unowned: "&cNiezamieszkana"
version:
description: "wyświetl %bsb_plugin_name% i wersje dodatków"
setrange:
parameters: "<gracz> <zasięg>"
description: "ustaw zasięg wyspy gracza"
range-updated: "Zaktualizowano zasięg wyspy do [number]"
reload:
description: "ponownie załaduj plugin"
tp:
parameters: "<gracz>"
description: "teleportuj się na wyspę gracza"
manual: "&cNie znaleziono bezpiecznego warpu. Teleportuj się ręcznie do lokalizacji &b[location] &ci sprawdź go."
getrank:
parameters: "<gracz>"
description: "zdobądź role gracza na jego wyspie"
rank-is: "&aRola [rank] na jego wyspie."
setrank:
parameters: "<gracz> <rola>"
description: "ustawia role gracza na swojej wyspie"
unknown-rank: "&cNieznana rola!"
rank-set: "&aRola ustawiona z [from] na [to]."
schem:
parameters: "<load><copy><paste><pos1><pos2><save>"
description: "manipuluj schematem"
copy-first: "&cNajpierw skopiuj schemat!"
file-exists: "&cPlik już istnieje, nadpisać?"
no-such-file: "&cNie ma takiego pliku!"
could-not-load: "&cNie można załadować tego pliku!"
could-not-save: "&cHmm, something went wrong saving that file: [message]"
set-pos1: "&aPozycja 1 ustawiona na [vector]"
set-pos2: "&aPozycja 2 ustawiona na [vector]"
set-different-pos: "&cUstaw inną lokalizację - ta pozycja jest już ustawiona!"
need-pos1-pos2: "&cNajpierw ustaw pozycje 1, potem pozycje 2!"
copied-blocks: "&bSkopiowano [number] bloków do schowka."
look-at-a-block: "&cSpójrz na blok w ciągu 20 bloków, aby ustawić"
world:
description: "Zarządzaj ustawieniami świata"
island:
about:
description: "wyświetl informacje o prawach autorskich i licencji"
go:
parameters: "[home number]"
description: "teleportuj się na wyspe"
teleport: "&aTeleportacja na Twoją wyspe..."
teleported: "&aTeleportowano do domu &e#[number]."
tip: "&bWpisz /[label] help&a, aby otrzymać pomoc."
help:
description: "Główne komendy wyspy"
pick-world: "&cWybierz świat z dostępnych: [worlds]"
spawn:
description: "teleportacja na spawn"
create:
description: "stwórz wyspe"
unable-create-island: "Twoja wyspa nie mogła zostać wygenerowana, skontaktuj się z administratorem."
creating-island: "Tworzenie Twojej wyspy..."
pick-world: "&cWybierz świat z [worlds]"
info:
description: "wyświetl informacje o swojej wyspie"
reset:
description: "zresetuj swoją wyspę i usuń starą"
must-remove-members: "Musisz usunąć wszystkich członków ze swojej wyspy, zanim będzie można ją zresetować (/island kick <player>)."
none-left: "&cNie pozostało więcej resetów wyspy!"
resets-left: "&cPozostało Ci [number] resetów wyspy."
sethome:
description: "ustaw swój punkt teleportacji dla komendy /island"
must-be-on-your-island: "Musisz być na swojej wyspie, aby ustawić dom!"
num-homes: "Domy mogą być od 1 do [number]."
home-set: "Twój dom na wyspie został ustawiony w bieżącej lokalizacji."
parameters: "[home number]"
setname:
description: "ustaw nazwę swojej wyspy"
name-too-short: "&cZbyt krótki. Minimalna długość to [number] znaków."
name-too-long: "&cZbyt krótki. Minimalna długość to [number] znaków."
parameters: "<nazwa>"
resetname:
description: "zresetuj swoją nazwę wyspy"
team:
description: "zarządzaj swoją drużynom"
info:
description: "wyświetl szczegółowe informacje o swojej drużynie"
invite:
description: "zaproś gracza, by dołączył do Twojej wyspy"
invitation-sent: "Zaproszenie wysłane do [name]"
removing-invite: "Usuwanie zaproszenia"
name-has-invited-you: "[name] zaprosił cię do przyłączenia się do jego wyspy."
to-accept-or-reject: "Wpisz /island team accept, aby zaakceptować zaproszenie lub /island team reject aby odmówić."
you-will-lose-your-island: "&cUWAGA! Jeśli zaakceptujesz zaproszenie, stracisz swoją wyspę!"
errors:
cannot-invite-self: "&cNie możesz zaprosić samego siebie!"
cooldown: "&cNie możesz zaprosić tej osoby przez [number] sekund."
island-is-full: "&cTwoja wyspa jest pełna, nie możesz zaprosić nikogo innego."
none-invited-you: "&cNikt Cię nie zaprosił :(."
you-already-are-in-team: "&cJesteś już w drużynie."
already-on-team: "&cTen gracz jest już w drużynie."
invalid-invite: "&cTo zaproszenie nie jest już ważne, przepraszam."
parameters: "<gracz>"
you-can-invite: "Możesz zaprosić jeszcze [number] graczy."
accept:
description: "akceptuj zaproszenie"
you-joined-island: "&aDołączyłeś do wyspy! Wpisz /[label] team info, aby zobaczyć liste innych graczy na wyspie."
name-joined-your-island: "&a[name] dołączył do Twojej wyspy!"
reject:
description: "odrzuć zaproszenie"
you-rejected-invite: "&aOdrzuciłeś zaproszenie do dołączenia do wyspy."
name-rejected-your-invite: "&c[name] odrzucił zaproszenie do wyspy."
cancel:
description: "anuluj oczekujące zaproszenie do dołączenia do Twojej wyspy"
leave:
cannot-leave: "&cLider drużyny nie może opuścić wyspy. Zostań jej członkiem, lub wyrzuć wszystkich graczy z wyspy."
description: "opuść swoją wyspę"
left-your-island: "&c[name] opuścił Twoją wyspę."
kick:
description: "wyrzuć gracza z swojej wyspy"
parameters: "<gracz>"
leader-kicked: "&cLider wyrzucił Cię z jego wyspy."
cannot-kick: "&cNie możesz wyrzucić samego siebie."
demote:
description: "degraduj gracza na swojej wyspie do roli"
parameters: "<gracz>"
failure: "&cGracza nie można zdegradować niżej."
success: "Zdegradowano [name] do roli [rank]"
promote:
description: "awansuj gracza na swojej wyspie do roli"
parameters: "<gracz>"
failure: "&cGracza nie można awansować wyżej!"
success: "Awansowano [name] do roli [rank]"
setowner:
description: "przenieś własność wyspy na innego członka"
errors:
cant-transfer-to-yourself: "&cNie możesz przenieść własności na siebie! Cóż, w rzeczywistości, możesz... Ale nie chcemy możemy na to pozwolić. Bo to jest złe."
target-is-not-member: "&cTen gracz nie jest częścią Twojej drużyny!"
name-is-the-owner: "&a[name] jest teraz liderem wyspy!"
parameters: "<gracz>"
you-are-the-owner: "&aJesteś teraz liderem wyspy!"
ban:
description: "zbanuj gracza na swojej wyspie"
parameters: "<gracz>"
cannot-ban-yourself: "&cNie możesz się zbanować!"
cannot-ban: "&cTego gracza nie można zbanować."
cannot-ban-member: "&cNajpierw wyrzuć członka drużyny, a następnie zablokuj."
player-already-banned: "&cGracz jest już zbanowany."
owner-banned-you: "&b[name]&c zbanował Cię na swojej wyspy!"
you-are-banned: "&bJesteś zablokowany na tej wyspie."
unban:
description: "odblokuj gracza na swojej wyspie"
parameters: "<gracz>"
cannot-unban-yourself: "&cNie możesz się odblokować!"
player-not-banned: "&cGracz nie jest zbanowany na wyspie."
you-are-unbanned: "&b[name]&a odblokował Cię na swojej wyspie."
banlist:
description: "lista zablokowanych graczy"
noone: "&aNikt nie jest zbanowany na tej wyspie."
the-following: "&bNastępujący gracze są zbanowani:"
names: "&c[line]"
settings:
description: "wyświetl ustawienia wyspy"
language:
description: "wybierz język"
ranks:
owner: "Lider"
member: "Członek"
coop: "Partner"
visitor: "Visitor"
banned: "Zbanowany"
admin: "Admin"
mod: "Mod"
protection:
flags:
ANIMAL_SPAWN:
description: "Przełącz spawnowanie"
name: "Spawnowanie zwierząt."
ANVIL:
description: "Przełącz użycie"
name: Kowadła
hint: "Używanie kowadeł wyłączone."
ARMOR_STAND:
description: "Przełącz użycie"
name: "Stojaki na zbroje"
hint: "Używanie stojaków na zbroje wyłączone."
BEACON:
description: "Przełącz interakcje"
name: "Magiczne latarnie"
hint: "Używanie magicznych latarni wyłączone."
BED:
description: "Przełącz interakcje"
name: "Łóżka"
hint: "Używanie łóżka wyłączone."
BREAK_BLOCKS:
description: "Przełącz interakcje"
name: "Niszczenie bloków"
hint: "Niszczenie bloków wyłączone."
BREEDING:
description: "Przełącz interakcje"
name: "Rozmnażanie zwierząt"
hint: "Rozmnażanie zwierząt wyłączone."
BREWING:
description: "Przełącz interakcje"
name: "Statywy alchemiczne"
hint: "Używanie statywów alchemicznych wyłączone."
BUCKET:
description: "Przełącz interakcje"
name: Wiaderka
hint: "Używanie wiaderek wyłączone."
CHEST:
description: "Przełącz otwieranie skrzyń"
name: Skrzynki
hint: "Otwieranie skrzyń wyłączone."
CHORUS_FRUIT:
description: "Przełącz teleportacje"
name: "Owoce refrenusu"
hint: "Używanie teleportacji wyłączone."
COLLECT_LAVA:
description: |
Przełącz zbieranie lawy
(nadpisuje wiaderka)
name: "Zbieranie lawy"
hint: "Zbieranie lawy wyłączone."
COLLECT_WATER:
description: |
Przełącz zbieranie wody
(nadpisuje wiaderka)
name: "Zbieranie wody"
hint: "Zbieranie wody wyłączone."
CRAFTING:
description: "Przełącz użycie"
name: "Stół rzemieślniczy"
hint: "Używanie stołu rzemieślniczego wyłączone."
CROP_TRAMPLE:
description: "Przełącz deptanie roślin"
name: "Deptanie roślin"
hint: "Rośliny są chronione przed deptaniem."
DOOR:
description: "Przełącz używanie drzwi"
name: "Używanie drzwi"
hint: "Używanie drzwi wyłączone."
EGGS:
description: "Przełącz rzucanie jajkami"
name: "Rzucanie jajkami"
hint: "Rzucanie jajkami wyłączone."
ELYTRA:
description: "Przełącz użycie"
name: "Elytry"
hint: "Latanie na elytrze wyłączone."
ENCHANTING:
description: "Przełącz użycie"
name: "Stół do zaklęć"
hint: "Używanie stołu do zaklęć wyłączone."
ENDER_CHEST:
description: "Przełącz użycie/tworzenie"
name: "Skrzynia kresu"
hint: "Skrzynie kresu są wyłączone w tym świecie."
ENDER_PEARL:
description: "Przełącz użycie"
name: "Perła kresu"
hint: "Używanie pereł kresu wyłączone."
ENTER_EXIT_MESSAGES:
description: "Wyświetlaj komunikaty wejścia i wyjścia"
island: "Wyspa [name]"
name: "Wiadomości wejścia / wyjścia"
now-entering: "Wchodzisz na wyspe gracza [name]"
now-leaving: "Wychodzisz z wyspy gracza [name]"
FIRE:
description: "Pozwól, by ogień istniał lub nie"
name: "Ogień"
hint: "Ogień jest niedozwolony."
FIRE_EXTINGUISH:
description: "Przełącz gaszenie ognia"
name: "Gaszenie ognia"
hint: "Gaszenie ognia jest wyłączone."
FIRE_SPREAD:
description: "Przełącz rozprzestrzenianie"
name: "Rozprzestrzenianie ognia"
hint: "Ogień nie rozprzestrzenia się."
FURNACE:
description: "Przełącz użycie"
name: "Piec"
hint: "Używanie piecy jest wyłączone."
GATE:
description: "Przełącz użycie"
name: "Furtki"
hint: "Używanie furtek jest wyłączone."
HURT_ANIMALS:
description: "Przełącz zabijanie zwierząt"
name: "Zabijanie zwierząt"
hint: "Zabijanie zwierząt jest wyłączone."
HURT_MONSTERS:
description: "Przełącz zabijanie potworów"
name: "Zabijanie potworów"
hint: "Zabijanie potworów jest wyłączone."
HURT_VILLAGERS:
description: "Przełącz zabijanie osadników"
name: "Zabijanie osadników"
hint: "Zabijanie osadników jest wyłączone."
INVINCIBLE_VISITORS:
description: |
&aUstawienia nieśmiertelnych
&agości na wyspie.
name: "Nieśmiertelni goście"
hint: "&cGoście są chronieni przez obrażeniami."
ISLAND_RESPAWN:
description: |
&aOdradzanie graczy
&apo śmierci na wyspie.
name: "Odradzanie na wyspie"
ITEM_DROP:
description: "Przełącz wyrzucanie przedmiotów"
name: "Wyrzucanie przedmiotów"
hint: "Przedmioty nie mogą być wyrzucone."
ITEM_PICKUP:
description: "Przełącz podnoszenie przedmiotów"
name: "Podnoszenie przedmiotów"
hint: "Przedmioty nie mogą być podnoszone."
LEASH:
description: "Przełącz użycie"
name: "Używanie smyczy"
LEVER_BUTTON:
description: "Przełącz użycie"
name: "Wykorzystanie dźwigni lub przycisku"
hint: "Używanie smyczy wyłączone."
LOCK:
description: "Przełącz dostęp do wyspy"
name: "Blokada wyspy"
MILKING:
description: "Przełącz dojenie krów"
name: "Dojenie"
hint: "Dojenie krów jest wyłączone."
MONSTER_SPAWN:
description: "Przełącz spawnowanie"
name: "Sprawnowanie potworów"
MOUNT_INVENTORY:
description: |
&aPrzełącz dostęp
&ado ekwipunku mobów.
name: "Ekwipunek zwierząt"
hint: "Używanie ekwipunku zwierząt wyłączone."
MUSIC:
description: "Przełącz użycie"
name: "Muzyka"
hint: "Używanie szafy grającej wyłączone."
PISTON_PUSH:
description: |
&aPozwól tłokom przepychać
&abloki poza teren wyspy.
name: "Przepychanie pistonem"
PLACE_BLOCKS:
description: "Przełącz interakcje"
name: "Stawianie bloków"
hint: "Stawianie bloków wyłączone."
PORTAL:
description: "Przełącz użycie"
name: Portal
hint: "Używanie portalu jest wyłączone."
PRESSURE_PLATE:
description: "Przełącz użycie"
name: "Płytki naciskowe"
hint: "Używanie płytek naciskowych wyłączone."
PVP_END:
description: |
&cWłącz / wyłącz pvp
&cw świecie kresu.
name: "PVP w kresie"
hint: "&cPVP jest wyłączone w świecie kresu."
PVP_NETHER:
description: |
&cWłącz / wyłącz pvp
&cw piekle.
name: "PVP w piekle"
hint: "&cPVP jest wyłączone w piekle."
PVP_OVERWORLD:
description: |
&cWłącz / wyłącz pvp
&cna wyspie.
name: "PVP na wyspie"
hint: "&cPVP jest wyłączone na wyspie."
REDSTONE:
description: "Przełącz dostęp"
name: "Przedmioty redstone"
hint: "Używanie przedmiotów redstone wyłączone"
RIDING:
description: "Przełącz ujeżdzanie zwierząt"
name: "Ujeżdzanie zwierząt"
hint: "Ujeżdzanie zwierząt jest wyłączone."
REMOVE_MOBS:
description: |
&aUsuwanie potworów
&apodczas teleportacji na wyspe.
name: "Usuwanie potworów"
SHEARING:
description: "Przełącz strzyżenie owiec"
name: "Strzyżenie owiec"
hint: "Strzyżenie owiec wyłączone."
SPAWN_EGGS:
description: "Przełącz spawnowanie"
name: "Jajka spawnujące"
hint: "Używanie jajek spawnujących wyłączone."
TRADING:
description: "Przełącz handlowanie"
name: "Handlowanie z osadnikami"
hint: "Handlowanie z osadnikami wyłączone."
TRAPDOOR:
description: "Przełącz użycie"
name: "Klapy"
hint: "Używanie klap wyłączone."
locked: "&cTa wyspa jest zamknięta!"
protected: "&cWyspa chroniona: [description]"
panel:
PROTECTION:
title: "Ochrona"
description: |
Ustawienia ochrony
dla tej lokalizacji
SETTING:
title: "Ustawienia"
description: "Ustawienia główne"
WORLD_SETTING:
title: "Ustawienia [world_name]"
description: "Ustawienia dla tego świata gry"
flag-item:
name-layout: "&a[name]"
description-layout: |+
&a[description]
&7Dozwolony dla:
allowed_rank: "&3- &a"
blocked_rank: "&3- &c"
minimal_rank: "&3- &2"
menu-layout: "&a[description]"
setting-layout: |+
&a[description]
&7Obecne ustawienie: [setting]
setting-active: "&aAktywny"
setting-disabled: "&cNieaktywny"
language:
panel-title: "Wybierz swój język"
selected: "&aObecnie wybrany."
edited: "&aZmieniono język na &e[lang]&a."
new-island:
sign:
line0: "&1%bsb_plugin_name%"
line1: "[name]"
line2: "Nie spadnij!"
line3: "Baw się dobrze! &c<3"

269
locales/vi-VN.yml Normal file
View File

@ -0,0 +1,269 @@
###########################################################################################
# Đây là 1 file YML, hãy cẩn thận khi chỉnh sửa, nên dùng trang web dể kiểm tra n #
# cái này http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# tastybento: Người cung cấp bản YML gốc
# Poslovitch: Người cung cấp bản YML gốc
#
# Banbeucmas: Người dịch bản YML gốc
# This translation is adapted to version : [alpha-2]
banner: "BANNER:1:RED:CREEPER:YELLOW:RHOMBUS_MIDDLE:YELLOW:TRIANGLES_BOTTOM:RED:SQUARE_BOTTOM_LEFT:RED:SQUARE_BOTTOM_RIGHT:RED"
general:
deaths: "Chết"
unlimited: "Vô hạn"
success: "&aThành công!"
errors:
command-cancelled: "&cĐã hủy lệnh"
no-permission: "&cBạn không có quyền thực thi lệnh này."
use-in-game: "&cLệnh này chỉ dùng được trong game."
no-team: "&cBạn không ở trong 1 đội nào cả!"
no-island: "&cBạn không có đảo!"
player-has-no-island: "&cNgười chơi đó không có đảo!"
already-have-island: "&cBạn đã có đảo!"
no-safe-location: "&cKhông có địa điểm an toàn nào trên đảo!"
not-leader: "&cBạn không phải đội trưởng!"
not-in-team: "&cNgười chơi không có trong đội!"
offline-player: "&cNgười chơi đang offline hoặc không tồn tại."
unknown-player: "&cNgười chơi không tìm thấy!"
general: "&cLệnh chưa sẵn sàng - hãy liên hệ admin"
warp-not-safe: "&cCổng dịch chuyển không an toàn!"
wrong-world: "&cBạn đang không ở trong thế giới có thể làm được việc này!"
tips:
changing-ob-to-lava: "Đang chuyển Hắc Diện Thạch về Dung Nham, hãy cẩn thận"
commands:
help:
header: "&7=========== &c%bsb_plugin_name% &7==========="
syntax: "&b[usage] &a[parameters]&7: &e[description]"
end: "&7================================="
parameters: "[command]"
description: "help command"
admin:
help:
description: "xem lệnh dành cho admin"
parameters: ""
version:
description: "Hiện phiên bản %bsb_plugin_name% và các bổ sung"
setrange:
parameters: "[player] [range]"
description: "Đặt giới hạn đảo người chơi"
range-updated: "Giới hạn đảo đã chuyển sang [number]"
reload:
description: "Nạp lại plugin"
tp:
parameters: "[player]"
description: "Dịch chuyển đến đảo người chơi"
manual: "&cKhông tìm thấy cổng dịch chuyển an toàn! Hãy tp tới địa điểm &b[location] &cvà kiểm tra"
island:
about:
description: "hiện thông tin về %bsb_plugin_name%"
go:
parameters: "<home number>"
description: "dịch chuyển tới đảo"
teleport: "&aĐang dịch chuyển. &b/[label] help &ađể được giúp đỡ."
teleported: "&aĐã dịch chuyển bạn tới khu vực nhà số &e#[number]."
help:
description: "Các lệnh chính"
spawn:
description: "dịch chuyển ra spawn"
create:
description: "tạo đảo"
unable-create-island: "Không thể khởi tạo đảo, hãy liên hệ admin."
creating-island: "Đang tạo đảo..."
info:
description: "hiện thông tin đảo của bạn"
reset:
description: "làm lại đảo của bạn"
must-remove-members: "Hãy đuổi toàn bộ thành viên trước khi khởi tạo lại đảo (/island kick <người chơi>)."
sethome:
description: "đặt bị trí dịch chuyển cho /island"
must-be-on-your-island: "Bạn phải ở trên đảo của bạn!"
num-homes: "Số nhà có thể đặt từ 1 đến [max]."
home-set: "Đã đặt vị trí nhà tại địa điểm hiện tại của bạn."
parameters: "<home number>"
setname:
description: "đặt tên đảo"
name-too-short: "&cQuá ngắn. Giới hạn thấp nhất là [length] kí tự."
name-too-long: "&cQuá dài. Giới hạn tối đa là [length] kí tự."
parameters: "<name>"
resetname:
description: "làm lại tên đảo"
team:
description: "quản lý đội"
info:
description: "hiện thông tin chi tiết về đội"
invite:
description: "mới người chơi đến đảo"
invitation-sent: "Đã gửi lời mời tới [name]"
removing-invite: "Đang bỏ lời bời"
name-has-invited-you: "[name] đã mời bạn vào đảo."
to-accept-or-reject: "Ghi /island team accept để chấp nhận, hay /island team reject để từ chối"
you-will-lose-your-island: "&cCẢNH BÁO! Bạn sẽ mất đảo nếu chấp nhận"
errors:
cannot-invite-self: "&cBạn không thể mới chính mình"
cooldown: "&cBạn không thế mời người khác trong [time] giây"
island-is-full: "&cĐảo đã đầy, không thể mời thêm"
none-invited-you: "&cKhông ai mời bạn :c."
you-already-are-in-team: "&cBạn đã ở trong 1 đội!"
already-on-team: "&cNgười chơi đó đã ở trong 1 đội!"
invalid-invite: "&cLời mời vô hiệu, xin lỗi."
parameters: "<player>"
you-can-invite: "Bạn có thể mời thêm [number] người."
accept:
description: "chấp nhận lời mời"
you-joined-island: "&aBạn đã tham gia đảo! Sử dụng /[label] team info để biết thêm thông tin."
name-joined-your-island: "&a[name] đã vào đảo của bạn!"
reject:
description: "từ chối lời mời"
you-rejected-invite: "&aBạn đã từ chối lời mời vào đảo."
name-rejected-your-invite: "&c[name] đã từ chối lời mời của bạn!"
cancel:
description: "hủy lời mời hiện tại"
leave:
description: "rời đảo"
type-again: "&cGõ lệnh rời đảo 1 lần nữa để xác nhận"
left-your-island: "&c[player] đã rời đảo"
kick:
description: "loại bỏ 1 người chơi khỏi đảo"
parameters: "<player>"
type-again: "&cHãy đánh lệnh loại bỏ 1 lần nữa để xác nhận"
leader-kicked: "&cĐội trưởng đã đuổi bạn ra khỏi đội!"
demote:
description: "hạ cấp bậc người chơi"
parameters: "<player>"
failure: "&cNgười chơi không thể hạ cấp thêm nữa"
success: "Đã hạ cấp [name] đến bậc [rank]"
promote:
description: "thăng chức người chơi"
parameters: "<player>"
failure: "&cKhông thể thăng chức nữa!"
success: "Đã thăng chức [name] lên bậc [rank]"
setowner:
description: "chuyển quyền sở hữu đảo"
errors:
cant-transfer-to-yourself: "&cBạn không thể chuyển quyền sở hữu cho chính mình"
target-is-not-member: "&cNgười chơi đó không phải là người trong đội!"
name-is-the-owner: "&a[name] giờ là chủ đảo!"
parameters: "<player>"
you-are-the-owner: "&aBạn giờ là chủ đảo!"
ban:
description: "cấm 1 người chơi khỏi đảo"
parameters: "<player>"
unban:
description: "bỏ cấm 1 người chơi khỏi đảo"
parameters: "<player>"
banlist:
description: "những người chơi bị cấm"
lock:
description: "khóa/bỏ khóa khả năng truy cập đảo của bạn"
settings:
description: "hiện cài đặt đảo"
language:
description: "chọn ngôn ngữ"
parameters: "<language>"
ranks:
owner: "Chủ"
member: "Thành Viên"
coop: "Đối tác"
visitor: "Khách"
banned: "Bị cấm"
protection:
protected: "&cĐã bảo vệ đảo!"
flags:
ANVIL:
name: "Đe"
description: "Tắt/bật tương tác với Đe"
ARMOR_STAND:
name: "Giá để giáp"
description: "Tắt/bật tương tác với giá để giáp"
BEACON:
name: "Beacons"
description: "Tắt/bật tương tác với beacons"
BED:
name: "Giường"
description: "Tắt/bật tương tác với giường"
BREAK_BLOCKS:
name: "Phá khối"
description: "Tắt/bật khả năng phá khối"
BREEDING:
name: "Giao phối"
description: "Tắt/bật khả năng giao phối của dộng vật"
BREWING:
name: "Brewing stands"
description: "Tắt/bật tương tác với brewing stands"
BUCKET:
name: "Xô"
description: "Tắt/bật tương tác với xô"
COLLECT_WATER:
name: "Lấy nước"
description: |
Tắt/bật khả năng lấy nước bằng xô
COLLECT_LAVA:
name: "Lấy dung nham"
description: |
Tắt/bật khả năng lấy nước bằng xô
CHORUS_FRUIT:
name: "Chorus fruits"
description: "Toggle teleportation using Chorus fruits"
CRAFTING: "Use crafting table"
CROP_TRAMPLE: "Trample crops"
DOOR: "Use doors"
ELYTRA: "Use elytras"
ENCHANTING: "Use enchanting table"
ENTER_EXIT_MESSAGES: "Display entry and exit messages"
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"
LEASH: "LEASH"
MILKING: "MILKING"
MOB_SPAWN: "MOB_SPAWN"
MONSTER_SPAWN: "MONSTER_SPAWN"
MOUNT_INVENTORY: "MOUNT_INVENTORY"
RIDING: "RIDING"
MUSIC: "MUSIC"
CHEST: "CHEST"
PLACE_BLOCKS: "PLACE_BLOCKS"
PORTAL: "PORTAL"
PRESSURE_PLATE: "PRESSURE_PLATE"
PVP_OVERWORLD: "PVP_OVERWORLD"
PVP_NETHER: "PVP_NETHER"
PVP_END: "PVP_END"
REDSTONE: "REDSTONE"
SPAWN_EGGS: "SPAWN_EGGS"
SHEARING: "SHEARING"
EGGS: "EGGS"
TRADING: "TRADING"
panel:
title: "Island flags"
flag-item:
name-layout: "&a[name]"
description-layout: |+
&a[description]
&7Allowed for: &f[rank]
help-item:
name: "&aNeed some help?"
island:
locked: "&cThis island is locked!"
new-island:
sign:
line0: "&1%bsb_plugin_name%"
line1: "[player]"
line2: "Đừng rơi"
line3: "Vui vẻ &c<3"

582
locales/zh-CN.yml Normal file
View File

@ -0,0 +1,582 @@
###########################################################################################
# This is a YML file. Be careful when editing. Check your edits in a YAML checker like #
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
### Credits ###
# Tastybento: maintainer
# Poslovitch: maintainer
# DuckSoft: translator
# This translation is adapted to version : [alpha-1]
banner: "BANNER:1:RED:SQUARE_TOP_RIGHT:YELLOW:CROSS:RED:CURLY_BORDER:RED:MOJANG:YELLOW:HALF_HORIZONTAL_MIRROR:RED:HALF_VERTICAL:RED"
not-setup:
header: |-
在此插件能正常运作之前, 您需要更多设置...
请编辑 config.yml, 然后重启服务器.
distance: "确保您已设定过岛屿距离. 若要升级, 请设为原值."
generator: |-
岛屿世界生成器注册失败.
可能的潜在原因:
1. 若您将岛屿世界作为服务器的唯一世界
确保您已将此世界添加到 bukkit.yml 中.
2. 您重载了服务器而并未重启. 请重启服务器重试.
generator-multiverse: " 3. 您的 Multiverse 插件已过期. 请升级到最新版本."
world-name: |-
config.yml 中的世界名与 islands.yml 中的世界名不符.
若您这样做是有目的的, 系统将假设您想完全重设岛屿世界.
若是, 请删除 islands.yml 和原世界.
若否, 请修正 config.yml 中的世界名并重启. 若您正在升级, 您很可能是这种情况.
config-outdated: |-
config.yml 似乎已过期.
请核实您的配置文件是否经过更新.
若此错误持续出现, 您很可能是编辑了旧的配置文件, 而非新的配置文件.
如果是这样, 请删除当前的 config.yml, 参照 config.new.yml 创建一个新的 config.yml.
general:
success: "成功!"
errors:
no-permission: "您无权执行此命令."
use-in-game: "本命令仅在游戏中有效."
# TODO: These are legacy strings and should be converted to a better format but will do for now
acidBottle: "受到辐射的水瓶"
acidBucket: "污染的水桶"
acidLore: |-
小心! 小心! 小心!
重要的事情说三遍!
千万不能喝!
adminDeleteIsland:
error: "使用 &ldeleteisland confirm &r&c来删除你所在的岛屿."
noid: "无法识别岛屿."
use: "或者使用 &ldelete [name] &r&c来删除一个玩家."
adminHelp:
add: "向领导者的队伍增加玩家"
addrange: "增加或减少岛屿的保护区域大小."
clearreset: "重置一个玩家的岛屿初始化次数."
clearresetall: "为所有玩家重置岛屿的初始化次数."
cobblestats: "显示magic cobble的生成统计数据."
completeChallenge: "标记一个挑战为已完成"
delete: "删除一个玩家的岛屿 (移除方块)."
help: "管理员指令:"
info: "显示指定玩家信息."
infoisland: "显示离你最近的岛屿信息."
kick: "从任何队伍中踢出玩家."
level: "为玩家提供岛屿等级详情."
listChallengeResets: "列出挑战重置时间表(若有)"
lock: "锁定或解锁玩家的岛屿."
purge: "删除超过 [TimeInDays] 天的不活跃岛屿."
purgeallowdisallow: "允许/禁止一个岛屿被删除(若它们达到删除标准)."
purgeholes: "重置空余的岛屿,以便重复使用."
purgeunowned: "移除无主岛屿."
name: "为玩家岛屿命名."
register: "设置玩家的岛屿在你的位置"
reload: "配置重读."
resetAllChallenges: "重置该玩家的的所有挑战"
resetChallenge: "标记一个挑战为未完成"
resetChallengeForAll: "重设全服务器每位玩家的挑战(可选重复)"
resetname: "重设玩家岛屿名称"
resetsign: "将你盯着看的牌子重设给岛主"
setbiome: "设置领导者岛屿的生物群系."
setdeaths: "设置玩家的死亡计数."
setrange: "改变岛屿的保护范围."
setlanguage: "设定默认语言并应用于所有玩家."
setspawn: "设置岛屿世界的重生点在你的附近."
settingsreset: "重设所有岛屿到默认保护设定"
teamChatSpy: "偷听岛屿team聊天(开启/关闭)"
topTen: "手动更新前十列表"
topbreeders: "列出目前载入的最活跃的岛屿"
tp: "传送到玩家岛屿"
tpnether: "传送到玩家的下界岛屿"
unregister: "删除一个玩家的岛屿信息,但不清除岛屿内方块"
adminInfo:
bannedPlayers: "已被封禁的玩家"
errorNullTeamLeader: "团队领导必须为空!"
errorTeamMembersExist: "玩家拥有团队成员,但不应该!"
hoppers: "岛上有 [number] 个漏斗"
islandLocation: "岛屿坐标"
isLocked: "岛屿被锁定"
isProtected: "岛屿被保护免于清除"
isSpawn: "岛屿是出生地"
isUnlocked: "岛屿被解锁"
isUnprotected: "岛屿未被保护免于清除"
lastLogin: "最后登录"
maxSize: "岛屿最大大小(距离)"
player: "玩家"
teamLeader: "队伍领袖"
teamMembers: "队伍成员"
title: "这是出生地岛屿"
unowned: "本岛暂时无主."
adminLock:
adminLockedIsland: "管理员锁定了你的岛屿"
adminUnlockedIsland: "管理员解锁了你的岛屿"
errorInGame: "必须在游戏内使用该命令!"
adminRegister:
hadIsland: "[name] 在 [location] 处拥有一个岛屿"
leadsTeam: "[name] 拥有一个队伍. 请先踢光队里的人."
noIsland: "本区域内无已知空岛!"
notSpawn: "你不能占领出生地!"
taking: "正从 [name] 玩家接管岛屿"
adminResetChallengeForAll:
error: "重复次数的格式必须是整数 [integer number][m/h/d] (minutes, hours, days), 例如. 5h"
repeating: "重复 [duration]"
reset: "重设 [date]"
adminResetSign:
errorExists: "传送牌已被激活过并属于 [name]"
found: "发现传送牌!"
noSign: "在执行此命令时你必须盯着传送牌杆看."
rescued: "已拯救传送牌并指派给 [name]"
adminReserve:
islandExists: "此地已有一岛屿! Register the player instead!"
adminSetHome:
homeSet: "已设家于 [location]"
noneFound: "未发现安全位置!"
notOnPlayersIsland: "你不在玩家岛屿上"
notSafe: "这位置不安全"
adminSetRange:
invalid: "范围无效!"
set: "设定新范围为 [number]"
tip: "范围必须在 10 到 [max] 之间"
updated: "岛屿范围更新为 [number]"
warning: "警告 - 范围比岛屿范围 [max] 更大"
warning2: "重叠的岛屿将像出生地一样(无法被拥有)!"
adminSetSpawn:
center: "岛屿中心 [location]"
coords: "保护坐标从 [min] 到 [max]"
limits: "岛屿限制从 [min] 到 [max]"
locked: "出生地被锁定!"
move: "再走远点或解除所有者的注册."
ownedBy: "本岛空间由 [name] 拥有"
range: "保护区域大小 = [number]"
set: "设定岛屿出生点到你的位置."
setting: "设定岛屿出生点到你的位置 [location]."
adminTeam:
addLeaderNoIsland: "团队领袖没有自己的岛屿所以不能拥有队员!"
addLeaderToOwn: "无法让领袖再次加入同一团队."
addedLeader: "已向团队加入领袖!"
addingPlayer: "正向团队加入玩家."
alreadyOnTeam: "玩家已经属于本队!"
kickLeader: "该玩家是一名团队领袖. 先踢光队员. 使用 '/[label] info [name]' 来查找队员."
nowUnowned: "[name] 在 [location] 的岛屿现将成为无主之岛. 你可以手动删除它了."
settingHome: "设定玩家的家到领袖的家的位置"
adminTopBreeders:
checking: "正核对 [number] 个岛屿..."
finding: "正查找名列前茅的岛屿..."
nothing: "未发现生物."
adminTopTen:
finished: "已生成前十名单列表"
generating: "生成前十名单列表"
adminTp:
manualWarp: "未发现安全地点. 在 [location] 附近手动传送."
adminUnregister:
keepBlocks: "从世界中删除一个玩家, 但在 [location] 处仍保留原有空岛. "
onTeam: "玩家隶属于一个队伍——先把他赶出去."
ban:
alreadybanned: "[name] 早就被列入了黑名单!"
banned: "你被列入 [name] 的岛屿的黑名单!"
fail: "[name] 无法被列入黑名单!"
helpBan: "将一个玩家列入岛屿黑名单."
helpUnban: "将一个玩家从岛屿黑名单中移除"
helpBanList: "列出被封禁的玩家."
lifted: "被从 [name] 的岛屿黑名单中解除!"
liftedsuccess: "被 [name] 解除黑名单!"
none: "无"
notbanned: "[name] 未被列入黑名单!"
notteammember: "你无法将岛屿成员列入黑名单!"
notyourself: "你不能那样对自己做!"
success: "[name] 被岛屿列入黑名单!"
biome:
help: "打开生物群系界面."
paneltitle: "选择一个生物群系"
set: "岛屿生物群系设置为: [biome]!"
unknown: "未知生物群系!"
youbought: "购买花费: [cost]!"
boats:
warning: "现在离开船是一件危险的事情..."
challenges:
colors: "任务将根据不同难度显示不同颜色:"
complete: "已完成"
completeNotRepeatable: "已完成(不可重复)"
completeRepeatable: "已完成(可重复)"
completedtimes: "完成次数 [donetimes] / [maxtimes]"
errorIslandLevel: "你的岛屿等级必须达到 [level] 级才能够完成这个任务!"
errorItemsNotThere: "所有任务所需物品必须在你的岛上!"
errorNotCloseEnough: "任务所需物品必须在你 [number] 格范围内."
errorNotEnoughItems: "你没有足够的所需物品"
errorNotOnIsland: "你只能够在你的岛屿上那样做!"
errorRewardProblem: "奖励你物品的时候发生了未知错误,请联系管理员!"
erroryouaremissing: "未找到你的信息"
expReward: "经验奖励"
firstTimeRewards: "首次奖励"
guititle: "ASkyBlock 挑战"
help1: "输入 /c <挑战名字> 来查询一个挑战的信息."
help2: "输入 /c complete <挑战名字> 完成一个挑战."
incomplete: "未完成"
invalidChallengeName: "未知挑战名! 输入 /c help 获取更多信息"
itemTakeWarning: "当你完成挑战的时候所有挑战所需物品将会消失!"
level: "等级"
maxreached: "最大完成 [donetimes] / [maxtimes]"
moneyReward: "经济奖励"
name: "挑战名称"
nameHasCompleted: "恭喜玩家 [name] 完成了 [challenge] 挑战!"
navigation: "点击查看 [level] 级的挑战!"
notRepeatable: "这个挑战不可重复!"
repeatRewards: "重复奖励"
rewards: 奖励
toComplete: "请至少再完成 [challengesToDo] 个等级为 [thisLevel] 的挑战来解锁当前等级挑战!"
toCompleteUse: "完成这个挑战,输入"
unknownChallenge: "未知挑战名 (请检查拼写)!"
youHaveCompleted: "你完成了 [challenge] 挑战!"
youHaveNotUnlocked: "你还没有解锁当前挑战!"
youRepeated: "你重复完成了 [challenge] 挑战!"
changingObsidiantoLava: "成功将黑曜石变为岩浆,请当心!"
checkteam:
checkingTeam: "检查 [name] 的团队"
completechallenge:
challangeCompleted: "[挑战系统]: [name] 完成了 [challengename] "
errorChallengeDoesNotExist: "挑战不存在或者已经完成"
confirm:
errorTimeLimitExpired: "超时,请重新运行指令."
coop:
cannotcoop: "只有岛屿领袖才能赋予其他玩家岛屿完全访问权限."
help: "暂时允许玩家完全访问你的岛屿"
invited: "[name] 囚禁了 [player] !"
listcoops: "列出协作的玩家"
madeyoucoopy: "[name] 把你囚禁了,直到你下线或者他们驱逐你."
notincoop: "[name] 未在你的团队中!"
onyourteam: "玩家早就在你的团队中了!"
removed: "[name] 取消了你的锁定状态!"
removesuccess: "[name] 不再是一个囚禁玩家."
success: "[name] 现在被你囚禁了,直到他们下线或者你驱逐他们."
uncoop: "移除玩家对您岛屿的完全访问"
useexpel: "输入 /expel 移除."
deaths:
deaths: "死亡次数"
died: "死了!"
leveldeaths: "&c[[number] 死]"
delete:
removing: "移除了 [name] 的岛屿."
drankAcid: "饮用辐射水源."
drankAcidAndDied: "饮用受到辐射的水而死亡."
error:
blockedbyapi: "此行为被某个使用API的插件阻止."
commandNotReady: "你现在不能使用此命令."
maxIslands: "已达到世界最大容许岛屿数! 请稍后再试!"
noIsland: "你还没有获得一个岛屿!"
noIslandOther: "玩家未拥有岛屿!"
noPermission: "你没有权限那样做!"
notABlock: "这不是一个方块"
noTeam: "玩家不再团队中."
notOnIsland: "你必须在你的岛屿上使用这个指令."
offlinePlayer: "玩家不在线或不存在."
tooLong: "太长. 最大长度为 [length]."
tooShort: "太短. 最小长度为 [length]."
unknownCommand: "未知指令."
unknownPlayer: "未知玩家."
useInGame: "这个指令必须在游戏内使用."
wrongWorld: "你无法在当前世界这样操作,请返回你的岛屿."
minishopDisabled: "迷你商店未启用."
expel:
expelled: "你被驱逐出了岛屿!"
fail: "[name] 无法被驱逐!"
notonisland: "玩家没有入侵你的岛屿!"
notyourself: "你无法驱逐你自己!"
success: "你驱逐了玩家: [name]!"
invite:
errorCantJoinIsland: "你不能加入这个岛屿, 可能岛屿已满员."
errorCoolDown: "你需要等待 [time] 分钟后才能再次邀请那个玩家"
errorThatPlayerIsAlreadyInATeam: "这个玩家已经被被其他岛屿邀请了, 或者已经拥有自己的岛屿."
errorYouCannotInviteYourself: "你不能邀请你自己入住!"
errorYouMustHaveIslandToInvite: "你必须拥有一个岛屿, 才能邀请其他玩家入住!"
errorYourIslandIsFull: "你的岛屿住满了人, 你没办法再邀请其他玩家了."
hasJoinedYourIsland: "[name] 加入了你的岛屿!"
help: "输入/[label] invite <玩家ID> 邀请玩家加入你的岛屿."
inviteSentTo: "邀请已发送给 [name]"
nameHasInvitedYou: "[name] 邀请你入住他的岛屿!"
onlyIslandOwnerCanInvite: "只有岛屿主人才能邀请其他玩家!"
removingInvite: "移除了你之前邀请的玩家."
toAcceptOrReject: "来接受或拒绝岛屿入住邀请."
warningYouWillLoseIsland: "警告: 如果你接受, 你将失去当前这个岛屿!"
youCanInvite: "你还能邀请 [number] 个玩家."
youCannotInvite: "你无法邀请更多的玩家了."
youHaveJoinedAnIsland: "你加入了一个岛屿! 使用 /[label] team 来查看其他成员."
island:
blockValue: "置于此处的 [name] 可能价值[value]"
blockWorthless: "[name] 一毛不值"
cannotTeleport: "你无法在下落过程中进行传送!"
donate: "本插件由tastybento提供"
donatecolor: "aqua"
error:
CouldNotCreateIsland: "无法为你创建岛屿. 请联系管理员."
InvalidPlayer: "玩家不存在或者他不曾拥有一个岛屿!"
LevelNotReady: "请稍等数秒后再输入此指令!"
YouDoNotHavePermission: "你没有权限那样做!"
YouAlreadyHaveAnIsland: "你已经有一个岛屿了!"
help:
AcceptReject: "接受或者拒绝别人的邀请."
Challenges: "输入指令/challenges: &7显示挑战任务"
Color: "&e"
ControlPanel: "打开岛屿帮助界面."
Expel: "强制从你的岛屿上请走一个玩家."
Invite: "邀请玩家加入你的岛屿."
Island: "开始岛屿生涯,或者回到你的岛屿."
IslandSpawn: "回到岛屿出生点."
Kick: "将玩家从你的岛屿移除."
Leave: "离开了当前岛屿."
Level: "计算你的岛屿等级"
LevelPlayer: "查询玩家的岛屿等级."
Lock: "岛屿已锁定, 非岛屿成员无法传送至岛屿上"
MakeLeader: "将岛屿赠送给玩家."
Name: "给你的岛屿起个名"
ResetName: "重置你的岛屿名称."
Restart: "重新开始你的岛屿生涯."
SelectLanguage: "语言选择(Select Language)"
SetHome: "设置返回岛屿的传送坐标(需要在自己岛屿内设置)."
Settings: "查看岛屿保护和游戏设置"
Team: "显示你团队的信息."
Teleport: "传送到你的岛屿."
Top: "查询岛屿等级排行榜."
Value: "查看手中方块的岛屿价值"
Warp: "传送到玩家的传送点."
Warps: "列出所有可用的传送点."
islandDeletedLifeboats: "岛屿已删除! 火速前往救生船!"
islandLevelis: "岛屿等级为"
new: "正在为你创建一个新的岛屿..."
requiredPointsToNextLevel: "你还需要 [points] 点数来达到 [next] 级!"
reset:
Confirm: "请在 [seconds] 秒内输入/[label] confirm 来确认你的操作,然后重新开始!"
MustRemovePlayers: "你只有将岛屿所有成员踢出才能重新开始 (/[label] kick <玩家ID>). 输入/[label] team 可以查询成员列表."
NoMore: "你无法再重新开始了!"
OnlyOwner: "只有岛屿的主人才能那样做. 请输入/[label] leave离开当前团队,然后重新你的岛屿生涯."
PleaseWait: "请稍等, 正在创建新的岛屿..."
Left: "重设剩余次数"
To: "清除重新开始限制"
Wait: "你需要等待 [time] 秒才能那样做."
YouHave: "你还有 [number] 次重新开始的机会."
subtitle: "by tastybento"
subtitlecolor: "blue"
teleport: "[岛屿娘]:欢饮回来~我的主人. (输入/[label] help 获取更多帮助)"
title: "BSkyBlock"
titlecolor: "gold"
unlimited: "无限"
url: ""
islandProtected: "岛屿保护."
islandguardsettings:
TNTdamage: "是否开启TNT爆炸伤害"
allowed: "允许"
aciddamage: "酸雨伤害"
animalspawning: "允许/禁止动物出生"
anvil: "是否允许使用铁毡"
armorstand: "是否允许使用盔甲架"
beacon: "是否允许使用信标"
bed: "是否允许使用床"
breakblocks: "是否允许破坏"
breeding: "是否允许喂养"
brewingstand: "是否允许酿造药水"
bucket: "是否允许使用桶"
collectlava: "是否允许收集岩浆"
collectwater: "是否允许收集水"
chest: "是否允许使用箱子"
chestdamage: "TNT能否破坏箱子"
chorusfruit: "是否允许使用紫颂果"
creeperdamage: "苦力怕伤害"
creepergriefing: "苦力怕破坏"
creeperpain: "苦力怕爆炸伤害"
croptrample: "是否允许践踏农作物"
disallowed: "不允许"
door: "是否允许使用门"
eggs: "是否允许扔鸡蛋"
enchantingtable: "是否允许使用附魔台"
enderpearl: "是否允许使用末影珍珠"
fire: "是否允许使用打火石"
fireextinguish: "熄灭火焰"
firespread: "火焰传播"
furnace: "是否允许使用熔炉"
gate: "是否允许使用栅栏门"
horseinventoryaccess: "是否允许参观者查看马的物品栏"
horseriding: "是否允许参观者骑马"
hurtanimals: "是否允许攻击动物"
hurtmonsters: "是否允许攻击怪物"
joinleaveislandmessages: "启用岛屿进入与离开消息"
jukebox: "是否允许使用唱片机"
leash: "是否允许使用栓绳"
lever: "是否允许使用开关按钮"
milking: "挤奶"
monsterspawning: "允许/禁止岛屿刷怪"
netherpvp: "是否允许地狱PVP"
placeblocks: "是否允许放置方块"
portaluse: "是否允许使用传送门"
pressureplate: "是否允许参观者激活压力盘"
pvp: "是否允许PVP"
redstone: "是否允许使用红石"
settingsgeneraltitle: "一般岛屿世界设定"
settingsgeneraldesc: "一般岛屿世界设定"
settingsislandtitle: "岛屿设定"
settingsislanddesc: "这些规则适用于岛屿的参观者"
settingsspawntitle: "出生地设定"
settingsspawndesc: "这些规则适用于出生地"
shears: "是否允许使用剪刀"
spawnegg: "是否允许使用刷怪蛋"
teleportwhenfalling: "下落时是否允许传送"
title: "岛屿保护设置"
villagertrading: "是否允许村民交易"
visitordrop: "是否允许访问者掉落物品"
visitorkeepitems: "访问者死亡是否保存背包"
visitorpickup: "是否允许访问者捡起物品"
withergriefing: "是否开启凋零破坏"
workbench: "是否允许使用合成台"
kick:
errorNoTeam: "你没有加入任何岛屿的团队!"
errorNotPartOfTeam: "这个玩家不是你的岛屿成员之一!"
errorOnlyLeaderCan: "只有岛屿主人才能踢人!"
errorPlayerNotInTeam: "这个玩家不在你的岛屿团队中!"
nameRemoved: "[name] 刚才已被驱逐出岛."
nameRemovedYou: "[name] 将你驱逐出了他的岛屿!"
lavaTip: "温馨提示: 如果岩浆变成了黑曜石,可以使用铁桶右键变回岩浆."
leave:
canceled: "离开已取消."
errorLeadersCannotLeave: "空岛主人无法离开岛屿.请输入 /[label] makeleader <玩家ID> 来转让岛屿."
errorYouAreTheLeader: "因为你是岛屿主人所以不能离开, 使用 /[label] makeleader <玩家> 来改变岛屿主人."
errorYouCannotLeaveIsland: "你无法离开岛屿当只剩下你一个人的时候.如果你想重新开始, 请输入 /[label] restart!"
errorYouMustBeInWorld: "你只能在岛屿世界离开你的队伍!"
nameHasLeftYourIsland: "[name] 离开了你的岛屿!"
warning: "你确定要离开队伍吗? 再次键入 '/[label] leave' 以确认."
youHaveLeftTheIsland: "你离开了岛屿, 并返回到了玩家出生地."
level:
calculating: "正在计算岛屿等级, 需要等待一段时间. 请稍候..."
errornotYourIsland: "只有岛屿成员才能使用."
islandLevel: "岛屿等级"
lock:
enteringspawn: "进入出生点"
islandlocked: "岛屿禁止游客访问"
leavingspawn: "离开出生点"
locking: "锁定岛屿"
nowentering: "您所访问的是 [name] 的岛屿"
nowleaving: "你已经离开了 [name] 的岛屿"
unlocking: "解锁岛屿"
makeleader:
errorGeneralError: "不能改变岛屿主人."
errorNotYourIsland: "这不是你的岛屿, 所以你没有权限!"
errorPlayerMustBeOnline: "玩家只有在线才能接受你的岛屿."
errorRemoveAllPlayersFirst: "将所有玩家踢出团队, 才能进行团队转让."
errorThatPlayerIsNotInTeam: "这个玩家不是你的岛屿成员之一!"
errorYouMustBeInTeam: "你必须在一个团队中才能转让岛屿."
nameIsNowTheOwner: "[name] 现在是你的岛屿主人了!"
youAreNowTheOwner: "你现在是岛屿主人了."
minishop:
buy: "购买"
buyproblem: "购买出错"
islandhelpMiniShop: "打开迷你商店"
outofstock: "物品卖完了哟"
sell: "出售"
sellproblem: "你没有足够的物品."
title: "迷你商店-左键购买右键出售"
youbought: "你购买了 [number] 个[description], 花费了 [price]"
youcannotafford: "余额不足!"
yousold: "你出售了 [number] 个 [description], 获得了 [price]"
moblimits:
entity: "岛屿实体 [entity] 的数量达到极限([number])!"
error: "岛屿繁殖数量 [number] 达到极限!"
hopper: "岛屿漏斗放置数量 [number] 达到极限!"
villager: "岛屿村民繁殖数量 [number] 达到极限!"
nether:
spawnisprotected: "当前位置为地狱保护区,请勿破坏."
news:
headline: "[岛屿快讯]: 你离线的时候发生了..."
purge:
acidFound: "已有 [number] 个无主岛屿. 使用 '/acid purge unowned confirm' 来在20s内删除它们."
allowPurge: "清除保护已移除"
alreadyRunning: "正在清理中, 请等待清理完毕!"
calculating: "计算不活跃天数超过 [time] 天的岛屿."
countingUnowned: "正在计数无主岛屿并检查玩家文件. 可能会花一点时间..."
maxPurge: "一次最大清理数为 [number] 个岛屿. 再次运行purge命令以清理更多."
finished: "清理不活跃岛屿完成."
noneFound: "没有不活跃的岛屿被移除."
nowWaiting: "请等待..."
preventPurge: "岛屿是免受清除的"
purgeCancelled: "取消清理."
removingAt: "正删除位于 [location] 的岛屿"
removingName: "清理: 移除了 [name] 的岛屿"
skyblockFound: "还有 [number] 个无主岛屿. 使用 '/asadmin purge unowned confirm' 来在20s内删除它们."
stillChecking: "仍在检查玩家文件..."
thisWillRemove: "这将会移除 [number] 个不活跃的岛屿!"
typeConfirm: "请在10秒内输入 /[label] confirm 进行确定"
usage: "使用方式: /[label] purge [TimeInDays]"
warning: "危险! 当服务器内还有玩家的时候请不要运行这个命令! 请将你的服务器进行备份!!!"
register:
errorBedrockNotFound: "基岩未找到: 无法设置岛屿!"
settingIsland: "设置 [name] 岛屿的基岩在你当前位置."
reject:
nameHasRejectedInvite: "[name] 拒绝了你的岛屿入驻邀请!"
youHaveNotBeenInvited: "你没有收到任何岛屿入住邀请."
youHaveRejectedInvitation: "你拒绝了岛屿入住邀请."
reload:
configReloaded: "配置重读."
resetallchallenges:
success: "[name] 的所有挑战已经重置."
resetchallenge:
challengeReset: "[挑战系统]: [name] 的挑战: [challengename] 已经重置"
errorChallengeDoesNotExist: "挑战不存在或尚未完成"
schematics:
title: "请选择你想要的岛屿..."
sethome:
errorNoIsland: "你不是岛屿的一员. 请返回你的岛屿!"
errorNotOnIsland: "你只能在你的岛屿范围内设置!"
errorNumHomes: "家只能设置 1-[max] 个"
homeSet: "已经设置家在你当前位置."
settingsReset:
done: "完成."
inprogress: "重设保护设置中, 请稍待..."
sign:
line1: "&1[末日岛屿]"
line2: "[player]"
line3: "不要掉下去!"
line4: "努力活下去!"
sign-acidisland:
line1: "&1[酸雨岛&7]"
line2: "[player]"
line3: "水有酸性!"
line4: "千万小心!"
targetInPVPArea: "目标处于禁止PVP区域!"
team:
listingMembers: "显示你岛屿的成员"
teamchat:
helpChat: "开启/关闭团队聊天"
noTeam: "你不在一个团队中!"
noTeamAround: "没有团队成员在线!"
prefix: "[团队聊天]<{ISLAND_PLAYER}> "
spyoff: "关闭团队聊天窃听"
spyon: "打开团队聊天窃听"
statusOff: "团队聊天已经关闭"
statusOn: "团队聊天已经开启"
topTen:
errorExcluded: "仅供参考: 你被逐出了前十名, 因为你没有 [perm]"
errorNotReady: "前十名单尚未生成!"
guiHeading: "&E&L<!> 岛屿: &6&N[name]&7 (#[rank])"
guiTitle: "前10岛屿"
header: "排名前10的岛屿:"
warps:
deactivate: "旧的传送点被替换!"
errorDoesNotExist: "传送点不存在!"
errorDuplicate: "当前位置已经存在传送点!"
errorNoPerm: "你没有权限创建岛屿传送点!"
errorNoPlace: "你只能够在你的岛屿上创建传送点!"
errorNoRemove: "你只能移除你自己的传送点!"
errorNoWarpsYet: "没有任何传送点!"
errorNotReadyYet: "传送点未准备好.请稍后再试."
errorNotSafe: "传送点不安全.请稍后再试."
errorNotEnoughLevel: "你的岛屿等级不够, 无法创建欢迎牌!"
next: "下一页"
playerWarped: "[name] &e传送到了你的岛屿!"
previous: "上一页"
removed: "传送点已经移除!"
signRemoved: "你的岛屿传送点已经移除!"
success: "空岛传送点成功创建!"
title: "岛屿传送点"
warpTip: "放置一个木牌,并且在木牌的第一行输入“[WELCOME]”以设置一个岛屿传送点."
warpToPlayersSign: "传送到玩家: <player>的岛屿传送点."
warpsAvailable: "以下的传送点可用"
welcomeLine: "[WELCOME]"

150
plugin.yml Executable file
View File

@ -0,0 +1,150 @@
name: BSkyBlock
main: us.tastybento.bskyblock.BSkyBlock
version: ${version}
authors: [tastybento, Poslovitch]
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI]
load: startup
loadbefore: [Multiverse-Core]
permissions:
bskyblock.*:
default: false
children:
bskyblock.island.*:
children:
bskyblock.island:
description: Allow island command usage
default: true
bskyblock.island.create:
description: Allow island creation
default: true
bskyblock.island.home:
description: Allow teleporting to player island
default: true
bskyblock.island.reset:
description: Player can use the island reset or restart command
default: true
bskyblock.island.sethome:
description: Let the player use the sethome command
default: true
bskyblock.island.info:
description: Let the player check their island level
default: true
bskyblock.island.sethome:
description: Let the player set their island teleport point
default: true
bskyblock.island.controlpanel:
description: Allows usage of the island GUI
default: true
bskyblock.island.lock:
description: Allows island locking
default: true
bskyblock.island.expel:
description: Allows expelling of visitors
default: true
bskyblock.island.ban:
description: Allows banning of visitors
default: true
bskyblock.island.settings:
description: Player can see server settings
default: true
bskyblock.island.lang:
description: Player can select a language
default: true
bskyblock.island.name:
description: Player can set the name of their island
default: true
bskyblock.island.spawn:
description: Player can use the island spawn command if spawn exists
default: true
bskyblock.island.reset:
description: Player can use the island reset or restart command
default: true
bskyblock.island.team:
description: Let a player use team commands
default: true
bskyblock.mod.*:
children:
bskyblock.mod.info:
description: Let a moderator see info on a player
default: op
bskyblock.mod.resethome:
description: Allows setting or reseting of a player's home position
default: op
bskyblock.mod.clearreset:
description: Allow clearing of island reset limit
default: false
bskyblock.mod.tp:
description: Allows teleport to an island
default: op
bskyblock.mod.bypassprotect:
description: Allow moderator to bypass island protection
default: op
bskyblock.mod.bypassexpel:
description: Allow moderator to bypass island expulsion
default: op
bskyblock.mod.topbreeders:
description: Lists most populated islands current loaded
default: op
bskyblock.mod.lock:
description: Locks or unlocks an island
default: op
bskyblock.mod.bypasslock:
description: Bypasses an island lock
default: op
bskyblock.mod.team:
description: Enables modification of teams via kick and add commands
default: false
bskyblock.mod.name:
description: Enables naming of player's islands
default: false
bskyblock.mod.resetname:
description: Enables reset of player's island names
default: false
bskyblock.admin.*:
children:
bskyblock.admin.clearresetall:
description: Allow clearing of island reset limit of all players
default: op
bskyblock.admin.reload:
description: Reload the config.yml
default: op
bskyblock.admin.delete:
description: Let a player completely remove a player (including island)
default: op
bskyblock.admin.deleteisland:
description: Let a player completely remove the island the player is on
default: op
bskyblock.admin.register:
description: Let a player register the nearest island to another player.
default: op
bskyblock.admin.unregister:
description: Removes a player from an island without deleting the island blocks.
default: op
bskyblock.admin.purge:
description: Let a player purge old islands.
default: op
bskyblock.admin.setspawn:
description: Allows use of spawn tools
default: op
bskyblock.admin.setrange:
description: Allows setting of island protection range
default: op
bskyblock.admin.topbreeders:
description: Lists most populated islands current loaded
default: op
bskyblock.admin.reserve:
description: Reserves an empty spot for a player's next island
default: op
bskyblock.admin.settingsreset:
description: Resets all the islands to default protection settings
default: op
bskyblock.admin.noban:
description: Player cannot be banned from an island
default: op
bskyblock.admin.setlanguage:
description: Resets all player languages and sets the default language
default: op

183
pom.xml Normal file
View File

@ -0,0 +1,183 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>us.tastybento</groupId>
<artifactId>bskyblock</artifactId>
<packaging>jar</packaging>
<version>FC-0.79</version>
<name>BSkyBlock</name>
<description>The next generation of ASkyBlock</description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<powermock.version>1.7.4</powermock.version>
</properties>
<build>
<defaultGoal>clean package install</defaultGoal>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>${basedir}</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
<resource>
<targetPath>schems</targetPath>
<filtering>false</filtering>
<directory>${basedir}/schems</directory>
<includes>
<include>*.schem</include>
</includes>
</resource>
<resource>
<targetPath>locales</targetPath>
<filtering>false</filtering>
<directory>${basedir}/locales</directory>
<includes>
<include>*.yml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>schematic</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId>
<version>1.6</version> <executions> <execution> <phase>package</phase> <goals>
<goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>us.tastybento.bskyblock.BSkyBlock</mainClass> </transformer> </transformers>
</configuration> </execution> </executions> </plugin> -->
<!-- I'm going to comment out these sections for now to speed up compilation
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version> <executions> <execution> <id>attach-sources</id>
<goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin>
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version> <configuration> <additionalJOption>-Xdoclint:none</additionalJOption>
</configuration> <executions> <execution> <id>attach-javadocs</id> <goals>
<goal>jar</goal> </goals> </execution> </executions> </plugin> -->
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.3.0.603</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sonar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.1</version>
<configuration>
<append>true</append>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>prepare-agent-integration</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>tastybento-github</sonar.organization>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.12.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
</repository>
</repositories>
</project>

BIN
schems/end-island.schem Normal file

Binary file not shown.

BIN
schems/island.schem Normal file

Binary file not shown.

BIN
schems/nether-island.schem Normal file

Binary file not shown.

View File

@ -0,0 +1,365 @@
package us.tastybento.bskyblock;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import us.tastybento.bskyblock.api.configuration.BSBConfig;
import us.tastybento.bskyblock.api.configuration.WorldSettings;
import us.tastybento.bskyblock.api.events.BSBReadyEvent;
import us.tastybento.bskyblock.api.placeholders.PlaceholderHandler;
import us.tastybento.bskyblock.api.user.Notifier;
import us.tastybento.bskyblock.commands.AdminCommand;
import us.tastybento.bskyblock.commands.IslandCommand;
import us.tastybento.bskyblock.database.BSBDbSetup;
import us.tastybento.bskyblock.listeners.BannedVisitorCommands;
import us.tastybento.bskyblock.listeners.BlockEndDragon;
import us.tastybento.bskyblock.listeners.JoinLeaveListener;
import us.tastybento.bskyblock.listeners.NetherPortals;
import us.tastybento.bskyblock.listeners.ObsidianToLava;
import us.tastybento.bskyblock.listeners.PanelListenerManager;
import us.tastybento.bskyblock.listeners.protection.FlyingMobEvents;
import us.tastybento.bskyblock.managers.AddonsManager;
import us.tastybento.bskyblock.managers.CommandsManager;
import us.tastybento.bskyblock.managers.FlagsManager;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.LocalesManager;
import us.tastybento.bskyblock.managers.PlayersManager;
import us.tastybento.bskyblock.managers.RanksManager;
import us.tastybento.bskyblock.managers.SchemsManager;
import us.tastybento.bskyblock.util.HeadGetter;
/**
* Main BSkyBlock class - provides an island minigame in the sky
* @author tastybento
* @author Poslovitch
*/
public class BSkyBlock extends JavaPlugin {
private static BSkyBlock instance;
// Databases
private PlayersManager playersManager;
private IslandsManager islandsManager;
// Metrics
private Metrics metrics;
// Managers
private CommandsManager commandsManager;
private LocalesManager localesManager;
private AddonsManager addonsManager;
private FlagsManager flagsManager;
private IslandWorldManager islandWorldManager;
private RanksManager ranksManager;
private SchemsManager schemsManager;
// Settings
private Settings settings;
// Notifier
private Notifier notifier;
private HeadGetter headGetter;
private boolean isLoaded;
@Override
public void onEnable(){
// Not loaded
isLoaded = false;
// Store the current millis time so we can tell how many ms it took for BSB to fully load.
final long startMillis = System.currentTimeMillis();
// Save the default config from config.yml
saveDefaultConfig();
setInstance(this);
// Load Flags
flagsManager = new FlagsManager(instance);
// Load settings from config.yml. This will check if there are any issues with it too.
settings = new BSBConfig<>(this, Settings.class).loadConfigObject("");
// Start Database managers
playersManager = new PlayersManager(this);
// Check if this plugin is now disabled (due to bad database handling)
if (!this.isEnabled()) {
return;
}
islandsManager = new IslandsManager(this);
ranksManager = new RanksManager(this);
// Start head getter
headGetter = new HeadGetter(this);
// Load metrics
metrics = new Metrics(instance);
registerCustomCharts();
// Load Notifier
notifier = new Notifier();
// Set up command manager
commandsManager = new CommandsManager();
// These items have to be loaded when the server has done 1 tick.
// Note Worlds are not loaded this early, so any Locations or World reference will be null
// at this point. Therefore, the 1 tick scheduler is required.
getServer().getScheduler().runTask(this, () -> {
// Create the world if it does not exist
islandWorldManager = new IslandWorldManager(instance);
// Load schems manager
schemsManager = new SchemsManager(instance);
// Load the default island schems
schemsManager.loadIslands(getIWM().getBSBIslandWorld());
// Set up commands
new IslandCommand();
new AdminCommand();
// Locales manager must be loaded before addons
localesManager = new LocalesManager(instance);
PlaceholderHandler.register(instance);
// Load addons. Addons may load worlds, so they must go before islands are loaded.
addonsManager = new AddonsManager(instance);
addonsManager.loadAddons();
// Enable addons
addonsManager.enableAddons();
getServer().getScheduler().runTask(instance, () -> {
// Register Listeners
registerListeners();
// Load islands from database - need to wait until all the worlds are loaded
islandsManager.load();
// Save islands & players data asynchronously every X minutes
instance.getServer().getScheduler().runTaskTimer(instance, () -> {
playersManager.save(true);
islandsManager.save(true);
}, getSettings().getDatabaseBackupPeriod() * 20 * 60L, getSettings().getDatabaseBackupPeriod() * 20 * 60L);
isLoaded = true;
flagsManager.registerListeners();
instance.log("#############################################");
instance.log(instance.getDescription().getFullName() + " has been fully enabled.");
instance.log("It took: " + (System.currentTimeMillis() - startMillis + "ms"));
instance.log("Thanks for using our plugin !");
instance.log("- Tastybento and Poslovitch, 2017-2018");
instance.log("#############################################");
// Fire plugin ready event
Bukkit.getServer().getPluginManager().callEvent(new BSBReadyEvent());
});
});
}
/**
* Register listeners
*/
private void registerListeners() {
PluginManager manager = getServer().getPluginManager();
// Player join events
manager.registerEvents(new JoinLeaveListener(this), this);
// Panel listener manager
manager.registerEvents(new PanelListenerManager(), this);
// Nether portals
manager.registerEvents(new NetherPortals(this), this);
// Obsidian to lava helper
manager.registerEvents(new ObsidianToLava(this), this);
// Flying mobs protection
manager.registerEvents(new FlyingMobEvents(this), this);
// End dragon blocking
manager.registerEvents(new BlockEndDragon(this), this);
// Banned visitor commands
manager.registerEvents(new BannedVisitorCommands(this), this);
}
@Override
public void onDisable() {
if (addonsManager != null) {
addonsManager.disableAddons();
}
// Save data
if (playersManager != null) {
playersManager.shutdown();
}
if (islandsManager != null) {
islandsManager.shutdown();
}
// Save settings
if (settings != null) {
new BSBConfig<>(this, Settings.class).saveConfigObject(settings);
}
}
private void registerCustomCharts(){
metrics.addCustomChart(new Metrics.SingleLineChart("islands_count") {
@Override
public int getValue() {
return islandsManager.getCount();
}
});
metrics.addCustomChart(new Metrics.SingleLineChart("created_islands") {
@Override
public int getValue() {
int created = islandsManager.metrics_getCreatedCount();
islandsManager.metrics_setCreatedCount(0);
return created;
}
});
metrics.addCustomChart(new Metrics.SimplePie("default_locale") {
@Override
public String getValue() {
return getSettings().getDefaultLanguage();
}
});
metrics.addCustomChart(new Metrics.SimplePie("database") {
@Override
public String getValue() {
return BSBDbSetup.getDatabase().toString();
}
});
}
/**
* Returns the player database
* @return the player database
*/
public PlayersManager getPlayers(){
return playersManager;
}
/**
* Returns the island database
* @return the island database
*/
public IslandsManager getIslands(){
return islandsManager;
}
private static void setInstance(BSkyBlock plugin) {
BSkyBlock.instance = plugin;
}
public static BSkyBlock getInstance() {
return instance;
}
/**
* @return the Commands manager
*/
public CommandsManager getCommandsManager() {
return commandsManager;
}
/**
* @return the Locales manager
*/
public LocalesManager getLocalesManager() {
return localesManager;
}
/**
* @return the Addons manager
*/
public AddonsManager getAddonsManager() {
return addonsManager;
}
/**
* @return the Flags manager
*/
public FlagsManager getFlagsManager() {
return flagsManager;
}
/**
* @return the ranksManager
*/
public RanksManager getRanksManager() {
return ranksManager;
}
/**
* @return the Island World Manager
*/
public IslandWorldManager getIWM() {
return islandWorldManager;
}
/**
* @return the settings
*/
public Settings getSettings() {
return settings;
}
/**
* @return the notifier
*/
public Notifier getNotifier() {
return notifier;
}
/**
* @return the headGetter
*/
public HeadGetter getHeadGetter() {
return headGetter;
}
public void log(String string) {
getLogger().info(() -> string);
}
public void logDebug(Object object) {
getLogger().info(() -> "DEBUG: " + object);
}
public void logError(String error) {
getLogger().severe(() -> error);
}
public void logWarning(String warning) {
getLogger().warning(warning);
}
/**
* Registers a world as a world to be covered by this plugin
* @param world - Bukkit over world
* @param worldSettings - settings for this world
*/
public void registerWorld(World world, WorldSettings worldSettings) {
islandWorldManager.addWorld(world, worldSettings);
}
/**
* @return the schemsManager
*/
public SchemsManager getSchemsManager() {
return schemsManager;
}
/**
* True if the plugin is loaded and ready
* @return the isLoaded
*/
public boolean isLoaded() {
return isLoaded;
}
}

View File

@ -0,0 +1,17 @@
package us.tastybento.bskyblock;
/**
* Contains the plugin constants.
* @author tastybento
*/
public class Constants {
// ----------------- Constants -----------------
// Game Type BSKYBLOCK or ACIDISLAND
public enum GameType {
BSKYBLOCK, ACIDISLAND, BOTH
}
public static final GameType GAMETYPE = GameType.BSKYBLOCK;
// The spawn command (Essentials spawn for example)
public static final String SPAWNCOMMAND = "spawn";
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,297 @@
package us.tastybento.bskyblock.api.addons;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Optional;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.event.Listener;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.PlayersManager;
/**
* Add-on class for BSkyBlock. Extend this to create an add-on. The operation
* and methods are very similar to Bukkit's JavaPlugin.
*
* @author tastybento, ComminQ_Q
*/
public abstract class Addon implements AddonInterface {
private static final String ADDON_CONFIG_FILENAME = "config.yml";
private boolean enabled;
private AddonDescription description;
private FileConfiguration config;
private File dataFolder;
private File file;
public Addon() {
enabled = false;
}
public BSkyBlock getBSkyBlock() {
return BSkyBlock.getInstance();
}
/**
* @return the addon's default config file
*/
public FileConfiguration getConfig() {
if (config == null) {
config = loadYamlFile();
}
return config;
}
/**
* @return Addon's data folder
*/
public File getDataFolder() {
return dataFolder;
}
/**
* @return Addon's description
*/
public AddonDescription getDescription() {
return description;
}
/**
* @return the file
*/
public File getFile() {
return file;
}
/**
* @return Logger
*/
public Logger getLogger() {
return getBSkyBlock().getLogger();
}
/**
* Convenience method to obtain the server
*
* @return the server object
*/
public Server getServer() {
return getBSkyBlock().getServer();
}
public boolean isEnabled() {
return enabled;
}
/**
* Load YAML config file
*
* @return Yaml File configuration
*/
private FileConfiguration loadYamlFile() {
File yamlFile = new File(dataFolder, ADDON_CONFIG_FILENAME);
YamlConfiguration yamlConfig = null;
if (yamlFile.exists()) {
try {
yamlConfig = new YamlConfiguration();
yamlConfig.load(yamlFile);
} catch (Exception e) {
Bukkit.getLogger().severe(() -> "Could not load config.yml: " + e.getMessage());
}
}
return yamlConfig;
}
/**
* Register a listener for this addon
*
* @param listener - listener
*/
public void registerListener(Listener listener) {
Bukkit.getPluginManager().registerEvents(listener, BSkyBlock.getInstance());
}
/**
* Saves the FileConfiguration retrievable by getConfig().
*/
public void saveConfig() {
try {
getConfig().save(new File(dataFolder, ADDON_CONFIG_FILENAME));
} catch (IOException e) {
Bukkit.getLogger().severe("Could not save config!");
}
}
/**
* Saves the addon's config.yml file to the addon's data folder and loads it. If
* the file exists already, it will not be replaced.
*/
public void saveDefaultConfig() {
saveResource(ADDON_CONFIG_FILENAME, false);
config = loadYamlFile();
}
/**
* Saves a resource contained in this add-on's jar file to the addon's data
* folder.
*
* @param resourcePath
* in jar file
* @param replace
* - if true, will overwrite previous file
*/
public void saveResource(String resourcePath, boolean replace) {
saveResource(resourcePath, dataFolder, replace, false);
}
/**
* Saves a resource contained in this add-on's jar file to the destination
* folder.
*
* @param jarResource
* in jar file
* @param destinationFolder
* on file system
* @param replace
* - if true, will overwrite previous file
* @param noPath
* - if true, the resource's path will be ignored when saving
*/
public void saveResource(String jarResource, File destinationFolder, boolean replace, boolean noPath) {
if (jarResource == null || jarResource.equals("")) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}
jarResource = jarResource.replace('\\', '/');
try (JarFile jar = new JarFile(file)) {
JarEntry jarConfig = jar.getJarEntry(jarResource);
if (jarConfig != null) {
try (InputStream in = jar.getInputStream(jarConfig)) {
if (in == null) {
throw new IllegalArgumentException(
"The embedded resource '" + jarResource + "' cannot be found in " + jar.getName());
}
// There are two options, use the path of the resource or not
File outFile = new File(destinationFolder, jarResource);
if (noPath) {
outFile = new File(destinationFolder, outFile.getName());
}
// Make any dirs that need to be made
outFile.getParentFile().mkdirs();
if (!outFile.exists() || replace) {
java.nio.file.Files.copy(in, outFile.toPath());
}
}
}
} catch (IOException e) {
Bukkit.getLogger().severe(
"Could not save from jar file. From " + jarResource + " to " + destinationFolder.getAbsolutePath());
}
}
/**
* Get the resource from Jar file
* @param jarResource - jar resource filename
* @return resource or null if there is a problem
*/
public InputStream getResource(String jarResource) {
if (jarResource == null || jarResource.equals("")) {
throw new IllegalArgumentException("ResourcePath cannot be null or empty");
}
jarResource = jarResource.replace('\\', '/');
try (JarFile jar = new JarFile(file)) {
JarEntry jarConfig = jar.getJarEntry(jarResource);
if (jarConfig != null) {
try (InputStream in = jar.getInputStream(jarConfig)) {
return in;
}
}
} catch (IOException e) {
Bukkit.getLogger().severe("Could not open from jar file. " + jarResource);
}
return null;
}
/**
* Set the file that contains this addon
*
* @param f
* the file to set
*/
public void setAddonFile(File f) {
file = f;
}
/**
* Set this addon's data folder
*
* @param file - data folder
*/
public void setDataFolder(File file) {
dataFolder = file;
}
/**
* Set this addons description
*
* @param desc - description
*/
public void setDescription(AddonDescription desc) {
description = desc;
}
/**
* Set whether this addon is enabled or not
*
* @param enabled - true if enabled
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
/**
* Get Players Manager
* @return Players manager
*/
public PlayersManager getPlayers() {
return getBSkyBlock().getPlayers();
}
/**
* Get Islands Manager
* @return Islands manager
*/
public IslandsManager getIslands() {
return getBSkyBlock().getIslands();
}
/**
* Get the Addon By Name
* @return Optional Addon
*/
public Optional<Addon> getAddonByName(String name) {
return getBSkyBlock().getAddonsManager().getAddonByName(name);
}
public void log(String string) {
getBSkyBlock().log(string);
}
public void logWarning(String string) {
getBSkyBlock().logWarning(string);
}
public void logError(String string) {
getBSkyBlock().logError(string);
}
}

View File

@ -0,0 +1,138 @@
package us.tastybento.bskyblock.api.addons;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.permissions.PermissionDefault;
import org.bukkit.plugin.InvalidDescriptionException;
import org.bukkit.util.permissions.DefaultPermissions;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.addons.AddonDescription.AddonDescriptionBuilder;
import us.tastybento.bskyblock.api.addons.exception.InvalidAddonFormatException;
import us.tastybento.bskyblock.api.addons.exception.InvalidAddonInheritException;
import us.tastybento.bskyblock.managers.AddonsManager;
/**
* Loads addons and sets up permissions
* @author Tastybento, ComminQ
*/
public class AddonClassLoader extends URLClassLoader {
private final Map<String, Class<?>> classes = new HashMap<>();
private Addon addon;
private AddonsManager loader;
public AddonClassLoader(AddonsManager addonsManager, YamlConfiguration data, File path, ClassLoader parent)
throws InvalidAddonInheritException,
MalformedURLException,
InvalidAddonFormatException,
InvalidDescriptionException,
InstantiationException,
IllegalAccessException {
super(new URL[]{path.toURI().toURL()}, parent);
loader = addonsManager;
Class<?> javaClass;
try {
String mainClass = data.getString("main");
javaClass = Class.forName(mainClass, true, this);
if(mainClass.contains("us.tastybento")){
throw new InvalidAddonFormatException("Packages declaration cannot start with 'us.tastybento'");
}
} catch (ClassNotFoundException e) {
BSkyBlock.getInstance().logError("Could not load '" + path.getName() + "' in folder '" + path.getParent() + "' - invalid addon.yml");
throw new InvalidDescriptionException("Invalid addon.yml");
}
Class<? extends Addon> addonClass;
try{
addonClass = javaClass.asSubclass(Addon.class);
} catch(ClassCastException e){
throw new InvalidAddonInheritException("Main class doesn't not extends super class 'Addon'");
}
addon = addonClass.newInstance();
addon.setDescription(asDescription(data));
// Set permissions
if (data.isConfigurationSection("permissions")) {
ConfigurationSection perms = data.getConfigurationSection("permissions");
perms.getKeys(true).forEach(perm -> {
if (perms.contains(perm + ".default") && perms.contains(perm + ".description")) {
registerPermission(perms, perm);
}
});
}
}
private void registerPermission(ConfigurationSection perms, String perm) {
PermissionDefault pd = PermissionDefault.getByName(perms.getString(perm + ".default"));
if (pd == null) {
Bukkit.getLogger().severe("Permission default is invalid : " + perms.getName());
return;
}
String desc = perms.getString(perm + ".description");
DefaultPermissions.registerPermission(perm, desc, pd);
}
private AddonDescription asDescription(YamlConfiguration data){
return new AddonDescriptionBuilder(data.getString("name"))
.withVersion(data.getString("version"))
.withAuthor(data.getString("authors")).build();
}
/* (non-Javadoc)
* @see java.net.URLClassLoader#findClass(java.lang.String)
*/
@Override
protected Class<?> findClass(String name) {
return findClass(name, true);
}
/**
* This is a custom findClass that enables classes in other addons to be found
* @param name - class name
* @param checkGlobal - check globally or not when searching
* @return Class - class if found
*/
public Class<?> findClass(String name, boolean checkGlobal) {
if (name.startsWith("us.tastybento.")) {
return null;
}
Class<?> result = classes.get(name);
if (result == null) {
if (checkGlobal) {
result = loader.getClassByName(name);
}
if (result == null) {
try {
result = super.findClass(name);
} catch (ClassNotFoundException e) {
return null;
}
if (result != null) {
loader.setClass(name, result);
}
classes.put(name, result);
}
}
return result;
}
/**
* @return the addon
*/
public Addon getAddon() {
return addon;
}
}

View File

@ -0,0 +1,111 @@
package us.tastybento.bskyblock.api.addons;
import java.util.Arrays;
import java.util.List;
/**
* @author Tastybento, Poslovitch
*/
public final class AddonDescription {
private String main;
private String name;
private String version;
private String description;
private List<String> authors;
public AddonDescription() {}
public AddonDescription(String main, String name, String version, String description, List<String> authors) {
this.main = main;
this.name = name;
this.version = version;
this.description = description;
this.authors = authors;
}
/**
* @param main the main to set
*/
public void setMain(String main) {
this.main = main;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @param version the version to set
*/
public void setVersion(String version) {
this.version = version;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @param authors the authors to set
*/
public void setAuthors(List<String> authors) {
this.authors = authors;
}
public String getName() {
return name;
}
public String getMain() {
return main;
}
public String getVersion() {
return version;
}
public String getDescription() {
return description;
}
public List<String> getAuthors() {
return authors;
}
public static class AddonDescriptionBuilder{
private AddonDescription description;
public AddonDescriptionBuilder(String name){
description = new AddonDescription();
description.setName(name);
}
public AddonDescriptionBuilder withAuthor(String... authors){
description.setAuthors(Arrays.asList(authors));
return this;
}
public AddonDescriptionBuilder withDescription(String desc){
description.setDescription(desc);
return this;
}
public AddonDescriptionBuilder withVersion(String version){
description.setVersion(version);
return this;
}
public AddonDescription build(){
return description;
}
}
}

View File

@ -0,0 +1,7 @@
package us.tastybento.bskyblock.api.addons;
public interface AddonInterface {
void onEnable();
void onDisable();
default void onLoad() {}
}

View File

@ -0,0 +1,34 @@
package us.tastybento.bskyblock.api.addons;
/**
* Represents the current run-time state of a {@link Addon}.
*
* @author Poslovitch
* @since 1.0
*/
public enum AddonState {
/**
* The addon has been correctly enabled and is now fully working.
*/
ENABLED,
/**
* The addon is fully disabled.
*/
DISABLED,
/**
* The addon has not been loaded because it requires a different version of BSkyBlock or of the server software.
*/
INCOMPATIBLE,
/**
* The addon has not been enabled because a dependency is missing.
*/
MISSING_DEPENDENCY,
/**
* The addon loading or enabling process has been interrupted by an unhandled error.
*/
ERROR
}

View File

@ -0,0 +1,14 @@
package us.tastybento.bskyblock.api.addons.exception;
public abstract class AddonException extends Exception {
/**
*
*/
private static final long serialVersionUID = 4203162022348693854L;
public AddonException(String errorMessage){
super("AddonException : " + errorMessage);
}
}

View File

@ -0,0 +1,28 @@
package us.tastybento.bskyblock.api.addons.exception;
import java.util.logging.Level;
import org.bukkit.Bukkit;
public class InvalidAddonFormatException extends AddonException {
/**
*
*/
private static final long serialVersionUID = 7741502900847049986L;
public InvalidAddonFormatException(String errorMessage) {
super(errorMessage);
}
@Override
public void printStackTrace(){
super.printStackTrace();
Bukkit.getLogger().log(Level.WARNING, " Basic format : (addon.yml)");
Bukkit.getLogger().log(Level.WARNING, " main: path.to.your.MainClass");
Bukkit.getLogger().log(Level.WARNING, " name: <NameOfYourModule>");
Bukkit.getLogger().log(Level.WARNING, " authors: <AuthorA> | <AuthorA, AuthorB>");
Bukkit.getLogger().log(Level.WARNING, " version: YourVersion");
}
}

View File

@ -0,0 +1,14 @@
package us.tastybento.bskyblock.api.addons.exception;
public class InvalidAddonInheritException extends AddonException {
/**
*
*/
private static final long serialVersionUID = -5847358994397613244L;
public InvalidAddonInheritException(String errorMessage) {
super(errorMessage);
}
}

View File

@ -0,0 +1,42 @@
package us.tastybento.bskyblock.api.commands;
import java.util.List;
import java.util.Optional;
import us.tastybento.bskyblock.api.user.User;
/**
* Interface for BSkyBlock Commands
* @author tastybento
*
*/
public interface BSBCommand {
/**
* Anything that needs to be set up for this command.
* Register subcommands in this section.
*/
void setup();
/**
* What will be executed when this command is run
* @param user the User who is executing the command
* @param label the label which has been used to execute the command (can be the command's label OR an alias)
* @param args the command arguments
* @return true or false - true if the command executed successfully
*/
boolean execute(User user, String label, List<String> args);
/**
* Tab Completer for CompositeCommands. Note that any registered sub-commands will be automatically
* added to the list must not be manually added. Use this to add tab-complete for things like names.
* @param user - the User
* @param alias - alias for command
* @param args - command arguments
* @return List of strings that could be used to complete this command.
*/
default Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
return Optional.empty();
}
}

View File

@ -0,0 +1,644 @@
package us.tastybento.bskyblock.api.commands;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.PluginIdentifiableCommand;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitTask;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.Settings;
import us.tastybento.bskyblock.api.addons.Addon;
import us.tastybento.bskyblock.api.events.command.CommandEvent;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
import us.tastybento.bskyblock.managers.PlayersManager;
import us.tastybento.bskyblock.util.Util;
/**
* BSB composite command
* @author tastybento
* @author Poslovitch
*/
public abstract class CompositeCommand extends Command implements PluginIdentifiableCommand, BSBCommand {
private final BSkyBlock plugin;
/**
* True if the command is for the player only (not for the console)
*/
private boolean onlyPlayer = false;
/**
* The parameters string for this command. It is the commands followed by a locale reference.
*/
private String parameters = "";
/**
* The parent command to this one. If this is a top-level command it will be empty.
*/
protected final CompositeCommand parent;
/**
* The permission required to execute this command
*/
private String permission = "";
/**
* This is the command level. 0 is the top, 1 is the first level sub command.
*/
private final int subCommandLevel;
/**
* Map of sub commands
*/
private Map<String, CompositeCommand> subCommands;
/**
* Map of aliases for subcommands
*/
private Map<String, CompositeCommand> subCommandAliases;
/**
* The command chain from the very top, e.g., island team promote
*/
private String usage;
/**
* The prefix to be used in this command
*/
private String permissionPrefix = "";
/**
* The world that this command operates in. This is an overworld and will cover any associated nether or end
* If the world value does not exist, then the command is general across worlds
*/
private World world;
/**
* The addon creating this command, if any
*/
private Addon addon;
/**
* The top level label
*/
private String topLabel = "";
private static Map<User, Confirmer> toBeConfirmed = new HashMap<>();
/**
* Top level command
* @param addon - addon creating the command
* @param label - string for this command
* @param aliases - aliases
*/
public CompositeCommand(Addon addon, String label, String... aliases) {
super(label);
this.addon = addon;
this.topLabel = label;
this.plugin = BSkyBlock.getInstance();
setAliases(new ArrayList<>(Arrays.asList(aliases)));
parent = null;
setUsage("");
subCommandLevel = 0; // Top level
subCommands = new LinkedHashMap<>();
subCommandAliases = new LinkedHashMap<>();
// Register command if it is not already registered
if (plugin.getCommand(label) == null) {
plugin.getCommandsManager().registerCommand(this);
}
setup();
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
new DefaultHelpCommand(this);
}
}
/**
* This is the top-level command constructor for commands that have no parent.
* @param label - string for this command
* @param aliases - aliases for this command
*/
public CompositeCommand(String label, String... aliases) {
this((Addon)null, label, aliases);
}
/**
* Sub-command constructor
* @param parent - the parent composite command
* @param label - string label for this subcommand
* @param aliases - aliases for this subcommand
*/
public CompositeCommand(CompositeCommand parent, String label, String... aliases) {
super(label);
this.topLabel = parent.getTopLabel();
this.plugin = BSkyBlock.getInstance();
this.parent = parent;
subCommandLevel = parent.getLevel() + 1;
// Add this sub-command to the parent
parent.getSubCommands().put(label, this);
setAliases(new ArrayList<>(Arrays.asList(aliases)));
subCommands = new LinkedHashMap<>();
subCommandAliases = new LinkedHashMap<>();
// Add aliases to the parent for this command
for (String alias : aliases) {
parent.getSubCommandAliases().put(alias, this);
}
setUsage("");
// Inherit permission prefix
this.permissionPrefix = parent.getPermissionPrefix();
// Inherit world
this.world = parent.getWorld();
setup();
// If this command does not define its own help class, then use the default help command
if (!getSubCommand("help").isPresent() && !label.equals("help")) {
new DefaultHelpCommand(this);
}
}
/*
* This method deals with the command execution. It traverses the tree of
* subcommands until it finds the right object and then runs execute on it.
*/
@Override
public boolean execute(CommandSender sender, String label, String[] args) {
// Get the User instance for this sender
User user = User.getInstance(sender);
CompositeCommand cmd = getCommandFromArgs(args);
// Check for console and permissions
if (cmd.onlyPlayer && !(sender instanceof Player)) {
user.sendMessage("general.errors.use-in-game");
return false;
}
// Check perms, but only if this isn't the console
if ((sender instanceof Player) && !sender.isOp() && !cmd.getPermission().isEmpty() && !sender.hasPermission(cmd.getPermission())) {
user.sendMessage("general.errors.no-permission");
user.sendMessage("general.errors.you-need", TextVariables.PERMISSION, cmd.getPermission());
return false;
}
// Fire an event to see if this command should be cancelled
CommandEvent event = CommandEvent.builder()
.setCommand(this)
.setLabel(label)
.setSender(sender)
.setArgs(args)
.build();
if (event.isCancelled()) {
return false;
}
// Execute and trim args
return cmd.execute(user, (cmd.subCommandLevel > 0) ? args[cmd.subCommandLevel-1] : label, Arrays.asList(args).subList(cmd.subCommandLevel, args.length));
}
/**
* Get the current composite command based on the arguments
* @param args - arguments
* @return the current composite command based on the arguments
*/
private CompositeCommand getCommandFromArgs(String[] args) {
CompositeCommand subCommand = this;
// Run through any arguments
for (String arg : args) {
// get the subcommand corresponding to the arg
if (subCommand.hasSubCommands()) {
Optional<CompositeCommand> sub = subCommand.getSubCommand(arg);
if (!sub.isPresent()) {
return subCommand;
}
// Step down one
subCommand = sub.orElse(subCommand);
// Set the label
subCommand.setLabel(arg);
} else {
// We are at the end of the walk
return subCommand;
}
// else continue the loop
}
return subCommand;
}
/**
* Convenience method to get the island manager
* @return IslandsManager
*/
protected IslandsManager getIslands() {
return plugin.getIslands();
}
/**
* @return this command's sub-level. Top level is 0.
* Every time a command registers with a parent, their level will be set.
*/
protected int getLevel() {
return subCommandLevel;
}
/**
* @return Logger
*/
public Logger getLogger() {
return plugin.getLogger();
}
/**
* Convenience method to obtain team members
* @param world - world to check
* @param user - the User
* @return set of UUIDs of all team members
*/
protected Set<UUID> getMembers(World world, User user) {
return plugin.getIslands().getMembers(world, user.getUniqueId());
}
public String getParameters() {
return parameters;
}
/**
* @return the parent command object
*/
public CompositeCommand getParent() {
return parent;
}
@Override
public String getPermission() {
return permission;
}
/**
* Convenience method to get the player manager
* @return PlayersManager
*/
protected PlayersManager getPlayers() {
return plugin.getPlayers();
}
@Override
public BSkyBlock getPlugin() {
return plugin;
}
/**
* Get the island worlds manager
* @return island worlds manager
*/
public IslandWorldManager getIWM() {
return plugin.getIWM();
}
/**
* @return Settings object
*/
public Settings getSettings() {
return plugin.getSettings();
}
/**
* Returns the CompositeCommand object referring to this command label
* @param label - command label or alias
* @return CompositeCommand or null if none found
*/
public Optional<CompositeCommand> getSubCommand(String label) {
label = label.toLowerCase();
if (subCommands.containsKey(label)) {
return Optional.ofNullable(subCommands.get(label));
}
// Try aliases
if (subCommandAliases.containsKey(label)) {
return Optional.ofNullable(subCommandAliases.get(label));
}
return Optional.empty();
}
/**
* @return Map of sub commands for this command
*/
public Map<String, CompositeCommand> getSubCommands() {
return subCommands;
}
/**
* Returns a map of sub commands for this command.
* As it needs more calculations to handle the Help subcommand, it is preferable to use {@link #getSubCommands()} when no such distinction is needed.
* @param ignoreHelp Whether the Help subcommand should not be returned in the map or not.
* @return Map of sub commands for this command
* @see #hasSubCommands(boolean)
*/
public Map<String, CompositeCommand> getSubCommands(boolean ignoreHelp) {
if (ignoreHelp && getSubCommand("help").isPresent()) {
Map<String, CompositeCommand> result = subCommands;
result.remove("help");
return result;
}
return getSubCommands();
}
/**
* Convenience method to obtain the user's team leader
* @param world - world to check
* @param user - the User
* @return UUID of player's team leader or null if user has no island
*/
protected UUID getTeamLeader(World world, User user) {
return plugin.getIslands().getTeamLeader(world, user.getUniqueId());
}
@Override
public String getUsage() {
return "/" + usage;
}
/**
* Check if this command has a specific sub command.
* @param subCommand - sub command
* @return true if this command has this sub command
*/
protected boolean hasSubCommand(String subCommand) {
return subCommands.containsKey(subCommand) || subCommandAliases.containsKey(subCommand);
}
/**
* Check if this command has any sub commands.
* @return true if this command has subcommands
*/
protected boolean hasSubCommands() {
return !subCommands.isEmpty();
}
/**
* Check if this command has any sub commands.
* As it needs more calculations to handle the Help subcommand, it is preferable to use {@link #hasSubCommands()} when no such distinction is needed.
* @param ignoreHelp Whether the Help subcommand should not be taken into account or not.
* @return true if this command has subcommands
* @see #getSubCommands(boolean)
*/
protected boolean hasSubCommands(boolean ignoreHelp) {
return !getSubCommands(ignoreHelp).isEmpty();
}
/**
* Convenience method to check if a user has a team.
* @param world - the world to check
* @param user - the User
* @return true if player is in a team
*/
protected boolean inTeam(World world, User user) {
return plugin.getIslands().inTeam(world, user.getUniqueId());
}
/**
* Check if this command is only for players.
* @return true or false
*/
public boolean isOnlyPlayer() {
return onlyPlayer;
}
/**
* Convenience method to check if a user is a player
* @param user - the User
* @return true if sender is a player
*/
protected boolean isPlayer(User user) {
return user.getPlayer() != null;
}
/**
* Set whether this command is only for players
* @param onlyPlayer - true if command only for players
*/
public void setOnlyPlayer(boolean onlyPlayer) {
this.onlyPlayer = onlyPlayer;
}
/**
* Sets the command parameters to be shown in help
* @param parameters - string of parameters
*/
public void setParameters(String parameters) {
this.parameters = parameters;
}
/* (non-Javadoc)
* @see org.bukkit.command.Command#setPermission(java.lang.String)
*/
@Override
public void setPermission(String permission) {
this.permission = permissionPrefix + permission;
}
/**
* Inherits the permission from parent command
*/
public void inheritPermission() {
this.permission = parent.getPermission();
}
/**
* This creates the full linking chain of commands
*/
@Override
public Command setUsage(String usage) {
// Go up the chain
CompositeCommand parentCommand = getParent();
StringBuilder u = new StringBuilder().append(getLabel()).append(" ").append(usage);
while (parentCommand != null) {
u.insert(0, " ");
u.insert(0, parentCommand.getLabel());
parentCommand = parentCommand.getParent();
}
this.usage = u.toString().trim();
return this;
}
@Override
public List<String> tabComplete(final CommandSender sender, final String alias, final String[] args) {
List<String> options = new ArrayList<>();
// Get command object based on args entered so far
CompositeCommand cmd = getCommandFromArgs(args);
// Check for console and permissions
if (cmd.onlyPlayer && !(sender instanceof Player)) {
return options;
}
if (!cmd.getPermission().isEmpty() && !sender.hasPermission(cmd.getPermission()) && !sender.isOp()) {
return options;
}
// Add any tab completion from the subcommand
options.addAll(cmd.tabComplete(User.getInstance(sender), alias, new LinkedList<>(Arrays.asList(args))).orElse(new ArrayList<>()));
// Add any sub-commands automatically
if (cmd.hasSubCommands()) {
// Check if subcommands are visible to this sender
for (CompositeCommand subCommand: cmd.getSubCommands().values()) {
if (sender instanceof Player) {
// Player
if (subCommand.getPermission().isEmpty() || sender.hasPermission(subCommand.getPermission()) || sender.isOp()) {
// Permission is okay
options.add(subCommand.getLabel());
}
} else {
// Console
if (!subCommand.onlyPlayer) {
// Not a player command
options.add(subCommand.getLabel());
}
}
}
}
String lastArg = args.length != 0 ? args[args.length - 1] : "";
return Util.tabLimit(options, lastArg).stream().sorted().collect(Collectors.toList());
}
/**
* Show help
* @param command - command that this help is for
* @param user - the User
* @return result of help command or false if no help defined
*/
protected boolean showHelp(CompositeCommand command, User user) {
return command.getSubCommand("help").map(helpCommand -> helpCommand.execute(user, helpCommand.getLabel(), new ArrayList<>())).orElse(false);
}
/**
* @return the subCommandAliases
*/
public Map<String, CompositeCommand> getSubCommandAliases() {
return subCommandAliases;
}
/**
* If the permission prefix has been set, will return the prefix plus a trailing dot.
* @return the permissionPrefix
*/
public String getPermissionPrefix() {
return permissionPrefix;
}
/**
* Set the permission prefix. This will be added automatically to the permission
* and will apply to any sub commands too.
* Do not put a dot on the end of it.
* @param permissionPrefix the permissionPrefix to set
*/
public void setPermissionPrefix(String permissionPrefix) {
this.permissionPrefix = permissionPrefix + ".";
}
/**
* The the world that this command applies to.
* @return the world
*/
public World getWorld() {
if (world == null) {
plugin.logError(getLabel() + " did not setWorld in setup!");
}
return world;
}
/**
* @param world the world to set
*/
public void setWorld(World world) {
this.world = world;
}
/**
* @return the addon
*/
public Addon getAddon() {
return addon;
}
/**
* @return top level label, e.g., island
*/
public String getTopLabel() {
return topLabel;
}
/**
* Tells user to confirm command by retyping
* @param user - user
* @param confirmed - runnable to be executed if confirmed
*/
public void askConfirmation(User user, Runnable confirmed) {
// Check for pending confirmations
if (toBeConfirmed.containsKey(user)) {
if (toBeConfirmed.get(user).getTopLabel().equals(getTopLabel()) && toBeConfirmed.get(user).getLabel().equalsIgnoreCase(getLabel())) {
toBeConfirmed.get(user).getTask().cancel();
Bukkit.getScheduler().runTask(getPlugin(), toBeConfirmed.get(user).getRunnable());
toBeConfirmed.remove(user);
return;
} else {
// Player has another outstanding confirmation request that will now be cancelled
user.sendMessage("general.previous-request-cancelled");
}
}
// Tell user that they need to confirm
user.sendMessage("general.confirm", "[seconds]", String.valueOf(getSettings().getConfirmationTime()));
// Set up a cancellation task
BukkitTask task = Bukkit.getScheduler().runTaskLater(getPlugin(), () -> {
user.sendMessage("general.request-cancelled");
toBeConfirmed.remove(user);
}, getPlugin().getSettings().getConfirmationTime() * 20L);
// Add to the global confirmation map
toBeConfirmed.put(user, new Confirmer(getTopLabel(), getLabel(), confirmed, task));
}
private class Confirmer {
private final String topLabel;
private final String label;
private final Runnable runnable;
private final BukkitTask task;
/**
* @param label - command label
* @param runnable - runnable to run when confirmed
* @param task - task ID to cancel when confirmed
*/
Confirmer(String topLabel, String label, Runnable runnable, BukkitTask task) {
this.topLabel = topLabel;
this.label = label;
this.runnable = runnable;
this.task = task;
}
/**
* @return the topLabel
*/
public String getTopLabel() {
return topLabel;
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
/**
* @return the runnable
*/
public Runnable getRunnable() {
return runnable;
}
/**
* @return the task
*/
public BukkitTask getTask() {
return task;
}
}
}

View File

@ -0,0 +1,107 @@
package us.tastybento.bskyblock.api.commands;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import org.apache.commons.lang.math.NumberUtils;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
/**
* Adds a default help to every command that will show the usage of the command
* and the usage of any subcommands that the command has.
* @author tastybento
*
*/
public class DefaultHelpCommand extends CompositeCommand {
private static final int MAX_DEPTH = 2;
private static final String USAGE_PLACEHOLDER = "[usage]";
private static final String PARAMS_PLACEHOLDER = "[parameters]";
private static final String DESC_PLACEHOLDER = "[description]";
private static final String HELP_SYNTAX_REF = "commands.help.syntax";
private static final String HELP = "help";
public DefaultHelpCommand(CompositeCommand parent) {
super(parent, HELP);
}
@Override
public void setup() {
// Set the usage to what the parent's command is
setParameters(parent.getParameters());
setDescription(parent.getDescription());
inheritPermission();
}
@Override
public boolean execute(User user, String label, List<String> args) {
int depth = 0;
if (args.size() == 1) {
if (NumberUtils.isDigits(args.get(0))) {
// Converts first argument into an int, or returns -1 if it cannot. Avoids exceptions.
depth = Optional.ofNullable(args.get(0)).map(NumberUtils::toInt).orElse(-1);
} else {
String usage = user.getTranslation(parent.getUsage());
String params = user.getTranslation("commands.help.parameters");
String desc = user.getTranslation("commands.help.description");
user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc);
return true;
}
}
if (depth == 0) {
user.sendMessage("commands.help.header", TextVariables.LABEL, getIWM().getFriendlyName(getWorld()));
}
if (depth < MAX_DEPTH) {
if (!parent.getLabel().equals(HELP)) {
// Get elements
String usage = parent.getUsage().isEmpty() ? "" : user.getTranslation(parent.getUsage());
String params = getParameters().isEmpty() ? "" : user.getTranslation(getParameters());
String desc = getDescription().isEmpty() ? "" : user.getTranslation(getDescription());
if (showPrettyHelp(user, usage, params, desc)) {
// No more to show
return true;
}
}
// Increment the depth and run through any subcommands and get their help too
runSubCommandHelp(user, depth + 1);
}
if (depth == 0) {
user.sendMessage("commands.help.end");
}
return true;
}
private void runSubCommandHelp(User user, int newDepth) {
for (CompositeCommand subCommand : parent.getSubCommands().values()) {
// Ignore the help command
if (!subCommand.getLabel().equals(HELP)) {
// Every command should have help because every command has a default help
Optional<CompositeCommand> sub = subCommand.getSubCommand(HELP);
sub.ifPresent(compositeCommand -> compositeCommand.execute(user, HELP, Collections.singletonList(String.valueOf(newDepth))));
}
}
}
private boolean showPrettyHelp(User user, String usage, String params, String desc) {
// Show the help
if (user.isPlayer()) {
// Player. Check perms
if (user.isOp() || user.hasPermission(parent.getPermission())) {
user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc);
} else {
// No permission, nothing to see here. If you don't have permission, you cannot see any sub commands
return true;
}
} else if (!parent.isOnlyPlayer()) {
// Console. Only show if it is a console command
user.sendMessage(HELP_SYNTAX_REF, USAGE_PLACEHOLDER, usage, PARAMS_PLACEHOLDER, params, DESC_PLACEHOLDER, desc);
}
return false;
}
}

View File

@ -0,0 +1,93 @@
package us.tastybento.bskyblock.api.configuration;
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.addons.Addon;
import us.tastybento.bskyblock.database.AbstractDatabaseHandler;
import us.tastybento.bskyblock.database.flatfile.FlatFileDatabase;
/**
* Handy config class to store and load Java POJOs as YAML configs
* @author tastybento
*
* @param <T>
*/
public class BSBConfig<T> {
private AbstractDatabaseHandler<T> handler;
private Logger logger;
@SuppressWarnings("unchecked")
public BSBConfig(BSkyBlock plugin, Class<T> type) {
this.logger = plugin.getLogger();
handler = (AbstractDatabaseHandler<T>) new FlatFileDatabase().getHandler(type);
}
@SuppressWarnings("unchecked")
public BSBConfig(Addon addon, Class<T> type) {
this.logger = addon.getLogger();
handler = (AbstractDatabaseHandler<T>) new FlatFileDatabase().getHandler(type);
}
/**
* Load all the config objects and supply them as a list
* @return list of config objects or an empty list if they cannot be loaded
*/
public List<T> loadConfigObjects() {
List<T> result = new ArrayList<>();
try {
result = handler.loadObjects();
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException
| InvocationTargetException | ClassNotFoundException | IntrospectionException e) {
logger.severe(() -> "Could not load config! Error: " + e.getMessage());
}
return result;
}
/**
* Loads the config object
* @param uniqueId - unique id of the object
* @return the object or null if it cannot be loaded
*/
public T loadConfigObject(String uniqueId) {
try {
return handler.loadObject(uniqueId);
} catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException
| ClassNotFoundException | IntrospectionException e) {
logger.severe(() -> "Could not load config object! " + e.getMessage());
}
return null;
}
/**
* Save config object
* @param instance to save
*/
public boolean saveConfigObject(T instance) {
try {
handler.saveObject(instance);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException
| IntrospectionException e) {
logger.severe(() -> "Could not save config! Error: " + e.getMessage());
return false;
}
return true;
}
/**
* Checks if a config object exists or not
* @param name - unique name of the config object
* @return true if it exists
*/
public boolean configObjectExists(String name) {
return handler.objectExists(name);
}
}

View File

@ -0,0 +1,26 @@
package us.tastybento.bskyblock.api.configuration;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RUNTIME)
@Repeatable(ConfigComment.Line.class)
@Target({ FIELD, METHOD, TYPE })
public @interface ConfigComment {
String value();
@Retention(RetentionPolicy.RUNTIME)
@Target({ FIELD, METHOD, TYPE })
@interface Line {
ConfigComment[] value();
}
}

View File

@ -0,0 +1,26 @@
package us.tastybento.bskyblock.api.configuration;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import us.tastybento.bskyblock.Constants.GameType;
/**
*
*
* @author Poslovitch, tastybento
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ConfigEntry {
String path();
String since() default "1.0";
boolean overrideOnChange() default false;
boolean experimental() default false;
boolean needsReset() default false;
GameType specificTo() default GameType.BOTH;
}

View File

@ -0,0 +1,27 @@
package us.tastybento.bskyblock.api.configuration;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Defines where this data object will be stored.
* @author tastybento
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface StoreAt {
/**
* Path where this will be stored. If blank, it will be the BSkyBlock database folder.
*/
String path() default "";
/**
* Filename
*/
String filename() default "";
}

View File

@ -0,0 +1,254 @@
package us.tastybento.bskyblock.api.configuration;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.entity.EntityType;
import us.tastybento.bskyblock.api.addons.Addon;
import us.tastybento.bskyblock.api.flags.Flag;
/**
* Contains world-specific settings. Only getters are required, but you may need setters for your own class.
* @author tastybento
*
*/
public interface WorldSettings {
/**
* @return the Addon that registered this world
*/
Optional<Addon> getAddon();
/**
* Get the default game mode for this game world, e.g. SURVIVAL
* @return game mode
*/
GameMode getDefaultGameMode();
/**
* @return default rank settings for new islands
*/
Map<Flag, Integer> getDefaultIslandFlags();
Map<Flag, Integer> getDefaultIslandSettings();
/**
* Get the world difficulty
* @return difficulty
*/
Difficulty getDifficulty();
/**
* Set the world difficulty
* @param difficulty
*/
void setDifficulty(Difficulty difficulty);
/**
* @return the entityLimits
*/
Map<EntityType, Integer> getEntityLimits();
/**
* @return the friendly name of the world. Used in player commands
*/
String getFriendlyName();
/**
* @return the islandDistance
*/
int getIslandDistance();
/**
* @return the islandHeight
*/
int getIslandHeight();
/**
* @return the islandProtectionRange
*/
int getIslandProtectionRange();
/**
* @return the islandStartX
*/
int getIslandStartX();
/**
* @return the islandStartZ
*/
int getIslandStartZ();
/**
* @return the islandXOffset
*/
int getIslandXOffset();
/**
* @return the islandZOffset
*/
int getIslandZOffset();
/**
* @return Invincible Visitor setting list
*/
List<String> getIvSettings();
/**
* @return the max homes
*/
int getMaxHomes();
/**
* @return the maxIslands
*/
int getMaxIslands();
/**
* @return the max team size for this world
*/
int getMaxTeamSize();
/**
* @return the netherSpawnRadius
*/
int getNetherSpawnRadius();
/**
* @return the permission prefix
*/
String getPermissionPrefix();
/**
* Get the set of entity types that should not be removed in this world when a player teleports to their island
* @return set of entity types
*/
Set<EntityType> getRemoveMobsWhitelist();
/**
* @return the seaHeight
*/
int getSeaHeight();
/**
* @return the tileEntityLimits
*/
Map<String, Integer> getTileEntityLimits();
/**
* @return visible settings for player
*/
List<String> getVisibleSettings();
/**
* @return the visitorBannedCommands
*/
List<String> getVisitorBannedCommands();
/**
* Get world flags
* @return Map of world flags
*/
Map<String, Boolean> getWorldFlags();
/**
* @return the worldName
*/
String getWorldName();
/**
* @return the dragonSpawn
*/
boolean isDragonSpawn();
/**
* @return the endGenerate
*/
boolean isEndGenerate();
/**
* @return the endIslands
*/
boolean isEndIslands();
/**
* @return the netherGenerate
*/
boolean isNetherGenerate();
/**
* @return the netherIslands
*/
boolean isNetherIslands();
/**
* @return the netherTrees
*/
boolean isNetherTrees();
/**
* @return the onJoinResetEnderChest
*/
boolean isOnJoinResetEnderChest();
/**
* @return the onJoinResetInventory
*/
boolean isOnJoinResetInventory();
/**
* @return the onJoinResetMoney
*/
boolean isOnJoinResetMoney();
/**
* @return the onLeaveResetEnderChest
*/
boolean isOnLeaveResetEnderChest();
/**
* @return the onLeaveResetInventory
*/
boolean isOnLeaveResetInventory();
/**
* @return the onLeaveResetMoney
*/
boolean isOnLeaveResetMoney();
/**
* @return true if the default world generator should not operate in this world
*/
boolean isUseOwnGenerator();
/**
* @return true if water is not safe in this world, e.g, should not be a home location
*/
boolean isWaterUnsafe();
/**
* @return list of entity types that should not exit the island limits
*/
List<String> getGeoLimitSettings();
/**
* @return reset limit for world
*/
int getResetLimit();
/**
* Get the island reset time stamp. Any player who last logged in before this time will have resets zeroed
*/
long getResetEpoch();
/**
* Set the island reset time stamp. Any player who last logged in before this time will have resets zeroed
*/
void setResetEpoch(long timestamp);
}

View File

@ -0,0 +1,9 @@
package us.tastybento.bskyblock.api.events;
/**
* Fired when BSkyBlock is ready to play and all files are loaded
*
* @author tastybento
* @since 1.0
*/
public class BSBReadyEvent extends PremadeEvent {}

View File

@ -0,0 +1,89 @@
package us.tastybento.bskyblock.api.events;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.event.Cancellable;
import us.tastybento.bskyblock.database.objects.Island;
/**
*
* @author Poslovitch
* @version 1.0
*/
public class IslandBaseEvent extends PremadeEvent implements Cancellable {
private boolean cancelled;
private final Island island;
private final UUID playerUUID;
private final boolean admin;
private final Location location;
public IslandBaseEvent(Island island) {
super();
this.island = island;
playerUUID = island == null ? null : island.getOwner();
admin = false;
location = island == null ? null : island.getCenter();
}
/**
* @param island - island
* @param playerUUID - the player's UUID
* @param admin - true if ths is due to an admin event
* @param location - the location
*/
public IslandBaseEvent(Island island, UUID playerUUID, boolean admin, Location location) {
super();
this.island = island;
this.playerUUID = playerUUID;
this.admin = admin;
this.location = location;
}
/**
* @return the island involved in this event
*/
public Island getIsland(){
return island;
}
/**
* @return the owner of the island
*/
public UUID getOwner() {
return island.getOwner();
}
/**
* @return the playerUUID
*/
public UUID getPlayerUUID() {
return playerUUID;
}
/**
* @return the admin
*/
public boolean isAdmin() {
return admin;
}
/**
* @return the location
*/
public Location getLocation() {
return location;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
}

View File

@ -0,0 +1,18 @@
package us.tastybento.bskyblock.api.events;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public abstract class PremadeEvent extends Event {
private static final HandlerList handlers = new HandlerList();
@Override
public HandlerList getHandlers() {
return getHandlerList();
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -0,0 +1,22 @@
package us.tastybento.bskyblock.api.events.addon;
import us.tastybento.bskyblock.api.addons.Addon;
import us.tastybento.bskyblock.api.events.PremadeEvent;
/**
* @author Poslovitch
* @since 1.0
*/
public class AddonBaseEvent extends PremadeEvent {
private final Addon addon;
public AddonBaseEvent(Addon addon) {
super();
this.addon = addon;
}
public Addon getAddon() {
return addon;
}
}

View File

@ -0,0 +1,71 @@
package us.tastybento.bskyblock.api.events.addon;
import us.tastybento.bskyblock.api.addons.Addon;
public class AddonEvent {
public enum Reason {
ENABLE,
DISABLE,
LOAD,
UNKNOWN
}
public static AddonEventBuilder builder() {
return new AddonEventBuilder();
}
public static class AddonEnableEvent extends AddonBaseEvent {
private AddonEnableEvent(Addon addon) {
// Final variables have to be declared in the constuctor
super(addon);
}
}
public static class AddonDisableEvent extends AddonBaseEvent {
private AddonDisableEvent(Addon addon) {
// Final variables have to be declared in the constuctor
super(addon);
}
}
public static class AddonLoadEvent extends AddonBaseEvent {
private AddonLoadEvent(Addon addon) {
// Final variables have to be declared in the constuctor
super(addon);
}
}
public static class AddonGeneralEvent extends AddonBaseEvent {
private AddonGeneralEvent(Addon addon) {
// Final variables have to be declared in the constuctor
super(addon);
}
}
public static class AddonEventBuilder {
// Here field are NOT final. They are just used for the building.
private Addon addon;
private Reason reason = Reason.UNKNOWN;
public AddonEventBuilder addon(Addon addon) {
this.addon = addon;
return this;
}
public AddonEventBuilder reason(Reason reason) {
this.reason = reason;
return this;
}
public AddonBaseEvent build() {
switch (reason) {
case ENABLE:
return new AddonEnableEvent(addon);
case DISABLE:
return new AddonDisableEvent(addon);
case LOAD:
return new AddonLoadEvent(addon);
default:
return new AddonGeneralEvent(addon);
}
}
}
}

View File

@ -0,0 +1,94 @@
package us.tastybento.bskyblock.api.events.command;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
import us.tastybento.bskyblock.api.events.PremadeEvent;
/**
* Fired when a team event happens.
*
* @author tastybento
* @since 1.0
*/
public class CommandEvent extends PremadeEvent implements Cancellable {
private boolean cancelled;
private final CommandSender sender;
private final Command command;
private final String label;
private final String[] args;
private CommandEvent(CommandSender sender, Command command, String label, String[] args) {
super();
this.sender = sender;
this.command = command;
this.label = label;
this.args = args;
}
public static CommandEventBuilder builder() {
return new CommandEventBuilder();
}
public static class CommandEventBuilder {
// Here field are NOT final. They are just used for the building.
private CommandSender sender;
private Command command;
private String label;
private String[] args;
public CommandEventBuilder setSender(CommandSender sender) {
this.sender = sender;
return this;
}
public CommandEventBuilder setCommand(Command command) {
this.command = command;
return this;
}
public CommandEventBuilder setLabel(String label) {
this.label = label;
return this;
}
public CommandEventBuilder setArgs(String[] args) {
this.args = args;
return this;
}
public CommandEvent build() {
return new CommandEvent(sender, command, label, args);
}
}
public CommandSender getSender() {
return sender;
}
public Command getCommand() {
return command;
}
public String getLabel() {
return label;
}
public String[] getArgs() {
return args;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean arg0) {
cancelled = arg0;
}
}

View File

@ -0,0 +1,55 @@
package us.tastybento.bskyblock.api.events.island;
import java.util.UUID;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.database.objects.Island;
/**
* This event is fired when a player changes a flag on his island
* <p>
* Canceling this event will result in canceling the change.
*
* @author Poslovitch
* @since 1.0
*/
public class FlagChangeEvent extends IslandBaseEvent {
private final UUID player;
private final Flag editedFlag;
private final boolean setTo;
/**
* @param island - island
* @param player - the player
* @param editedFlag - flag edited
* @param setTo - new value
*/
public FlagChangeEvent(Island island, UUID player, Flag editedFlag, boolean setTo) {
super(island);
this.player = player;
this.editedFlag = editedFlag;
this.setTo = setTo;
}
/**
* @return the player
*/
public UUID getPlayer() {
return player;
}
/**
* @return the edited flag
*/
public Flag getFlag() {
return editedFlag;
}
/**
* @return enabled/disabled
*/
public boolean getSetTo() {
return setTo;
}
}

View File

@ -0,0 +1,248 @@
package us.tastybento.bskyblock.api.events.island;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.database.objects.Island;
/**
* Fired when a team event happens.
*
* @author tastybento
* @since 1.0
*/
public class IslandEvent {
/**
* Reason for the event
*
*/
public enum Reason {
CREATE,
CREATED,
DELETE,
DELETED,
ENTER,
EXIT,
LOCK,
RESET,
RESETTED,
UNLOCK,
UNKNOWN
}
public static IslandEventBuilder builder() {
return new IslandEventBuilder();
}
/**
* Fired when an island is going to be created. May be canceled.
*
*/
public static class IslandCreateEvent extends IslandBaseEvent {
private IslandCreateEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is created.
*
*/
public static class IslandCreatedEvent extends IslandBaseEvent {
private IslandCreatedEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is going to be deleted. May be canceled.
*
*/
public static class IslandDeleteEvent extends IslandBaseEvent {
private IslandDeleteEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is deleted.
*
*/
public static class IslandDeletedEvent extends IslandBaseEvent {
private IslandDeletedEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an a player enters an island
*
*/
public static class IslandEnterEvent extends IslandBaseEvent {
private IslandEnterEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when a player exits and island
*
*/
public static class IslandExitEvent extends IslandBaseEvent {
private IslandExitEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is locked
*
*/
public static class IslandLockEvent extends IslandBaseEvent {
private IslandLockEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is unlocked
*
*/
public static class IslandUnlockEvent extends IslandBaseEvent {
private IslandUnlockEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when an island is going to be reset. May be canceled.
*
*/
public static class IslandResetEvent extends IslandBaseEvent {
private IslandResetEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired after an island is reset
*
*/
public static class IslandResettedEvent extends IslandBaseEvent {
private IslandResettedEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
/**
* Fired when something happens to the island not covered by other events
*
*/
public static class IslandGeneralEvent extends IslandBaseEvent {
private IslandGeneralEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class IslandEventBuilder {
// Here field are NOT final. They are just used for the building.
private Island island;
private UUID player;
private Reason reason = Reason.UNKNOWN;
private boolean admin;
private Location location;
public IslandEventBuilder island(Island island) {
this.island = island;
return this;
}
/**
* True if this is an admin driven event
* @param admin - true if due to admin event
* @return TeamEvent
*/
public IslandEventBuilder admin(boolean admin) {
this.admin = admin;
return this;
}
/**
* @param reason for the event
* @return IslandEventBuilder
*/
public IslandEventBuilder reason(Reason reason) {
this.reason = reason;
return this;
}
/**
* @param player - the player involved in the event
* @return IslandEventBuilder
*/
public IslandEventBuilder involvedPlayer(UUID player) {
this.player = player;
return this;
}
public IslandEventBuilder location(Location center) {
location = center;
return this;
}
public IslandBaseEvent build() {
switch (reason) {
case CREATE:
IslandCreateEvent create = new IslandCreateEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(create);
return create;
case CREATED:
IslandCreatedEvent created = new IslandCreatedEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(created);
return created;
case DELETE:
IslandDeleteEvent delete = new IslandDeleteEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(delete);
return delete;
case DELETED:
IslandDeletedEvent deleted = new IslandDeletedEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(deleted);
return deleted;
case ENTER:
IslandEnterEvent enter = new IslandEnterEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(enter);
return enter;
case EXIT:
IslandExitEvent exit = new IslandExitEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(exit);
return exit;
case LOCK:
IslandLockEvent lock = new IslandLockEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(lock);
return lock;
case RESET:
IslandResetEvent reset = new IslandResetEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(reset);
return reset;
case RESETTED:
IslandResettedEvent resetted = new IslandResettedEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(resetted);
return resetted;
case UNLOCK:
IslandUnlockEvent unlock = new IslandUnlockEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(unlock);
return unlock;
default:
IslandGeneralEvent general = new IslandGeneralEvent(island, player, admin, location);
Bukkit.getServer().getPluginManager().callEvent(general);
return general;
}
}
}
}

View File

@ -0,0 +1,22 @@
package us.tastybento.bskyblock.api.events.purge;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.database.objects.Island;
/**
* This event is fired before an island is going to be purged.
* Canceling this event will prevent the plugin to remove the island.
*
* @author Poslovitch
* @since 1.0
*/
public class PurgeDeleteIslandEvent extends IslandBaseEvent {
/**
* Called to create the event
* @param island - island that will be removed
*/
public PurgeDeleteIslandEvent(Island island) {
super(island);
}
}

View File

@ -0,0 +1,85 @@
package us.tastybento.bskyblock.api.events.purge;
import java.util.List;
import java.util.UUID;
import org.bukkit.event.Cancellable;
import us.tastybento.bskyblock.api.events.PremadeEvent;
/**
* This event is fired when islands to remove have been chosen and before starting to remove them.
* You can remove or add islands to remove.
* Canceling this event will cancel the purge
*
* @author Poslovitch
* @since 1.0
*/
public class PurgeStartEvent extends PremadeEvent implements Cancellable {
private boolean cancelled;
private final UUID user;
private List<UUID> islandsList;
/**
* Called to create the event
* @param user - the User - the UUID of the player who launched the purge, may be null if purge is launched using the console.
* @param islandsList - the list of islands to remove, based on their leader's UUID
*/
public PurgeStartEvent(UUID user, List<UUID> islandsList) {
this.user = user;
this.islandsList = islandsList;
}
/**
* @return the user who launched the purge, may be null if purge is launched using the console.
*/
public UUID getUser( ){
return user;
}
/**
* @return the list of islands to remove, based on their leader's UUID
*/
public List<UUID> getIslandsList() {
return islandsList;
}
/**
* Convenience method to directly add an island owner's UUID to the list
* @param islandOwner - the owner's UUID from the island to remove
*/
public void add(UUID islandOwner) {
if(!islandsList.contains(islandOwner)) {
islandsList.add(islandOwner);
}
}
/**
* Convenience method to directly remove an island owner's UUID to the list
* @param islandOwner - the owner's UUID from the island to remove
*/
public void remove(UUID islandOwner) {
if(islandsList.contains(islandOwner)) {
islandsList.remove(islandOwner);
}
}
/**
* Replace the island list
* @param islandsList - a new island owners' UUIDs list
*/
public void setIslandsList(List<UUID> islandsList) {
this.islandsList = islandsList;
}
@Override
public boolean isCancelled() {
return cancelled;
}
@Override
public void setCancelled(boolean cancel) {
cancelled = cancel;
}
}

View File

@ -0,0 +1,166 @@
package us.tastybento.bskyblock.api.events.team;
import java.util.UUID;
import org.bukkit.Location;
import us.tastybento.bskyblock.api.events.IslandBaseEvent;
import us.tastybento.bskyblock.database.objects.Island;
/**
* Fired when a team event happens.
*
* @author tastybento
* @since 1.0
*/
public class TeamEvent {
public enum Reason {
INVITE,
JOIN,
REJECT,
LEAVE,
KICK,
MAKELEADER,
INFO,
DELETE,
UNKNOWN,
UNINVITE
}
public static TeamEventBuilder builder() {
return new TeamEventBuilder();
}
public static class TeamJoinEvent extends IslandBaseEvent {
private TeamJoinEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamInviteEvent extends IslandBaseEvent {
private TeamInviteEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamLeaveEvent extends IslandBaseEvent {
private TeamLeaveEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamRejectEvent extends IslandBaseEvent {
private TeamRejectEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamKickEvent extends IslandBaseEvent {
private TeamKickEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamMakeLeaderEvent extends IslandBaseEvent {
private TeamMakeLeaderEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamInfoEvent extends IslandBaseEvent {
private TeamInfoEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamDeleteEvent extends IslandBaseEvent {
private TeamDeleteEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamUninviteEvent extends IslandBaseEvent {
private TeamUninviteEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamGeneralEvent extends IslandBaseEvent {
private TeamGeneralEvent(Island island, UUID player, boolean admin, Location location) {
// Final variables have to be declared in the constuctor
super(island, player, admin, location);
}
}
public static class TeamEventBuilder {
private Island island;
private UUID player;
private Reason reason = Reason.UNKNOWN;
private boolean admin;
private Location location;
public TeamEventBuilder island(Island island) {
this.island = island;
return this;
}
/**
* True if this is an admin driven event
* @param admin - true if due to an admin event
* @return TeamEvent
*/
public TeamEventBuilder admin(boolean admin) {
this.admin = admin;
return this;
}
/**
* @param reason for the event
* @return TeamEventBuilder
*/
public TeamEventBuilder reason(Reason reason) {
this.reason = reason;
return this;
}
/**
* @param player - the player involved in the event
* @return TeamEventBuilder
*/
public TeamEventBuilder involvedPlayer(UUID player) {
this.player = player;
return this;
}
public TeamEventBuilder location(Location center) {
location = center;
return this;
}
public IslandBaseEvent build() {
switch (reason) {
case JOIN:
return new TeamJoinEvent(island, player, admin, location);
case INVITE:
return new TeamInviteEvent(island, player, admin, location);
case LEAVE:
return new TeamLeaveEvent(island, player, admin, location);
case REJECT:
return new TeamRejectEvent(island, player, admin, location);
case KICK:
return new TeamKickEvent(island, player, admin, location);
case MAKELEADER:
return new TeamMakeLeaderEvent(island, player, admin, location);
case INFO:
return new TeamInfoEvent(island, player, admin, location);
case DELETE:
return new TeamDeleteEvent(island, player, admin, location);
case UNINVITE:
return new TeamUninviteEvent(island, player, admin, location);
default:
return new TeamGeneralEvent(island, player, admin, location);
}
}
}
}

View File

@ -0,0 +1,202 @@
package us.tastybento.bskyblock.api.flags;
import java.lang.reflect.Method;
import java.util.Optional;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.Listener;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.IslandWorldManager;
import us.tastybento.bskyblock.managers.IslandsManager;
/**
* Abstract class for flag listeners. Provides common code.
* @author tastybento
*
*/
public abstract class AbstractFlagListener implements Listener {
private BSkyBlock plugin = BSkyBlock.getInstance();
private User user = null;
/**
* @return the plugin
*/
public BSkyBlock getPlugin() {
return plugin;
}
/**
* Used for unit testing only to set the plugin
* @param plugin - BSkyBlock plugin object
*/
public void setPlugin(BSkyBlock plugin) {
this.plugin = plugin;
}
/**
* Sets the player associated with this event.
* If the user is a fake player, they are not counted.
* @param e - event
* @return true if found, otherwise false
*/
private boolean createEventUser(Event e) {
try {
// Use reflection to get the getPlayer method if it exists
Method getPlayer = e.getClass().getMethod("getPlayer");
if (getPlayer != null) {
setUser(User.getInstance((Player)getPlayer.invoke(e)));
return true;
}
} catch (Exception e1) { // Do nothing
}
return false;
}
/**
* Explicitly set the user for the next {@link #checkIsland(Event, Location, Flag)} or {@link #checkIsland(Event, Location, Flag, boolean)}
* @param user - the User
*/
public AbstractFlagListener setUser(User user) {
if (!plugin.getSettings().getFakePlayers().contains(user.getName())) {
this.user = user;
}
return this;
}
/*
* The following methods cover the cancellable events and enable a simple noGo(e) to be used to cancel and send the error message
*/
/**
* Cancels the event and sends the island public message to user
* @param e - event
* @param flag - the flag that has been checked
*/
public void noGo(Event e, Flag flag) {
noGo(e, flag, false);
}
/**
* Cancels the event and sends the island protected message to user unless silent is true
* @param e - event
* @param flag - the flag that has been checked
* @param silent - if true, message is not sent
*/
public void noGo(Event e, Flag flag, boolean silent) {
if (e instanceof Cancellable) {
((Cancellable)e).setCancelled(true);
}
if (user != null) {
if (!silent) {
user.notify("protection.protected", TextVariables.DESCRIPTION, user.getTranslation(flag.getHintReference()));
}
user.updateInventory();
}
}
/**
* Check if flag is allowed at location
* @param e - event
* @param loc - location
* @param flag - flag {@link us.tastybento.bskyblock.lists.Flags}
* @return true if allowed, false if not
*/
public boolean checkIsland(Event e, Location loc, Flag flag) {
return checkIsland(e, loc, flag, false);
}
/**
* Check if flag is allowed at location
* @param e - event
* @param loc - location
* @param flag - flag {@link us.tastybento.bskyblock.lists.Flags}
* @param silent - if true, no attempt is made to tell the user
* @return true if the check is okay, false if it was disallowed
*/
public boolean checkIsland(Event e, Location loc, Flag flag, boolean silent) {
// If this is not an Island World, skip
if (!plugin.getIWM().inWorld(loc)) {
return true;
}
// Get the island and if present
Optional<Island> island = getIslands().getProtectedIslandAt(loc);
// Handle Settings Flag
if (flag.getType().equals(Flag.Type.SETTING)) {
// If the island exists, return the setting, otherwise return the default setting for this flag
return island.map(x -> x.isAllowed(flag)).orElse(flag.isSetForWorld(loc.getWorld()));
}
// Protection flag
// If the user is not set already, try to get it from the event
// Set the user associated with this event
// The user is not set, and the event does not hold a getPlayer, so return false
// TODO: is this the correct handling here?
if (user == null && !createEventUser(e)) {
plugin.logError("Check island had no associated user! " + e.getEventName());
return false;
}
// Ops or bypass mods can do anything
if (user.isOp() || user.hasPermission(getIWM().getPermissionPrefix(loc.getWorld()) + ".mod.bypassprotect")) {
user = null;
return true;
}
// Check if the plugin is set in User (required for testing)
User.setPlugin(plugin);
if (island.isPresent()) {
if (!island.get().isAllowed(user, flag)) {
noGo(e, flag, silent);
// Clear the user for the next time
user = null;
return false;
} else {
user = null;
return true;
}
}
// The player is in the world, but not on an island, so general world settings apply
if (!flag.isSetForWorld(loc.getWorld())) {
noGo(e, flag, silent);
user = null;
return false;
} else {
user = null;
return true;
}
}
/**
* Get the flag for this ID
* @param id - the flag ID
* @return Flag denoted by the id
*/
protected Flag id(String id) {
return plugin.getFlagsManager().getFlagByID(id);
}
/**
* Get the island database manager
* @return the island database manager
*/
protected IslandsManager getIslands() {
return plugin.getIslands();
}
/**
* Get the island world manager
* @return Island World Manager
*/
protected IslandWorldManager getIWM() {
return plugin.getIWM();
}
}

View File

@ -0,0 +1,250 @@
package us.tastybento.bskyblock.api.flags;
import java.util.Optional;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.configuration.WorldSettings;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.RanksManager;
public class Flag implements Comparable<Flag> {
public enum Type {
PROTECTION(Material.SHIELD),
SETTING(Material.COMMAND),
WORLD_SETTING(Material.GRASS);
private Material icon;
Type(Material icon) {
this.icon = icon;
}
public Material getIcon() {
return icon;
}
}
private static final String PROTECTION_FLAGS = "protection.flags.";
private final String id;
private final Material icon;
private final Listener listener;
private final Type type;
private boolean setting;
private final int defaultRank;
private final PanelItem.ClickHandler clickHandler;
private final boolean subPanel;
Flag(String id, Material icon, Listener listener, Type type, int defaultRank, PanelItem.ClickHandler clickListener, boolean subPanel) {
this.id = id;
this.icon = icon;
this.listener = listener;
this.type = type;
this.defaultRank = defaultRank;
this.clickHandler = clickListener;
this.subPanel = subPanel;
}
public String getID() {
return id;
}
public Material getIcon() {
return icon;
}
public Optional<Listener> getListener() {
return Optional.ofNullable(listener);
}
/**
* Check if a setting is set in this world
* @param world - world
* @return world setting or default flag setting if a specific world setting is not set.
* If world is not a game world, then the result will always be false!
*/
public boolean isSetForWorld(World world) {
if (type.equals(Type.WORLD_SETTING)) {
WorldSettings ws = BSkyBlock.getInstance().getIWM().getWorldSettings(world);
if (ws != null) {
ws.getWorldFlags().putIfAbsent(getID(), setting);
return ws.getWorldFlags().get(getID());
}
return false;
} else {
// Setting
return setting;
}
}
/**
* Set a world setting
* @param world - world
* @param setting - true or false
*/
public void setSetting(World world, boolean setting) {
if (getType().equals(Type.WORLD_SETTING)) {
BSkyBlock.getInstance().getIWM().getWorldSettings(world).getWorldFlags().put(getID(), setting);
}
}
/**
* Set the status of this flag for locations outside of island spaces
* @param defaultSetting - true means it is allowed. false means it is not allowed
*/
public void setDefaultSetting(boolean defaultSetting) {
this.setting = defaultSetting;
}
/**
* @return the type
*/
public Type getType() {
return type;
}
/**
* @return the defaultRank
*/
public int getDefaultRank() {
return defaultRank;
}
/**
* @return whether the flag uses a subpanel or not
*/
public boolean hasSubPanel() {
return subPanel;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Flag)) {
return false;
}
Flag other = (Flag) obj;
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
return type == other.type;
}
public String getNameReference() {
return PROTECTION_FLAGS + this.id + ".name";
}
public String getDescriptionReference() {
return PROTECTION_FLAGS + this.id + ".description";
}
public String getHintReference() {
return PROTECTION_FLAGS + this.id + ".hint";
}
/**
* Converts a flag to a panel item. The content of the flag will change depending on who the user is and where they are.
* @param plugin - plugin
* @param user - user that will see this flag
* @return - PanelItem for this flag
*/
public PanelItem toPanelItem(BSkyBlock plugin, User user) {
// Start the flag conversion
PanelItemBuilder pib = new PanelItemBuilder()
.icon(new ItemStack(icon))
.name(user.getTranslation("protection.panel.flag-item.name-layout", TextVariables.NAME, user.getTranslation(getNameReference())))
.clickHandler(clickHandler);
if (hasSubPanel()) {
pib.description(user.getTranslation("protection.panel.flag-item.menu-layout", TextVariables.DESCRIPTION, user.getTranslation(getDescriptionReference())));
return pib.build();
}
// Check if this is a setting or world setting
if (getType().equals(Type.WORLD_SETTING)) {
String worldDetting = 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", TextVariables.DESCRIPTION, user.getTranslation(getDescriptionReference())
, "[setting]", worldDetting));
return pib.build();
}
// 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 (getType().equals(Type.SETTING)) {
String islandSetting = 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", TextVariables.DESCRIPTION, user.getTranslation(getDescriptionReference())
, "[setting]", islandSetting));
return pib.build();
}
// TODO: Get the world settings - the player has no island and is not in an island location
// Dynamic rank list
if (getType().equals(Type.PROTECTION)) {
// Protection flag
String d = user.getTranslation(getDescriptionReference());
d = user.getTranslation("protection.panel.flag-item.description-layout", TextVariables.DESCRIPTION, d);
pib.description(d);
plugin.getRanksManager().getRanks().forEach((reference, score) -> {
if (score > RanksManager.BANNED_RANK && score < island.getFlag(this)) {
pib.description(user.getTranslation("protection.panel.flag-item.blocked_rank") + user.getTranslation(reference));
} else if (score <= RanksManager.OWNER_RANK && score > island.getFlag(this)) {
pib.description(user.getTranslation("protection.panel.flag-item.allowed_rank") + user.getTranslation(reference));
} else if (score == island.getFlag(this)) {
pib.description(user.getTranslation("protection.panel.flag-item.minimal_rank") + user.getTranslation(reference));
}
});
}
}
return pib.build();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Flag [id=" + id + ", icon=" + icon + ", listener=" + listener + ", type=" + type + ", defaultSetting="
+ setting + ", defaultRank=" + defaultRank + ", clickHandler=" + clickHandler + ", subPanel=" + subPanel + "]";
}
@Override
public int compareTo(Flag o) {
return getID().compareTo(o.getID());
}
}

View File

@ -0,0 +1,131 @@
package us.tastybento.bskyblock.api.flags;
import org.bukkit.Material;
import org.bukkit.event.Listener;
import us.tastybento.bskyblock.api.flags.Flag.Type;
import us.tastybento.bskyblock.api.flags.clicklisteners.CycleClick;
import us.tastybento.bskyblock.api.flags.clicklisteners.IslandToggleClick;
import us.tastybento.bskyblock.api.flags.clicklisteners.WorldToggleClick;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.managers.RanksManager;
public class FlagBuilder {
private String id;
private Material icon;
private Listener listener;
private boolean setting;
private Type type = Type.PROTECTION;
private int defaultRank = RanksManager.MEMBER_RANK;
private PanelItem.ClickHandler onClick;
private boolean subPanel = false;
public FlagBuilder id(String string) {
id = string;
return this;
}
/**
* The material that will become the icon for this flag
* @param icon - material
*/
public FlagBuilder icon(Material icon) {
this.icon = icon;
return this;
}
/**
* @param listener - the Bukkit listener that will be registered to handle this flag
*/
public FlagBuilder listener(Listener listener) {
this.listener = listener;
return this;
}
public Flag build() {
// If no onClick has been set, then apply default ones
if (onClick == null) {
switch (type){
case PROTECTION:
onClick = new CycleClick(id);
break;
case SETTING:
onClick = new IslandToggleClick(id);
break;
case WORLD_SETTING:
onClick = new WorldToggleClick(id);
break;
default:
onClick = new CycleClick(id);
break;
}
}
Flag f = new Flag(id, icon, listener, type, defaultRank, onClick, subPanel);
f.setDefaultSetting(setting);
return f;
}
/**
* Sets the default setting for this flag in the world
* @param setting - true or false
* @return FlagBuilder
*/
public FlagBuilder allowedByDefault(boolean setting) {
this.setting = setting;
return this;
}
/**
* Set the type of this flag
* @param type {@link Type}
* @return FlagBuilder
*/
public FlagBuilder type(Type type) {
this.type = type;
return this;
}
/**
* Set the id of this flag to the name of this enum value
* @param flag - flag
* @return FlagBuilder
*/
public FlagBuilder id(Enum<?> flag) {
id = flag.name();
return this;
}
/**
* Set a default rank for this flag. If not set, the value of RanksManager.MEMBER_RANK will be used
* @param rank - rank value
* @return FlagBuilder
*/
public FlagBuilder defaultRank(int rank) {
this.defaultRank = rank;
return this;
}
/**
* Adds a listener for clicks on this flag when it is a panel item. Default is
* {@link us.tastybento.bskyblock.api.flags.clicklisteners.CycleClick}
* @param onClickListener - the listener for clicks. Must use the ClickOn interface
* @return FlagBuilder
*/
public FlagBuilder onClick(PanelItem.ClickHandler onClickListener) {
this.onClick = onClickListener;
return this;
}
/**
* Marks this flag as "using a sub-panel"
* @param subPanel - whether the flag will use a sub-panel or not
* @return FlagBuilder
*/
public FlagBuilder subPanel(boolean subPanel) {
this.subPanel = subPanel;
return this;
}
}

View File

@ -0,0 +1,77 @@
package us.tastybento.bskyblock.api.flags.clicklisteners;
import org.bukkit.Sound;
import org.bukkit.event.inventory.ClickType;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.api.panels.Panel;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.RanksManager;
import us.tastybento.bskyblock.util.Util;
/**
* Left Clicks increase rank, right clicks lower rank
* @author tastybento
*
*/
public class CycleClick implements PanelItem.ClickHandler {
private BSkyBlock plugin = BSkyBlock.getInstance();
private final String id;
/**
* @param id - the flag id that will be adjusted by this click
*/
public CycleClick(String id) {
this.id = id;
}
@Override
public boolean onClick(Panel panel, User user, ClickType click, int slot) {
// Get the world
if (!plugin.getIWM().inWorld(user.getLocation())) {
user.sendMessage("general.errors.wrong-world");
return true;
}
String reqPerm = plugin.getIWM().getPermissionPrefix(Util.getWorld(user.getWorld())) + ".settings." + id;
if (!user.hasPermission(reqPerm)) {
user.sendMessage("general.errors.no-permission");
user.sendMessage("general.errors.you-need", "[permission]", reqPerm);
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
return true;
}
// Left clicking increases the rank required
// Right clicking decreases the rank required
// Get the user's island
Island island = plugin.getIslands().getIsland(user.getWorld(), user.getUniqueId());
if (island != null && island.getOwner().equals(user.getUniqueId())) {
RanksManager rm = plugin.getRanksManager();
Flag flag = plugin.getFlagsManager().getFlagByID(id);
int currentRank = island.getFlag(flag);
if (click.equals(ClickType.LEFT)) {
if (currentRank == RanksManager.OWNER_RANK) {
island.setFlag(flag, RanksManager.VISITOR_RANK);
} else {
island.setFlag(flag, rm.getRankUpValue(currentRank));
}
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F);
} else if (click.equals(ClickType.RIGHT)) {
if (currentRank == RanksManager.VISITOR_RANK) {
island.setFlag(flag, RanksManager.OWNER_RANK);
} else {
island.setFlag(flag, rm.getRankDownValue(currentRank));
}
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F);
}
// Apply change to panel
panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem());
} else {
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
}
return true;
}
}

View File

@ -0,0 +1,66 @@
/*
*/
package us.tastybento.bskyblock.api.flags.clicklisteners;
import org.bukkit.Sound;
import org.bukkit.event.inventory.ClickType;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.api.panels.Panel;
import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.util.Util;
/**
* Toggles a island setting on/off
* @author tastybento
*
*/
public class IslandToggleClick implements ClickHandler {
private BSkyBlock plugin = BSkyBlock.getInstance();
private String id;
/**
* @param id - the flag ID that this click listener is associated with
*/
public IslandToggleClick(String id) {
this.id = id;
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler#onClick(us.tastybento.bskyblock.api.panels.Panel, us.tastybento.bskyblock.api.user.User, org.bukkit.event.inventory.ClickType, int)
*/
@Override
public boolean onClick(Panel panel, User user, ClickType clickType, int slot) {
// Get the world
if (!plugin.getIWM().inWorld(user.getLocation())) {
user.sendMessage("general.errors.wrong-world");
return true;
}
String reqPerm = plugin.getIWM().getPermissionPrefix(Util.getWorld(user.getWorld())) + ".settings." + id;
if (!user.hasPermission(reqPerm)) {
user.sendMessage("general.errors.no-permission");
user.sendMessage("general.errors.you-need", "[permission]", reqPerm);
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
return true;
}
// Get the user's island
Island island = plugin.getIslands().getIsland(user.getWorld(), user);
if (island != null && island.getOwner().equals(user.getUniqueId())) {
Flag flag = plugin.getFlagsManager().getFlagByID(id);
// Toggle flag
island.toggleFlag(flag);
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F);
// Apply change to panel
panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem());
} else {
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
}
return true;
}
}

View File

@ -0,0 +1,61 @@
/*
*/
package us.tastybento.bskyblock.api.flags.clicklisteners;
import org.bukkit.Sound;
import org.bukkit.event.inventory.ClickType;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.flags.Flag;
import us.tastybento.bskyblock.api.panels.Panel;
import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
/**
* Toggles a worldwide setting on/off
* @author tastybento
*
*/
public class WorldToggleClick implements ClickHandler {
private BSkyBlock plugin = BSkyBlock.getInstance();
private String id;
/**
* @param id - the flag ID that this click listener is associated with
*/
public WorldToggleClick(String id) {
this.id = id;
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler#onClick(us.tastybento.bskyblock.api.panels.Panel, us.tastybento.bskyblock.api.user.User, org.bukkit.event.inventory.ClickType, int)
*/
@Override
public boolean onClick(Panel panel, User user, ClickType clickType, int slot) {
// Get the world
if (!plugin.getIWM().inWorld(user.getLocation())) {
user.sendMessage("general.errors.wrong-world");
return true;
}
String reqPerm = plugin.getIWM().getPermissionPrefix(Util.getWorld(user.getWorld())) + ".admin.world.settings." + id;
if (!user.hasPermission(reqPerm)) {
user.sendMessage("general.errors.no-permission");
user.sendMessage("general.errors.you-need", "[permission]", reqPerm);
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_METAL_HIT, 1F, 1F);
return true;
}
// Get flag
Flag flag = plugin.getFlagsManager().getFlagByID(id);
// Toggle flag
flag.setSetting(user.getWorld(), !flag.isSetForWorld(user.getWorld()));
user.getPlayer().playSound(user.getLocation(), Sound.BLOCK_STONE_BUTTON_CLICK_ON, 1F, 1F);
// Apply change to panel
panel.getInventory().setItem(slot, flag.toPanelItem(plugin, user).getItem());
return true;
}
}

View File

@ -0,0 +1,96 @@
package us.tastybento.bskyblock.api.localization;
import java.io.File;
import java.util.Locale;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.util.ItemParser;
/**
* @author Poslovitch, tastybento
*/
public class BSBLocale {
private Locale locale;
private YamlConfiguration config;
private ItemStack banner;
public BSBLocale(Locale locale, YamlConfiguration config) {
this.locale = locale;
this.config = config;
// Load the banner from the configuration
banner = ItemParser.parse(config.getString("banner"));
}
/**
* Get text from the yml file for this locale
* @param reference - the YAML node where the text is
* @return Text for this locale reference or the reference if nothing has been found
*/
public String get(String reference) {
if (config.contains(reference)) {
return config.getString(reference);
}
return reference; // return reference in case nothing has been found
}
/**
* Returns the locale language
* @return the locale language
*/
public String getLanguage(){
if(locale == null) {
return "unknown";
}
return locale.getDisplayLanguage();
}
/**
* Returns the locale country
* @return the locale country
*/
public String getCountry(){
if(locale == null) {
return "unknown";
}
return locale.getDisplayCountry();
}
/**
* Returns the locale language tag (e.g: en-GB)
* @return the locale language tag
*/
public String toLanguageTag(){
return locale.toLanguageTag();
}
/**
* Returns the banner ItemStack representing this locale
* @return the banner ItemStack
*/
public ItemStack getBanner() {
return banner;
}
/**
* Merges a language YAML file to this locale
* @param toBeMerged the YamlConfiguration of the language file
*/
public void merge(YamlConfiguration toBeMerged) {
for (String key : toBeMerged.getKeys(true)) {
if (!config.contains(key)) {
config.set(key, toBeMerged.get(key));
}
}
}
public boolean contains(String reference) {
return config.contains(reference);
}
}

View File

@ -0,0 +1,19 @@
package us.tastybento.bskyblock.api.localization;
/**
* Contains the common variables that can be used in texts.
* @author Poslovitch
*/
public class TextVariables {
private TextVariables() {}
public static final String NAME = "[name]";
public static final String DESCRIPTION = "[description]";
public static final String NUMBER = "[number]";
public static final String RANK = "[rank]";
public static final String LABEL = "[label]";
public static final String PERMISSION = "[permission]";
public static final String SPAWN_HERE = "[spawn_here]";
public static final String VERSION = "[version]";
}

View File

@ -0,0 +1,147 @@
package us.tastybento.bskyblock.api.panels;
import java.util.Map;
import java.util.Optional;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.listeners.PanelListenerManager;
import us.tastybento.bskyblock.util.HeadGetter;
import us.tastybento.bskyblock.util.HeadRequester;
public class Panel implements HeadRequester {
private Inventory inventory;
private Map<Integer, PanelItem> items;
private PanelListener listener;
private User user;
private final String name;
public Panel(String name, Map<Integer, PanelItem> items, int size, User user, PanelListener listener) {
this.name = name;
this.items = items;
// If size is undefined (0) then use the number of items
if (size == 0) {
size = items.keySet().size();
}
// Create panel
if (size > 0) {
// Make sure size is a multiple of 9
size = size + 8;
size -= (size % 9);
inventory = Bukkit.createInventory(null, size, name);
// Fill the inventory and return
for (Map.Entry<Integer, PanelItem> en: items.entrySet()) {
//TODO allow multi-paging
if (en.getKey() < 54) inventory.setItem(en.getKey(), en.getValue().getItem());
// Get player head async
if (en.getValue().isPlayerHead()) {
HeadGetter.getHead(en.getValue(), this);
}
}
} else {
inventory = Bukkit.createInventory(null, 9, name);
}
this.listener = listener;
// If the listener is defined, then run setup
if (listener != null) listener.setup();
// If the user is defined, then open panel immediately
this.user = user;
if (user != null) this.open(user);
}
public Inventory getInventory() {
return inventory;
}
public Map<Integer, PanelItem> getItems() {
return items;
}
/**
* @return the listener
*/
public Optional<PanelListener> getListener() {
return Optional.ofNullable(listener);
}
public Optional<User> getUser() {
return Optional.ofNullable(user);
}
public void open(Player... players) {
for (Player player : players) {
player.openInventory(inventory);
PanelListenerManager.getOpenPanels().put(player.getUniqueId(), this);
}
}
/**
* Open the inventory panel
* @param users - users that should see the panel
*/
public void open(User... users) {
for (User u : users) {
u.getPlayer().openInventory(inventory);
PanelListenerManager.getOpenPanels().put(u.getUniqueId(), this);
}
}
/**
* @param inventory the inventory to set
*/
public void setInventory(Inventory inventory) {
this.inventory = inventory;
}
/**
* @param items the items to set
*/
public void setItems(Map<Integer, PanelItem> items) {
this.items = items;
}
/**
* @param listener the listener to set
*/
public void setListener(PanelListener listener) {
this.listener = listener;
}
/**
* @param user - the User the user to set
*/
public void setUser(User user) {
this.user = user;
}
@Override
public void setHead(PanelItem item) {
// Update the panel item
items.values().stream().filter(i -> i.getName().equals(item.getName())).forEach(i -> i = item);
for (int i = 0; i < inventory.getSize(); i++) {
ItemStack it = inventory.getItem(i);
if (it != null && it.getType().equals(Material.SKULL_ITEM)) {
ItemMeta meta = it.getItemMeta();
if (item.getName().equals(meta.getLocalizedName())) {
inventory.setItem(i, item.getItem());
return;
}
}
}
}
/**
* @return the name
*/
public String getName() {
return name;
}
}

View File

@ -0,0 +1,128 @@
package us.tastybento.bskyblock.api.panels;
import java.util.List;
import java.util.Optional;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder;
import us.tastybento.bskyblock.api.user.User;
public class PanelItem {
public static PanelItem empty() {
return new PanelItemBuilder().build();
}
private ItemStack icon;
private ClickHandler clickHandler;
private List<String> description;
private String name;
private boolean glow;
private ItemMeta meta;
private boolean playerHead;
public PanelItem(ItemStack icon, String name, List<String> description, boolean glow, ClickHandler clickHandler, boolean playerHead) {
this.icon = icon;
this.playerHead = playerHead;
// Get the meta
meta = icon.getItemMeta();
this.clickHandler = clickHandler;
// Create the final item
setName(name);
setDescription(description);
setGlow(glow);
// Set flags to neaten up the view
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
meta.addItemFlags(ItemFlag.HIDE_DESTROYS);
meta.addItemFlags(ItemFlag.HIDE_PLACED_ON);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
icon.setItemMeta(meta);
}
public ItemStack getItem() {
return icon;
}
public List<String> getDescription() {
return description;
}
public void setDescription(List<String> description) {
this.description = description;
meta.setLore(description);
icon.setItemMeta(meta);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
meta.setDisplayName(name);
meta.setLocalizedName(name); //Localized name cannot be overridden by the player using an anvils
icon.setItemMeta(meta);
}
public Optional<ClickHandler> getClickHandler() {
return Optional.ofNullable(clickHandler);
}
public boolean isGlow() {
return glow;
}
public void setGlow(boolean glow) {
this.glow = glow;
meta.addEnchant(Enchantment.ARROW_DAMAGE, 0, glow);
}
/**
* @return the playerHead
*/
public boolean isPlayerHead() {
return playerHead;
}
/**
* Click handler interface
*
*/
public interface ClickHandler {
/**
* This is executed when the icon is clicked
* @param panel - the panel that is being clicked
* @param user - the User
* @param clickType - the click type
* @param slot - the slot that was clicked
* @return true if the click event should be cancelled
*/
boolean onClick(Panel panel, User user, ClickType clickType, int slot);
}
public void setHead(ItemStack itemStack) {
this.icon = itemStack;
// Get the meta
meta = icon.getItemMeta();
// Create the final item
setName(name);
setDescription(description);
setGlow(glow);
// Set flags to neaten up the view
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
meta.addItemFlags(ItemFlag.HIDE_DESTROYS);
meta.addItemFlags(ItemFlag.HIDE_PLACED_ON);
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
icon.setItemMeta(meta);
}
}

View File

@ -0,0 +1,19 @@
package us.tastybento.bskyblock.api.panels;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import us.tastybento.bskyblock.api.user.User;
public interface PanelListener {
/**
* This is called when the panel is first setup
*/
void setup();
void onInventoryClose(InventoryCloseEvent event);
void onInventoryClick(User user, InventoryClickEvent event);
}

View File

@ -0,0 +1,99 @@
package us.tastybento.bskyblock.api.panels.builders;
import java.util.TreeMap;
import us.tastybento.bskyblock.api.panels.Panel;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.panels.PanelListener;
import us.tastybento.bskyblock.api.user.User;
public class PanelBuilder {
private String name;
private TreeMap<Integer, PanelItem> items = new TreeMap<>();
private int size;
private User user;
private PanelListener listener;
public PanelBuilder name(String name) {
this.name = name;
return this;
}
/**
* Add item to the panel in the last slot.
* @param item - Panel item
* @return PanelBuilder
*/
public PanelBuilder item(PanelItem item) {
return item(nextSlot(), item);
}
/**
* Add item into a specific slot. If it is already occupied, it will be replaced.
* @param slot - slot
* @param item - Panel item
* @return PanelBuilder
*/
public PanelBuilder item(int slot, PanelItem item) {
items.put(slot, item);
return this;
}
/**
* Forces panel to be a specific number of slots.
* @param size - size to be
* @return PanelBuilder - PanelBuilder
*/
public PanelBuilder size(int size) {
this.size = size;
return this;
}
/**
* Sets the user who will get this panel. This will open it immediately when it is built
* @param user - the User
* @return PanelBuilder
*/
public PanelBuilder user(User user) {
this.user = user;
return this;
}
/**
* Sets which PanelListener will listen for clicks
* @param listener - listener for this panel
* @return PanelBuilder
*/
public PanelBuilder listener(PanelListener listener) {
this.listener = listener;
return this;
}
/**
* Get the next free slot number
* @return next slot number, or -1 in case none has been found.
*/
public int nextSlot() {
for (int i = 0 ; i < (size == 0 ? 54 : size) ; i++) {
if (!slotOccupied(i)) return i;
}
return -1;
}
/**
* Checks if a slot is occupied in the panel or not
* @param slot to check
* @return true or false
*/
public boolean slotOccupied(int slot) {
return items.containsKey(slot);
}
/**
* Build the panel
* @return Panel
*/
public Panel build() {
return new Panel(name, items, Math.max(size, items.isEmpty() ? size : items.lastKey()), user, listener);
}
}

View File

@ -0,0 +1,98 @@
package us.tastybento.bskyblock.api.panels.builders;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import us.tastybento.bskyblock.api.panels.PanelItem;
import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler;
public class PanelItemBuilder {
private ItemStack icon = new ItemStack(Material.AIR);
private String name = "";
private List<String> description = new ArrayList<>();
private boolean glow = false;
private PanelItem.ClickHandler clickHandler;
private boolean playerHead;
public PanelItemBuilder icon(Material icon) {
this.icon = new ItemStack(icon);
return this;
}
public PanelItemBuilder icon(ItemStack icon) {
this.icon = icon;
return this;
}
/**
* Set icon to player's head
* @param playerName - player's name
* @return PanelItemBuilder
*/
public PanelItemBuilder icon(String playerName) {
this.icon = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
this.name = playerName;
this.playerHead = true;
return this;
}
public PanelItemBuilder name(String name) {
this.name = name;
return this;
}
/**
* Adds a list of strings to the descriptions
* @param description - List of strings
* @return PanelItemBuilder
*/
public PanelItemBuilder description(List<String> description) {
this.description.addAll(description);
return this;
}
/**
* Add any number of lines to the description
* @param description strings of lines
* @return PanelItemBuilder
*/
public PanelItemBuilder description(String... description) {
List<String> additions = Arrays.asList(description);
ArrayList<String> updatableList = new ArrayList<>();
updatableList.addAll(this.description);
updatableList.addAll(additions);
this.description = updatableList;
return this;
}
/**
* Adds a line to the description
* @param description - string
* @return PanelItemBuilder
*/
public PanelItemBuilder description(String description) {
Collections.addAll(this.description, description.split("\n"));
return this;
}
public PanelItemBuilder glow(boolean glow) {
this.glow = glow;
return this;
}
public PanelItemBuilder clickHandler(ClickHandler clickHandler) {
this.clickHandler = clickHandler;
return this;
}
public PanelItem build() {
return new PanelItem(icon, name, description, glow, clickHandler, playerHead);
}
}

View File

@ -0,0 +1,29 @@
package us.tastybento.bskyblock.api.placeholders;
import us.tastybento.bskyblock.api.user.User;
/**
* @author Poslovitch
*/
public class Placeholder {
private String identifier;
private PlaceholderRequest request;
Placeholder(String identifier, PlaceholderRequest request) {
this.identifier = identifier;
this.request = request;
}
public String getIdentifier() {
return this.identifier;
}
public PlaceholderRequest getRequest() {
return request;
}
public interface PlaceholderRequest {
String request(User user);
}
}

View File

@ -0,0 +1,39 @@
package us.tastybento.bskyblock.api.placeholders;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.user.User;
/**
* Simple interface for every Placeholder API.
*
* @author Poslovitch
*/
public interface PlaceholderAPIInterface {
/**
* Gets the name of the Placeholder API
* @return name of the placeholder plugin
*/
String getName();
/**
* Registers the placeholder API
* @param plugin - BSkyBlock plugin object
* @return true if successfully registered
*/
boolean register(BSkyBlock plugin);
/**
* Unregisters the placeholder API
* @param plugin - BSkyBlock plugin object
*/
void unregister(BSkyBlock plugin);
/**
* Replace placeholders in the message according to the receiver
* @param receiver - user who will receive the message
* @param message - message
* @return updated message
*/
String replacePlaceholders(User receiver, String message);
}

View File

@ -0,0 +1,26 @@
package us.tastybento.bskyblock.api.placeholders;
public class PlaceholderBuilder {
private String identifier;
private Placeholder.PlaceholderRequest value;
public PlaceholderBuilder identifier(String identifier) {
this.identifier = identifier;
return this;
}
/**
* The value this placeholder should take
* @param value - placeholder request value
* @return PlaceholderBuilder object
*/
public PlaceholderBuilder value(Placeholder.PlaceholderRequest value) {
this.value = value;
return this;
}
public Placeholder build() {
return new Placeholder(identifier, value);
}
}

View File

@ -0,0 +1,98 @@
package us.tastybento.bskyblock.api.placeholders;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.user.User;
/**
* Handles hooks with other Placeholder APIs.
*
* @author Poslovitch, Tastybento
*/
public class PlaceholderHandler {
private static final String PACKAGE = "us.tastybento.bskyblock.api.placeholders.hooks.";
// This class should never be instantiated (all methods are static)
private PlaceholderHandler() {}
/**
* List of API classes in the package specified above (except the Internal one)
*/
private static final String[] HOOKS = {
//TODO
};
private static List<PlaceholderAPIInterface> apis = new ArrayList<>();
/**
* Register placeholders and hooks
* @param plugin - BSkyBlock plugin object
*/
public static void register(BSkyBlock plugin){
// Load Internal Placeholder API
try{
Class<?> clazz = Class.forName(PACKAGE + "InternalPlaceholderImpl");
PlaceholderAPIInterface internal = (PlaceholderAPIInterface)clazz.newInstance();
apis.add(internal);
} catch (Exception e){
// Should never happen.
plugin.logError("Failed to load default placeholder API");
}
// Load hooks
for(String hook : HOOKS){
if(plugin.getServer().getPluginManager().isPluginEnabled(hook)){
try{
Class<?> clazz = Class.forName(PACKAGE + hook + "PlaceholderImpl");
PlaceholderAPIInterface api = (PlaceholderAPIInterface)clazz.newInstance();
if(api.register(plugin)){
plugin.log("Hooked placeholders into " + hook); // since Java 8, we can use Supplier , which will be evaluated lazily
apis.add(api);
} else {
plugin.log("Failed to hook placeholders into " + hook);
}
} catch (Exception e){
plugin.log("Failed to hook placeholders into " + hook);
}
}
}
}
/**
* Unregister placeholder hooks
* @param plugin - BSkyBlock plugin object
*/
public static void unregister(BSkyBlock plugin){
Iterator<PlaceholderAPIInterface> it = apis.iterator();
while (it.hasNext()) {
PlaceholderAPIInterface api = it.next();
api.unregister(plugin);
it.remove();
}
}
/**
* Replace placeholders in the message according to the receiver
* @param receiver - user to receive the message
* @param message - message
* @return updated message
*/
public static String replacePlaceholders(User receiver, String message){
for(PlaceholderAPIInterface api : apis){
message = api.replacePlaceholders(receiver, message);
}
return message;
}
/**
* @return true if APIs are registered (including Internal), otherwise false
*/
public static boolean hasHooks(){
return apis != null;
}
}

View File

@ -0,0 +1,45 @@
package us.tastybento.bskyblock.api.placeholders.hooks;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.placeholders.Placeholder;
import us.tastybento.bskyblock.api.placeholders.PlaceholderAPIInterface;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.lists.Placeholders;
/**
* Built-in placeholder API
*
* @author Poslovitch
*/
public class InternalPlaceholderImpl implements PlaceholderAPIInterface {
@Override
public String getName() {
return "Internal";
}
@Override
public boolean register(BSkyBlock plugin) {
return true;
}
@Override
public void unregister(BSkyBlock plugin) {
// Useless : it would disable the placeholders.
}
@Override
public String replacePlaceholders(User receiver, String message) {
if(message == null || message.isEmpty()) {
return "";
}
for(Placeholder placeholder : Placeholders.values()){
String identifier = "%" + placeholder.getIdentifier() + "%";
message = message.replaceAll(identifier, placeholder.getRequest().request(receiver));
}
return message;
}
}

View File

@ -0,0 +1,71 @@
package us.tastybento.bskyblock.api.user;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
/**
* Utilities class that helps to avoid spamming the User with potential repeated messages
* @author Poslovitch
*/
public class Notifier {
/**
* Time in seconds before {@link #notificationCache} removes the entry related to the player.
*/
private static final int NOTIFICATION_DELAY = 4;
private final LoadingCache<User, Notification> notificationCache = CacheBuilder.newBuilder()
.expireAfterAccess(NOTIFICATION_DELAY, TimeUnit.SECONDS)
.maximumSize(500)
.build(
new CacheLoader<User, Notification>() {
@Override
public Notification load(User user) {
return new Notification(null, 0);
}
}
);
/**
* Sends message to a user only if the message hasn't been sent recently
* @param user - user
* @param message - message to send (already translated)
* @return true if message sent successfully, false it it has been throttled
*/
public synchronized boolean notify(User user, String message) {
try {
Notification lastNotification = notificationCache.get(user);
long now = System.currentTimeMillis();
if (now >= lastNotification.getTime() + NOTIFICATION_DELAY * 1000 || !message.equals(lastNotification.getMessage())) {
notificationCache.put(user, new Notification(message, now));
user.sendRawMessage(message);
return true;
}
return false;
} catch (ExecutionException e) {
return false;
}
}
public class Notification {
private final String message;
private final long time;
public Notification(String message, long time) {
this.message = message;
this.time = time;
}
public String getMessage() {
return message;
}
public long getTime() {
return time;
}
}
}

View File

@ -0,0 +1,374 @@
package us.tastybento.bskyblock.api.user;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.permissions.PermissionAttachmentInfo;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.placeholders.PlaceholderHandler;
/**
* BSB's user object. Wraps Player.
* @author tastybento
*
*/
public class User {
private static Map<UUID, User> users = new HashMap<>();
/**
* Clears all users from the user list
*/
public static void clearUsers() {
users.clear();
}
/**
* Get an instance of User from a CommandSender
* @param sender - command sender, e.g. console
* @return user - user
*/
public static User getInstance(CommandSender sender) {
if (sender instanceof Player) {
return getInstance((Player)sender);
}
// Console
return new User(sender);
}
/**
* Get an instance of User from a Player object
* @param player - the player
* @return user - user
*/
public static User getInstance(Player player) {
if (player == null) {
return null;
}
if (users.containsKey(player.getUniqueId())) {
return users.get(player.getUniqueId());
}
return new User(player);
}
/**
* Get an instance of User from a UUID
* @param uuid - UUID
* @return user - user
*/
public static User getInstance(UUID uuid) {
if (uuid == null) {
return null;
}
if (users.containsKey(uuid)) {
return users.get(uuid);
}
// Return player, or null if they are not online
return new User(uuid);
}
/**
* Removes this player from the User cache
* @param player - the player
*/
public static void removePlayer(Player player) {
users.remove(player.getUniqueId());
}
// ----------------------------------------------------
private static BSkyBlock plugin = BSkyBlock.getInstance();
private Player player;
private final UUID playerUUID;
private final CommandSender sender;
private User(CommandSender sender) {
player = null;
playerUUID = null;
this.sender = sender;
}
private User(Player player) {
this.player = player;
sender = player;
playerUUID = player.getUniqueId();
users.put(player.getUniqueId(), this);
}
private User(UUID playerUUID) {
player = Bukkit.getPlayer(playerUUID);
this.playerUUID = playerUUID;
sender = player;
}
/**
* Used for testing
* @param p - BSkyBlock plugin
*/
public static void setPlugin(BSkyBlock p) {
plugin = p;
}
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
return sender.getEffectivePermissions();
}
public PlayerInventory getInventory() {
return player != null ? player.getInventory() : null;
}
public Location getLocation() {
return player != null ? player.getLocation() : null;
}
public String getName() {
return player != null ? player.getName() : plugin.getPlayers().getName(playerUUID);
}
/**
* @return the player
*/
public Player getPlayer() {
return player;
}
/**
* @return true if this user is a player, false if not, e.g., console
*/
public boolean isPlayer() {
return player != null;
}
public CommandSender getSender() {
return sender;
}
public UUID getUniqueId() {
return playerUUID;
}
/**
* @param permission - permission string
* @return true if permission is empty or if the player has that permission
*/
public boolean hasPermission(String permission) {
return permission.isEmpty() || sender.hasPermission(permission);
}
public boolean isOnline() {
return player != null && player.isOnline();
}
/**
* Checks if user is Op
* @return true if user is Op
*/
public boolean isOp() {
if (sender != null) {
return sender.isOp();
}
if (playerUUID != null) {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
if (offlinePlayer != null) {
return offlinePlayer.isOp();
}
}
return false;
}
/**
* Gets a translation of this reference for this user.
* @param reference - reference found in a locale file
* @param variables - variables to insert into translated string. Variables go in pairs, for example
* "[name]", "tastybento"
* @return Translated string with colors converted, or the reference if nothing has been found
*/
public String getTranslation(String reference, String... variables) {
// Get translation
String translation = plugin.getLocalesManager().get(this, reference);
// If no translation has been found, return the reference for debug purposes.
if (translation == null) {
return reference;
}
// Then replace variables
if (variables.length > 1) {
for (int i = 0; i < variables.length; i += 2) {
translation = translation.replace(variables[i], variables[i+1]);
}
}
// Replace placeholders
translation = PlaceholderHandler.replacePlaceholders(this, translation);
return ChatColor.translateAlternateColorCodes('&', translation);
}
/**
* Gets a translation of this reference for this user.
* @param reference - reference found in a locale file
* @param variables - variables to insert into translated string. Variables go in pairs, for example
* "[name]", "tastybento"
* @return Translated string with colors converted, or a blank String if nothing has been found
*/
public String getTranslationOrNothing(String reference, String... variables) {
String translation = getTranslation(reference, variables);
return translation.equals(reference) ? "" : translation;
}
/**
* Send a message to sender if message is not empty.
* @param reference - language file reference
* @param variables - CharSequence target, replacement pairs
*/
public void sendMessage(String reference, String... variables) {
String message = getTranslation(reference, variables);
if (!ChatColor.stripColor(message).trim().isEmpty()) {
if (sender != null) {
sender.sendMessage(message);
} else {
// TODO: Offline message
// Save this message so the player can see it later
}
}
}
/**
* Sends a message to sender without any modification (colors, multi-lines, placeholders).
* @param message - the message to send
*/
public void sendRawMessage(String message) {
if (sender != null) {
sender.sendMessage(message);
} else {
// TODO: Offline message
// Save this message so the player can see it later
}
}
/**
* Sends a message to sender if message is not empty and if the same wasn't sent within the previous {@link Notifier#NOTIFICATION_DELAY} seconds.
* @param reference - language file reference
* @param variables - CharSequence target, replacement pairs
*
* @see Notifier
*/
public void notify(String reference, String... variables) {
String message = getTranslation(reference, variables);
if (!ChatColor.stripColor(message).trim().isEmpty() && sender != null) {
plugin.getNotifier().notify(this, message);
}
}
/**
* Sets the user's game mode
* @param mode - GameMode
*/
public void setGameMode(GameMode mode) {
player.setGameMode(mode);
}
/**
* Teleports user to this location. If the user is in a vehicle, they will exit first.
* @param location - the location
*/
public void teleport(Location location) {
player.teleport(location);
}
/**
* Gets the current world this entity resides in
* @return World
*/
public World getWorld() {
return player.getWorld();
}
/**
* Closes the user's inventory
*/
public void closeInventory() {
player.closeInventory();
}
/**
* Get the user's locale
* @return Locale
*/
public Locale getLocale() {
if (sender instanceof Player && !plugin.getPlayers().getLocale(playerUUID).isEmpty()) {
return Locale.forLanguageTag(plugin.getPlayers().getLocale(playerUUID));
}
return Locale.forLanguageTag(plugin.getSettings().getDefaultLanguage());
}
/**
* Forces an update of the user's complete inventory.
* Deprecated, but there is no current alternative.
*/
public void updateInventory() {
player.updateInventory();
}
/**
* Performs a command as the player
* @param cmd - command to execute
* @return true if the command was successful, otherwise false
*/
public boolean performCommand(String cmd) {
return player.performCommand(cmd);
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((playerUUID == null) ? 0 : playerUUID.hashCode());
return result;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof User)) {
return false;
}
User other = (User) obj;
if (playerUUID == null) {
return other.playerUUID == null;
} else return playerUUID.equals(other.playerUUID);
}
/**
* Checks if a user is in one of the game worlds
* @return true if user is, false if not
*/
public boolean inWorld() {
return plugin.getIWM().inWorld(getLocation());
}
}

View File

@ -0,0 +1,74 @@
package us.tastybento.bskyblock.commands;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.admin.AdminClearResetsAllCommand;
import us.tastybento.bskyblock.commands.admin.AdminClearResetsCommand;
import us.tastybento.bskyblock.commands.admin.AdminGetRankCommand;
import us.tastybento.bskyblock.commands.admin.AdminInfoCommand;
import us.tastybento.bskyblock.commands.admin.AdminRegisterCommand;
import us.tastybento.bskyblock.commands.admin.AdminReloadCommand;
import us.tastybento.bskyblock.commands.admin.AdminSchemCommand;
import us.tastybento.bskyblock.commands.admin.AdminSetRankCommand;
import us.tastybento.bskyblock.commands.admin.AdminTeleportCommand;
import us.tastybento.bskyblock.commands.admin.AdminUnregisterCommand;
import us.tastybento.bskyblock.commands.admin.AdminVersionCommand;
import us.tastybento.bskyblock.commands.admin.range.AdminRangeCommand;
import us.tastybento.bskyblock.commands.admin.team.AdminTeamAddCommand;
import us.tastybento.bskyblock.commands.admin.team.AdminTeamDisbandCommand;
import us.tastybento.bskyblock.commands.admin.team.AdminTeamKickCommand;
import us.tastybento.bskyblock.commands.admin.team.AdminTeamMakeLeaderCommand;
public class AdminCommand extends CompositeCommand {
public AdminCommand() {
super("bsbadmin", "bsb");
}
@Override
public void setup() {
setPermissionPrefix("bskyblock");
setPermission("admin.*");
setOnlyPlayer(false);
setParameters("commands.admin.help.parameters");
setDescription("commands.admin.help.description");
setWorld(getPlugin().getIWM().getBSBIslandWorld());
new AdminVersionCommand(this);
new AdminReloadCommand(this);
new AdminTeleportCommand(this, "tp");
new AdminTeleportCommand(this, "tpnether");
new AdminTeleportCommand(this, "tpend");
new AdminGetRankCommand(this);
new AdminSetRankCommand(this);
new AdminInfoCommand(this);
// Team commands
new AdminTeamAddCommand(this);
new AdminTeamKickCommand(this);
new AdminTeamDisbandCommand(this);
new AdminTeamMakeLeaderCommand(this);
// Schems
new AdminSchemCommand(this);
// Register/unregister islands
new AdminRegisterCommand(this);
new AdminUnregisterCommand(this);
// Range
new AdminRangeCommand(this);
// Resets
new AdminClearResetsCommand(this);
new AdminClearResetsAllCommand(this);
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (!args.isEmpty()) {
user.sendMessage("general.errors.unknown-command", TextVariables.LABEL, getTopLabel());
return false;
}
// By default run the attached help command, if it exists (it should)
return showHelp(this, user);
}
}

View File

@ -0,0 +1,78 @@
package us.tastybento.bskyblock.commands;
import java.util.ArrayList;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.commands.island.IslandAboutCommand;
import us.tastybento.bskyblock.commands.island.IslandBanCommand;
import us.tastybento.bskyblock.commands.island.IslandBanlistCommand;
import us.tastybento.bskyblock.commands.island.IslandCreateCommand;
import us.tastybento.bskyblock.commands.island.IslandGoCommand;
import us.tastybento.bskyblock.commands.island.IslandLanguageCommand;
import us.tastybento.bskyblock.commands.island.IslandResetCommand;
import us.tastybento.bskyblock.commands.island.IslandResetnameCommand;
import us.tastybento.bskyblock.commands.island.IslandSethomeCommand;
import us.tastybento.bskyblock.commands.island.IslandSetnameCommand;
import us.tastybento.bskyblock.commands.island.IslandSettingsCommand;
import us.tastybento.bskyblock.commands.island.IslandUnbanCommand;
import us.tastybento.bskyblock.commands.island.team.IslandTeamCommand;
public class IslandCommand extends CompositeCommand {
public IslandCommand() {
super("island", "is");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup()
*/
@Override
public void setup() {
setDescription("commands.island.help.description");
setOnlyPlayer(true);
// Permission
setPermissionPrefix("bskyblock");
setPermission("island");
setWorld(getPlugin().getIWM().getBSBIslandWorld());
// Set up subcommands
new IslandAboutCommand(this);
new IslandCreateCommand(this);
new IslandGoCommand(this);
new IslandResetCommand(this);
new IslandSetnameCommand(this);
new IslandResetnameCommand(this);
new IslandSethomeCommand(this);
new IslandSettingsCommand(this);
new IslandLanguageCommand(this);
new IslandBanCommand(this);
new IslandUnbanCommand(this);
new IslandBanlistCommand(this);
// Team commands
new IslandTeamCommand(this);
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
*/
@Override
public boolean execute(User user, String label, List<String> args) {
if (user == null) {
return false;
}
if (args.isEmpty()) {
// If user has an island, go
if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) != null) {
return getSubCommand("go").map(goCmd -> goCmd.execute(user, goCmd.getLabel(), new ArrayList<>())).orElse(false);
}
// No islands currently
return getSubCommand("create").map(createCmd -> createCmd.execute(user, createCmd.getLabel(), new ArrayList<>())).orElse(false);
}
user.sendMessage("general.errors.unknown-command", TextVariables.LABEL, getTopLabel());
return false;
}
}

View File

@ -0,0 +1,40 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.List;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
public class AdminClearResetsAllCommand extends CompositeCommand {
public AdminClearResetsAllCommand(CompositeCommand parent) {
super(parent, "clearresetsall");
}
@Override
public void setup() {
setPermission("admin.clearresetsall");
setDescription("commands.admin.clearresetsall.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// If args are not right, show help
if (!args.isEmpty()) {
showHelp(this, user);
return false;
}
this.askConfirmation(user, () -> {
// Set the reset epoch to now
getIWM().setResetEpoch(getWorld());
// Reset all current players
Bukkit.getOnlinePlayers().stream().map(Player::getUniqueId).filter(getPlayers()::isKnown).forEach(u -> getPlayers().setResets(getWorld(), u, 0));
user.sendMessage("general.success");
});
return false;
}
}

View File

@ -0,0 +1,59 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
public class AdminClearResetsCommand extends CompositeCommand {
public AdminClearResetsCommand(CompositeCommand parent) {
super(parent, "clearresets");
}
@Override
public void setup() {
setPermission("admin.clearreset");
setParameters("commands.admin.clearresets.parameters");
setDescription("commands.admin.clearresets.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// If args are not right, show help
if (args.size() != 1) {
showHelp(this, user);
return false;
}
// Get target
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
// Clear resets
user.sendMessage("commands.admin.clearresets.cleared");
getPlayers().setResets(getWorld(), targetUUID, 0);
user.sendMessage("general.success");
return true;
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
if (args.isEmpty()) {
// Don't show every player on the server. Require at least the first letter
return Optional.empty();
}
List<String> options = new ArrayList<>(Util.getOnlinePlayerList(user));
return Optional.of(Util.tabLimit(options, lastArg));
}
}

View File

@ -0,0 +1,71 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.RanksManager;
/**
* @author tastybento
*
*/
public class AdminGetRankCommand extends CompositeCommand {
public AdminGetRankCommand(CompositeCommand adminCommand) {
super(adminCommand, "getrank");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.BSBCommand#setup()
*/
@Override
public void setup() {
setPermission("admin.setrank");
setOnlyPlayer(false);
setParameters("commands.admin.getrank.parameters");
setDescription("commands.admin.getrank.description");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)
*/
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.size() != 1) {
// Show help
showHelp(this, user);
return false;
}
// Get target player
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
// Get rank
RanksManager rm = getPlugin().getRanksManager();
User target = User.getInstance(targetUUID);
Island island = getIslands().getIsland(getWorld(), targetUUID);
int currentRank = island.getRank(target);
user.sendMessage("commands.admin.getrank.rank-is", TextVariables.RANK, user.getTranslation(rm.getRank(currentRank)));
return true;
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
return Optional.of(Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()));
}
}

View File

@ -0,0 +1,52 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
public class AdminInfoCommand extends CompositeCommand {
public AdminInfoCommand(CompositeCommand parent) {
super(parent, "info");
}
@Override
public void setup() {
setPermission("admin.info");
setOnlyPlayer(false);
setParameters("commands.admin.info.parameters");
setDescription("commands.admin.info.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.size() > 1 || (args.isEmpty() && !user.isPlayer())) {
// Show help
showHelp(this, user);
return false;
}
// If there are no args, then the player wants info on the island at this location
if (args.isEmpty()) {
if (!getIslands().getIslandAt(user.getLocation()).map(i -> i.showInfo(getPlugin(), user, getWorld())).orElse(false)) {
user.sendMessage("commands.admin.info.no-island");
return false;
}
return true;
}
// Get target player
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
// Show info for this player
getIslands().getIsland(getWorld(), targetUUID).showInfo(getPlugin(), user, getWorld());
return true;
}
}

View File

@ -0,0 +1,106 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.util.Util;
public class AdminRegisterCommand extends CompositeCommand {
public AdminRegisterCommand(CompositeCommand parent) {
super(parent, "register");
}
@Override
public void setup() {
setPermission("admin.register");
setOnlyPlayer(true);
setParameters("commands.admin.register.parameters");
setDescription("commands.admin.register.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// If args are not right, show help
if (args.size() != 1) {
showHelp(this, user);
return false;
}
// Get target
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-island");
return false;
}
if (getIslands().inTeam(getWorld(), targetUUID)) {
user.sendMessage("commands.admin.register.cannot-register-team-player");
return false;
}
// Check if island is owned
Optional<Island> island = getIslands().getIslandAt(user.getLocation());
if (island.map(i -> i.getOwner() != null).orElse(false)) {
user.sendMessage("commands.admin.register.already-owned");
return false;
}
// Register island if it exists
if (!island.map(i -> {
// Island exists
getIslands().makeLeader(user, targetUUID, i, getPermissionPrefix());
user.sendMessage("commands.admin.register.registered-island", "[xyz]", Util.xyz(i.getCenter().toVector()));
user.sendMessage("general.success");
return true;
}).orElse(false)) {
// Island does not exist
user.sendMessage("commands.admin.register.no-island-here");
this.askConfirmation(user, () -> {
// Make island here
Island i = getIslands().createIsland(getClosestIsland(user.getLocation()), targetUUID);
getIslands().makeLeader(user, targetUUID, i, getPermissionPrefix());
getWorld().getBlockAt(i.getCenter()).setType(Material.BEDROCK);
user.sendMessage("commands.admin.register.registered-island", "[xyz]", Util.xyz(i.getCenter().toVector()));
user.sendMessage("general.success");
});
return false;
}
return true;
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
if (args.isEmpty()) {
// Don't show every player on the server. Require at least the first letter
return Optional.empty();
}
List<String> options = new ArrayList<>(Util.getOnlinePlayerList(user));
return Optional.of(Util.tabLimit(options, lastArg));
}
/**
* This returns the coordinate of where an island should be on the grid.
*
* @param location - location to check
* @return Location of where an island should be on a grid in this world
*/
public Location getClosestIsland(Location location) {
int dist = getIWM().getIslandDistance(getWorld()) * 2;
long x = Math.round((double) location.getBlockX() / dist) * dist + getIWM().getIslandXOffset(getWorld());
long z = Math.round((double) location.getBlockZ() / dist) * dist + getIWM().getIslandZOffset(getWorld());
long y = getIWM().getIslandHeight(getWorld());
return new Location(location.getWorld(), x, y, z);
}
}

View File

@ -0,0 +1,37 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
/**
* @author tastybento
*
*/
public class AdminReloadCommand extends CompositeCommand {
/**
* @param parent - parent command
*/
public AdminReloadCommand(CompositeCommand parent) {
super(parent, "reload", "rl");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.BSBCommand#setup()
*/
@Override
public void setup() {
setDescription("commands.admin.reload.description");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)
*/
@Override
public boolean execute(User user, String label, List<String> args) {
return true;
}
}

View File

@ -0,0 +1,141 @@
package us.tastybento.bskyblock.commands.admin;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.island.builders.Clipboard;
import us.tastybento.bskyblock.util.Util;
public class AdminSchemCommand extends CompositeCommand {
private Map<UUID, Clipboard> clipboards;
public AdminSchemCommand(CompositeCommand parent) {
super(parent, "schem");
}
@Override
public void setup() {
setPermission("admin.schem");
setParameters("commands.admin.schem.parameters");
setDescription("commands.admin.schem.description");
setOnlyPlayer(true);
clipboards = new HashMap<>();
}
@Override
@SuppressWarnings("deprecation")
public boolean execute(User user, String label, List<String> args) {
if (args.isEmpty()) {
showHelp(this, user);
return false;
}
File schemFolder = new File(getIWM().getDataFolder(getWorld()), "schems");
Clipboard cb = clipboards.getOrDefault(user.getUniqueId(), new Clipboard(getPlugin(), schemFolder));
if (args.get(0).equalsIgnoreCase("paste")) {
if (cb.isFull()) {
cb.paste(user.getLocation());
user.sendMessage("general.success");
return true;
} else {
user.sendMessage("commands.admin.schem.copy-first");
return false;
}
}
if (args.get(0).equalsIgnoreCase("load")) {
if (args.size() == 2) {
if (cb.load(user, args.get(1))) {
clipboards.put(user.getUniqueId(), cb);
return true;
}
} else {
showHelp(this, user);
return false;
}
return false;
}
if (args.get(0).equalsIgnoreCase("origin")) {
if (cb.getPos1() == null || cb.getPos2() == null) {
user.sendMessage("commands.admin.schem.need-pos1-pos2");
return false;
}
// Get the block player is looking at
Block b = user.getPlayer().getLineOfSight(null, 20).stream().filter(x -> !x.getType().equals(Material.AIR)).findFirst().orElse(null);
if (b != null) {
cb.setOrigin(b.getLocation());
user.getPlayer().sendBlockChange(b.getLocation(), Material.STAINED_GLASS,(byte)14);
Bukkit.getScheduler().runTaskLater(getPlugin(),
() -> user.getPlayer().sendBlockChange(b.getLocation(), b.getType(), b.getData()), 20L);
user.sendMessage("general.success");
return true;
} else {
user.sendMessage("commands.admin.schem.look-at-a-block");
return false;
}
}
if (args.get(0).equalsIgnoreCase("copy")) {
boolean copyAir = (args.size() == 2 && args.get(1).equalsIgnoreCase("air"));
return cb.copy(user, copyAir);
}
if (args.get(0).equalsIgnoreCase("save")) {
if (cb.isFull()) {
if (args.size() == 2) {
// Check if file exists
File newFile = new File(schemFolder, args.get(1) + ".schem");
if (newFile.exists()) {
user.sendMessage("commands.admin.schem.file-exists");
this.askConfirmation(user, () -> cb.save(user, args.get(1)));
return false;
} else {
return cb.save(user, args.get(1));
}
} else {
showHelp(this, user);
return false;
}
} else {
user.sendMessage("commands.admin.schem.copy-first");
return false;
}
}
if (args.get(0).equalsIgnoreCase("pos1")) {
if (user.getLocation().equals(cb.getPos2())) {
user.sendMessage("commands.admin.schem.set-different-pos");
return false;
}
cb.setPos1(user.getLocation());
user.sendMessage("commands.admin.schem.set-pos1", "[vector]", Util.xyz(user.getLocation().toVector()));
clipboards.put(user.getUniqueId(), cb);
return true;
}
if (args.get(0).equalsIgnoreCase("pos2")) {
if (user.getLocation().equals(cb.getPos1())) {
user.sendMessage("commands.admin.schem.set-different-pos");
return false;
}
cb.setPos2(user.getLocation());
user.sendMessage("commands.admin.schem.set-pos2", "[vector]", Util.xyz(user.getLocation().toVector()));
clipboards.put(user.getUniqueId(), cb);
return true;
}
return false;
}
}

View File

@ -0,0 +1,77 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.RanksManager;
/**
* @author tastybento
*
*/
public class AdminSetRankCommand extends CompositeCommand {
public AdminSetRankCommand(CompositeCommand adminCommand) {
super(adminCommand, "setrank");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.BSBCommand#setup()
*/
@Override
public void setup() {
setPermission("admin.setrank");
setOnlyPlayer(false);
setParameters("commands.admin.setrank.parameters");
setDescription("commands.admin.setrank.description");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.BSBCommand#execute(us.tastybento.bskyblock.api.user.User, java.util.List)
*/
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.size() != 2) {
// Show help
showHelp(this, user);
return false;
}
// Get target player
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getPlugin().getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
// Get rank
RanksManager rm = getPlugin().getRanksManager();
int rankValue = rm.getRanks().entrySet().stream()
.filter(r -> user.getTranslation(r.getKey()).equalsIgnoreCase(args.get(1))).findFirst()
.map(Map.Entry::getValue).orElse(-999);
if (rankValue < RanksManager.BANNED_RANK) {
user.sendMessage("commands.admin.setrank.unknown-rank");
return false;
}
User target = User.getInstance(targetUUID);
Island island = getPlugin().getIslands().getIsland(getWorld(), targetUUID);
int currentRank = island.getRank(target);
island.setRank(target, rankValue);
user.sendMessage("commands.admin.setrank.rank-set", "[from]", user.getTranslation(rm.getRank(currentRank)), "[to]", user.getTranslation(rm.getRank(rankValue)));
return true;
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
return Optional.of(getPlugin().getRanksManager().getRanks().keySet().stream().map(user::getTranslation).collect(Collectors.toList()));
}
}

View File

@ -0,0 +1,75 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Location;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
import us.tastybento.bskyblock.util.teleport.SafeTeleportBuilder;
public class AdminTeleportCommand extends CompositeCommand {
public AdminTeleportCommand(CompositeCommand parent, String tpCommand) {
super(parent, tpCommand);
}
@Override
public void setup() {
// Permission
setPermission(getPermissionPrefix() + "admin.tp");
setOnlyPlayer(true);
setParameters("commands.admin.tp.parameters");
setDescription("commands.admin.tp.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.isEmpty()) {
this.showHelp(this, user);
return true;
}
// Convert name to a UUID
final UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
} else {
if (getIslands().hasIsland(getWorld(), targetUUID) || getIslands().inTeam(getWorld(), targetUUID)) {
Location warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getWorld());
if (getLabel().equals("tpnether")) {
warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getPlugin().getIWM().getNetherWorld(getWorld()));
} else if (getLabel().equals("tpend")) {
warpSpot = getIslands().getIslandLocation(getWorld(), targetUUID).toVector().toLocation(getPlugin().getIWM().getEndWorld(getWorld()));
}
// Other wise, go to a safe spot
String failureMessage = user.getTranslation("commands.admin.tp.manual", "[location]", warpSpot.getBlockX() + " " + warpSpot.getBlockY() + " "
+ warpSpot.getBlockZ());
new SafeTeleportBuilder(getPlugin()).entity(user.getPlayer())
.location(warpSpot)
.failureMessage(failureMessage)
.build();
return true;
}
user.sendMessage("general.errors.player-has-no-island");
return false;
}
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
if (args.isEmpty()) {
// Don't show every player on the server. Require at least the first letter
return Optional.empty();
}
List<String> options = new ArrayList<>(Util.getOnlinePlayerList(user));
return Optional.of(Util.tabLimit(options, lastArg));
}
}

View File

@ -0,0 +1,64 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
public class AdminUnregisterCommand extends CompositeCommand {
public AdminUnregisterCommand(CompositeCommand parent) {
super(parent, "unregister");
}
@Override
public void setup() {
setPermission("admin.unregister");
setParameters("commands.admin.unregister.parameters");
setDescription("commands.admin.unregister.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// If args are not right, show help
if (args.size() != 1) {
showHelp(this, user);
return false;
}
// Get target
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
if (getIslands().inTeam(getWorld(), targetUUID)) {
user.sendMessage("commands.admin.unregister.cannot-unregister-team-player");
return false;
}
// Unregister island
user.sendMessage("commands.admin.unregister.unregistered-island", "[xyz]", Util.xyz(getIslands().getIsland(getWorld(), targetUUID).getCenter().toVector()));
getIslands().removePlayer(getWorld(), targetUUID);
getPlayers().clearHomeLocations(getWorld(), targetUUID);
user.sendMessage("general.success");
return true;
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
if (args.isEmpty()) {
// Don't show every player on the server. Require at least the first letter
return Optional.empty();
}
List<String> options = new ArrayList<>(Util.getOnlinePlayerList(user));
return Optional.of(Util.tabLimit(options, lastArg));
}
}

View File

@ -0,0 +1,26 @@
package us.tastybento.bskyblock.commands.admin;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
public class AdminVersionCommand extends CompositeCommand {
public AdminVersionCommand(CompositeCommand adminCommand) {
super(adminCommand, "version", "v");
}
@Override
public void setup() {
// Permission
setPermission("admin.version");
setDescription("commands.admin.version.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
return false;
}
}

View File

@ -0,0 +1,32 @@
package us.tastybento.bskyblock.commands.admin.range;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
/**
* @author Poslovitch
*/
public class AdminRangeCommand extends CompositeCommand {
public AdminRangeCommand(CompositeCommand parent) {
super (parent, "range");
}
@Override
public void setup() {
setPermission("admin.range");
setDescription("commands.admin.range.description");
new AdminRangeDisplayCommand(this);
new AdminRangeSetCommand(this);
new AdminRangeResetCommand(this);
}
@Override
public boolean execute(User user, String label, List<String> args) {
showHelp(this, user);
return true;
}
}

View File

@ -0,0 +1,116 @@
package us.tastybento.bskyblock.commands.admin.range;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Particle;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
/**
* @author Poslovitch
*/
public class AdminRangeDisplayCommand extends CompositeCommand {
private Map<User, Integer> display = new HashMap<>();
public AdminRangeDisplayCommand(CompositeCommand parent) {
super(parent, "display", "show", "hide");
}
@Override
public void setup() {
setPermission("admin.range.display");
setDescription("commands.admin.range.display.description");
setOnlyPlayer(true);
}
@Override
public boolean execute(User user, String label, List<String> args) {
// According to the label used to execute the command, there is a different behaviour
// - display : toggle on/off
// - show : only set on - and send "error" if already on
// - hide : only set off - same if already off
if (!display.containsKey(user)) {
switch (label) {
case "display":
case "show":
showZones(user);
break;
case "hide":
user.sendMessage("commands.admin.range.display.already-off");
break;
}
} else {
switch (label) {
case "display":
case "hide":
hideZones(user);
break;
case "show":
user.sendMessage("commands.admin.range.display.already-on");
break;
}
}
return true;
}
private void showZones(User user) {
user.sendMessage("commands.admin.range.display.showing");
user.sendMessage("commands.admin.range.display.hint");
display.put(user, Bukkit.getScheduler().scheduleSyncRepeatingTask(getPlugin(), () -> {
if (!user.getPlayer().isOnline()) {
hideZones(user);
}
getIslands().getIslandAt(user.getLocation()).ifPresent(island -> {
// Draw the island protected area
drawZone(user.getPlayer(), Particle.BARRIER, island.getCenter(), island.getProtectionRange());
// Draw the default protected area if island protected zone is different
if (island.getProtectionRange() != getPlugin().getSettings().getIslandProtectionRange()) {
drawZone(user.getPlayer(), Particle.VILLAGER_HAPPY, island.getCenter(), getPlugin().getSettings().getIslandProtectionRange());
}
// Draw the island area
drawZone(user.getPlayer(), Particle.TOWN_AURA, island.getCenter(), island.getRange());
});
}, 20, 30));
}
private void hideZones(User user) {
user.sendMessage("commands.admin.range.display.hiding");
Bukkit.getScheduler().cancelTask(display.get(user));
display.remove(user);
}
private void drawZone(Player player, Particle particle, Location center, int range) {
// Get player Y coordinate
int playerY = player.getLocation().getBlockY() + 1;
// Draw 3 "stages" (one line below, at and above player's y coordinate)
for (int stage = -1 ; stage <= 1 ; stage++) {
for (int i = -range ; i <= range ; i++) {
spawnParticle(player, particle, center.getBlockX() + i, playerY + stage, center.getBlockZ() + range);
spawnParticle(player, particle, center.getBlockX() + i, playerY + stage, center.getBlockZ() - range);
spawnParticle(player, particle, center.getBlockX() + range, playerY + stage, center.getBlockZ() + i);
spawnParticle(player, particle, center.getBlockX() - range, playerY + stage, center.getBlockZ() + i);
}
}
}
private void spawnParticle(Player player, Particle particle, int x, int y, int z) {
// Check if this particle is beyond the viewing distance of the server
if (player.getLocation().toVector().distanceSquared(new Vector(x,y,z)) < (Bukkit.getServer().getViewDistance()*256*Bukkit.getServer().getViewDistance())) {
player.spawnParticle(particle, x, y, z, 1);
}
}
}

View File

@ -0,0 +1,53 @@
package us.tastybento.bskyblock.commands.admin.range;
import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
public class AdminRangeResetCommand extends CompositeCommand {
public AdminRangeResetCommand(CompositeCommand parent) {
super(parent, "reset");
}
@Override
public void setup() {
setPermission("admin.range.reset");
setParameters("commands.admin.range.reset.parameters");
setDescription("commands.admin.range.reset.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.size() != 1) {
// Show help
showHelp(this, user);
return false;
}
// Get target player
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getPlugin().getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
// Get island
Island island = getIslands().getIsland(getWorld(), targetUUID);
// Reset the protection range
int range = getIWM().getIslandProtectionRange(getWorld());
island.setProtectionRange(range);
user.sendMessage("commands.admin.range.reset.success", TextVariables.NUMBER, String.valueOf(range));
return true;
}
}

View File

@ -0,0 +1,75 @@
package us.tastybento.bskyblock.commands.admin.range;
import java.util.List;
import java.util.UUID;
import org.apache.commons.lang.StringUtils;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
public class AdminRangeSetCommand extends CompositeCommand {
public AdminRangeSetCommand(CompositeCommand parent) {
super(parent, "set");
}
@Override
public void setup() {
setPermission("admin.range.set");
setParameters("commands.admin.range.set.parameters");
setDescription("commands.admin.range.set.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.size() != 2) {
// Show help
showHelp(this, user);
return false;
}
// Get target player
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getPlugin().getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
// Get new range
if (!StringUtils.isNumeric(args.get(1))) {
user.sendMessage("commands.admin.range.set.invalid-value.not-numeric", TextVariables.NUMBER, args.get(1));
return false;
}
int range = Integer.valueOf(args.get(1));
// Get island
Island island = getIslands().getIsland(getWorld(), targetUUID);
// Do some sanity checks to make sure the new protection range won't cause problems
if (range <= 1) {
user.sendMessage("commands.admin.range.set.invalid-value.too-low", TextVariables.NUMBER, args.get(1));
return false;
}
if (range > island.getRange()) {
user.sendMessage("commands.admin.range.set.invalid-value.too-high", TextVariables.NUMBER, String.valueOf(island.getRange()));
return false;
}
if (range == island.getProtectionRange()) {
user.sendMessage("commands.admin.range.set.invalid-value.same-as-before", TextVariables.NUMBER, args.get(1));
return false;
}
// Well, now it can be applied without taking any risks !
island.setProtectionRange(range);
user.sendMessage("commands.admin.range.set.success", TextVariables.NUMBER, String.valueOf(range));
return true;
}
}

View File

@ -0,0 +1,70 @@
package us.tastybento.bskyblock.commands.admin.team;
import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
public class AdminTeamAddCommand extends CompositeCommand {
public AdminTeamAddCommand(CompositeCommand parent) {
super(parent, "add");
}
@Override
public void setup() {
setPermission("admin.team");
setParameters("commands.admin.team.add.parameters");
setDescription("commands.admin.team.add.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// If args are not right, show help
if (args.size() != 2) {
showHelp(this, user);
return false;
}
// Get leader and target
UUID leaderUUID = getPlayers().getUUID(args.get(0));
if (leaderUUID == null) {
user.sendMessage("general.errors.unknown-player-name", TextVariables.NAME, args.get(0));
return false;
}
UUID targetUUID = getPlayers().getUUID(args.get(1));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player-name", TextVariables.NAME, args.get(1));
return false;
}
if (!getIslands().hasIsland(getWorld(), leaderUUID)) {
user.sendMessage("general.errors.player-has-no-island");
return false;
}
if (getIslands().inTeam(getWorld(), leaderUUID) && !getIslands().getTeamLeader(getWorld(), leaderUUID).equals(leaderUUID)) {
user.sendMessage("commands.admin.team.add.name-not-leader", TextVariables.NAME, args.get(0));
getIslands().getIsland(getWorld(), leaderUUID).showMembers(getPlugin(), user, getWorld());
return false;
}
if (getIslands().inTeam(getWorld(), targetUUID)) {
user.sendMessage("commands.island.team.invite.errors.already-on-team");
return false;
}
if (getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("commands.admin.team.add.name-has-island", TextVariables.NAME, args.get(1));
return false;
}
// Success
User target = User.getInstance(targetUUID);
User leader = User.getInstance(leaderUUID);
leader.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, getPlugin().getPlayers().getName(targetUUID));
target.sendMessage("commands.island.team.invite.accept.you-joined-island", TextVariables.LABEL, getTopLabel());
getIslands().getIsland(getWorld(), leaderUUID).addMember(targetUUID);
user.sendMessage("general.success");
return true;
}
}

View File

@ -0,0 +1,58 @@
package us.tastybento.bskyblock.commands.admin.team;
import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
public class AdminTeamDisbandCommand extends CompositeCommand {
public AdminTeamDisbandCommand(CompositeCommand parent) {
super(parent, "disband");
}
@Override
public void setup() {
setPermission("admin.team");
setParameters("commands.admin.team.disband.parameters");
setDescription("commands.admin.team.disband.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// If args are not right, show help
if (args.size() != 1) {
showHelp(this, user);
return false;
}
// Get target
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getIslands().inTeam(getWorld(), targetUUID)) {
user.sendMessage("general.errors.not-in-team");
return false;
}
if (!getIslands().getTeamLeader(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.disband.use-disband-leader", "[leader]", getPlayers().getName(getIslands().getTeamLeader(getWorld(), targetUUID)));
return false;
}
// Disband team
getIslands().getMembers(getWorld(), targetUUID).forEach(m -> {
User.getInstance(m).sendMessage("commands.admin.team.disband.disbanded");
// The leader gets to keep the island
if (!m.equals(targetUUID)) {
getIslands().setLeaveTeam(getWorld(), m);
}
});
user.sendMessage("general.success");
return true;
}
}

View File

@ -0,0 +1,57 @@
package us.tastybento.bskyblock.commands.admin.team;
import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
public class AdminTeamKickCommand extends CompositeCommand {
public AdminTeamKickCommand(CompositeCommand parent) {
super(parent, "kick");
}
@Override
public void setup() {
setPermission("admin.team");
setParameters("commands.admin.team.kick.parameters");
setDescription("commands.admin.team.kick.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// If args are not right, show help
if (args.size() != 1) {
showHelp(this, user);
return false;
}
// Get target
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getIslands().inTeam(getWorld(), targetUUID)) {
user.sendMessage("general.errors.not-in-team");
return false;
}
if (getIslands().getTeamLeader(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.kick.cannot-kick-leader");
getIslands().getIsland(getWorld(), targetUUID).showMembers(getPlugin(), user, getWorld());
return false;
}
User.getInstance(targetUUID).sendMessage("commands.admin.team.kick.admin-kicked");
getIslands().removePlayer(getWorld(), targetUUID);
user.sendMessage("general.success");
return true;
}
}

View File

@ -0,0 +1,52 @@
package us.tastybento.bskyblock.commands.admin.team;
import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
public class AdminTeamMakeLeaderCommand extends CompositeCommand {
public AdminTeamMakeLeaderCommand(CompositeCommand parent) {
super(parent, "makeleader");
}
@Override
public void setup() {
setPermission("admin.team");
setParameters("commands.admin.team.makeleader.parameters");
setDescription("commands.admin.team.makeleader.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// If args are not right, show help
if (args.size() != 1) {
showHelp(this, user);
return false;
}
// Get target
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
if (!getIslands().hasIsland(getWorld(), targetUUID)) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getIslands().inTeam(getWorld(), targetUUID)) {
user.sendMessage("general.errors.not-in-team");
return false;
}
if (getIslands().getTeamLeader(getWorld(), targetUUID).equals(targetUUID)) {
user.sendMessage("commands.admin.team.makeleader.already-leader");
return false;
}
// Make new leader
getIslands().makeLeader(getWorld(), user, targetUUID, getPermissionPrefix());
user.sendMessage("general.success");
return true;
}
}

View File

@ -0,0 +1,59 @@
package us.tastybento.bskyblock.commands.island;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
/**
* This is a custom help for the /island go and /island sethome commands. It overrides the default help sub command.
* The number of homes can change depending on the player's permissions and config.yml settings.
* This is an example of a custom help as much as anything.
*
* @author tastybento
*
*/
public class CustomIslandMultiHomeHelp extends CompositeCommand {
public CustomIslandMultiHomeHelp(CompositeCommand parent) {
super(parent, "help");
}
@Override
public void setup() {
setOnlyPlayer(true);
// Inherit parameters from the respective parent class - in this case, only /island go and /island sethome
setParameters(parent.getParameters());
setDescription(parent.getDescription());
inheritPermission();
}
@Override
public boolean execute(User user, String label, List<String> args) {
// This will only be shown if it is for a player
if (user.isPlayer()) {
// Get elements
String usage = parent.getUsage().isEmpty() ? "" : user.getTranslation(parent.getUsage());
String params = "";
String desc = getDescription().isEmpty() ? "" : user.getTranslation(getDescription());
showPrettyHelp(user, usage, params, desc);
return true;
}
return false;
}
private void showPrettyHelp(User user, String usage, String params, String desc) {
// Player. Check perms
if (user.hasPermission(getPermission())) {
int maxHomes = Util.getPermValue(user.getPlayer(), getPermissionPrefix() + "island.maxhomes", getIWM().getMaxHomes(getWorld()));
if (maxHomes > 1) {
params = getParameters().isEmpty() ? "" : user.getTranslation(getParameters());
}
user.sendMessage("commands.help.syntax", "[usage]", usage, "[parameters]", params, "[description]", desc);
}
}
}

View File

@ -0,0 +1,50 @@
package us.tastybento.bskyblock.commands.island;
import java.util.List;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
public class IslandAboutCommand extends CompositeCommand {
/**
* About
* @param islandCommand - parent command
*/
public IslandAboutCommand(CompositeCommand islandCommand) {
super(islandCommand, "about", "ab");
}
@Override
public void setup() {
setDescription("commands.island.about.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
user.sendRawMessage("About " + BSkyBlock.getInstance().getDescription().getName() + " v" + BSkyBlock.getInstance().getDescription().getVersion() + ":");
user.sendRawMessage("Copyright (c) 2017 - 2018 Tastybento, Poslovitch");
user.sendRawMessage("All rights reserved.");
user.sendRawMessage("");
user.sendRawMessage("Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:");
user.sendRawMessage(" * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.");
user.sendRawMessage(" * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.");
user.sendRawMessage(" * Neither the name of the BSkyBlock Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.");
user.sendRawMessage("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" "
+ "AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE "
+ "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE "
+ "ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE "
+ "LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR "
+ "CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF "
+ "SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS "
+ "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN "
+ "CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) "
+ "ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE "
+ "POSSIBILITY OF SUCH DAMAGE.");
return true;
}
}

View File

@ -0,0 +1,109 @@
package us.tastybento.bskyblock.commands.island;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.util.Util;
public class IslandBanCommand extends CompositeCommand {
public IslandBanCommand(CompositeCommand islandCommand) {
super(islandCommand, "ban");
}
@Override
public void setup() {
setPermission("island.ban");
setOnlyPlayer(true);
setParameters("commands.island.ban.parameters");
setDescription("commands.island.ban.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.size() != 1) {
// Show help
showHelp(this, user);
return false;
}
UUID playerUUID = user.getUniqueId();
// Player issuing the command must have an island
if (!getIslands().hasIsland(getWorld(), playerUUID)) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getIslands().isOwner(getWorld(), playerUUID)) {
user.sendMessage("general.errors.not-leader");
return false;
}
// Get target player
UUID targetUUID = getPlayers().getUUID(args.get(0));
if (targetUUID == null) {
user.sendMessage("general.errors.unknown-player");
return false;
}
// Player cannot ban themselves
if (playerUUID.equals(targetUUID)) {
user.sendMessage("commands.island.ban.cannot-ban-yourself");
return false;
}
if (getIslands().getMembers(getWorld(), user.getUniqueId()).contains(targetUUID)) {
user.sendMessage("commands.island.ban.cannot-ban-member");
return false;
}
if (getIslands().getIsland(getWorld(), playerUUID).isBanned(targetUUID)) {
user.sendMessage("commands.island.ban.player-already-banned");
return false;
}
User target = User.getInstance(targetUUID);
// Cannot ban ops
if (target.isOp()) {
user.sendMessage("commands.island.ban.cannot-ban");
return false;
}
// Finished error checking - start the banning
return ban(user, target);
}
private boolean ban(User user, User targetUser) {
Island island = getIslands().getIsland(getWorld(), user.getUniqueId());
if (island.addToBanList(targetUser.getUniqueId())) {
user.sendMessage("general.success");
targetUser.sendMessage("commands.island.ban.owner-banned-you", TextVariables.NAME, user.getName());
// If the player is online, has an island and on the banned island, move them home immediately
if (targetUser.isOnline() && getIslands().hasIsland(getWorld(), targetUser.getUniqueId()) && island.onIsland(targetUser.getLocation())) {
getIslands().homeTeleport(getWorld(), targetUser.getPlayer());
island.getWorld().playSound(targetUser.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1F, 1F);
}
return true;
}
// Banning was blocked, maybe due to an event cancellation. Fail silently.
return false;
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
if (args.isEmpty()) {
// Don't show every player on the server. Require at least the first letter
return Optional.empty();
}
Island island = getIslands().getIsland(getWorld(), user.getUniqueId());
List<String> options = Bukkit.getOnlinePlayers().stream()
.filter(p -> !p.getUniqueId().equals(user.getUniqueId()))
.filter(p -> !island.isBanned(p.getUniqueId()))
.filter(p -> user.getPlayer().canSee(p))
.map(Player::getName).collect(Collectors.toList());
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
return Optional.of(Util.tabLimit(options, lastArg));
}
}

View File

@ -0,0 +1,70 @@
package us.tastybento.bskyblock.commands.island;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
public class IslandBanlistCommand extends CompositeCommand {
public IslandBanlistCommand(CompositeCommand islandCommand) {
super(islandCommand, "banlist");
}
@Override
public void setup() {
setPermission("island.ban");
setOnlyPlayer(true);
setDescription("commands.island.banlist.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (!args.isEmpty()) {
// Show help
showHelp(this, user);
return false;
}
// Player issuing the command must have an island
if (!getIslands().hasIsland(getWorld(), user.getUniqueId())) {
user.sendMessage("general.errors.no-island");
return false;
}
Island island = getIslands().getIsland(getWorld(), user.getUniqueId());
// Show all the players banned on the island
if (island.getBanned().isEmpty()) {
user.sendMessage("commands.island.banlist.noone");
return true;
}
// Title
user.sendMessage("commands.island.banlist.the-following");
// Create a nicely formatted list
List<String> names = island.getBanned().stream().map(u -> getPlayers().getName(u)).sorted().collect(Collectors.toList());
List<String> lines = new ArrayList<>();
StringBuilder line = new StringBuilder();
// Put the names into lines of no more than 40 characters long, separated by commas
names.forEach(n -> {
if (line.length() + n.length() < 41) {
line.append(n);
} else {
lines.add(line.toString().trim());
line.setLength(0);
line.append(n);
}
line.append(", ");
});
// Remove trailing comma
line.setLength(line.length() - 2);
// Add the final line if it is not empty
if (line.length() > 0) {
lines.add(line.toString());
}
// Send the strings
lines.forEach(l -> user.sendMessage("commands.island.banlist.names", "[line]", l));
return true;
}
}

View File

@ -0,0 +1,60 @@
package us.tastybento.bskyblock.commands.island;
import java.io.IOException;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.managers.island.NewIsland;
/**
* /island create - Create an island.
*
* @author Tastybento
*/
public class IslandCreateCommand extends CompositeCommand {
/**
* Command to create an island
* @param islandCommand - parent command
*/
public IslandCreateCommand(CompositeCommand islandCommand) {
super(islandCommand, "create");
}
@Override
public void setup() {
setPermission("island.create");
setOnlyPlayer(true);
setDescription("commands.island.create.description");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
*/
@Override
public boolean execute(User user, String label, List<String> args) {
if (getIslands().hasIsland(getWorld(), user.getUniqueId())) {
user.sendMessage("general.errors.already-have-island");
return false;
}
if (getIslands().inTeam(getWorld(), user.getUniqueId())) {
user.sendMessage("general.errors.already-have-island");
return false;
}
user.sendMessage("commands.island.create.creating-island");
try {
NewIsland.builder()
.player(user)
.world(getWorld())
.reason(Reason.CREATE)
.build();
return true;
} catch (IOException e) {
getPlugin().logError("Could not create island for player. " + e.getMessage());
user.sendMessage("commands.island.create.unable-create-island");
return false;
}
}
}

View File

@ -0,0 +1,54 @@
package us.tastybento.bskyblock.commands.island;
import java.util.List;
import org.apache.commons.lang.math.NumberUtils;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
/**
* @author tastybento
*/
public class IslandGoCommand extends CompositeCommand {
public IslandGoCommand(CompositeCommand islandCommand) {
super(islandCommand, "go", "home", "h");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup()
*/
@Override
public void setup() {
setPermission("island.home");
setOnlyPlayer(true);
setDescription("commands.island.go.description");
new CustomIslandMultiHomeHelp(this);
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
*/
@Override
public boolean execute(User user, String label, List<String> args) {
if (getIslands().getIsland(getWorld(), user.getUniqueId()) == null) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!args.isEmpty() && NumberUtils.isDigits(args.get(0))) {
int homeValue = Integer.valueOf(args.get(0));
int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getIWM().getMaxHomes(getWorld()));
if (homeValue > 1 && homeValue <= maxHomes) {
getIslands().homeTeleport(getWorld(), user.getPlayer(), homeValue);
user.sendMessage("commands.island.go.tip", TextVariables.LABEL, getTopLabel());
return true;
}
}
getIslands().homeTeleport(getWorld(), user.getPlayer());
return true;
}
}

View File

@ -0,0 +1,4 @@
package us.tastybento.bskyblock.commands.island;
public class IslandInfoCommand {
}

View File

@ -0,0 +1,36 @@
package us.tastybento.bskyblock.commands.island;
import java.util.List;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.panels.LanguagePanel;
/**
* @author Poslovitch
*/
public class IslandLanguageCommand extends CompositeCommand {
public IslandLanguageCommand(CompositeCommand islandCommand) {
super(islandCommand, "language", "lang");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup()
*/
@Override
public void setup() {
setPermission("island.language");
setOnlyPlayer(true);
setDescription("commands.island.language.description");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
*/
@Override
public boolean execute(User user, String label, List<String> args) {
LanguagePanel.openPanel(user);
return true;
}
}

View File

@ -0,0 +1,120 @@
package us.tastybento.bskyblock.commands.island;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.events.island.IslandEvent.Reason;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.database.objects.Island;
import us.tastybento.bskyblock.managers.island.NewIsland;
public class IslandResetCommand extends CompositeCommand {
private Map<UUID, Long> cooldown;
public IslandResetCommand(CompositeCommand islandCommand) {
super(islandCommand, "reset", "restart");
}
@Override
public void setup() {
cooldown = new HashMap<>();
setPermission("island.create");
setOnlyPlayer(true);
setDescription("commands.island.reset.description");
}
@Override
public boolean execute(User user, String label, List<String> args) {
// Check cooldown
if (getSettings().getResetWait() > 0 && onRestartWaitTime(user) > 0 && !user.isOp()) {
user.sendMessage("general.errors.you-must-wait", TextVariables.NUMBER, String.valueOf(onRestartWaitTime(user)));
return false;
}
if (!getIslands().hasIsland(getWorld(), user.getUniqueId())) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getIslands().isOwner(getWorld(), user.getUniqueId())) {
user.sendMessage("general.errors.not-leader");
return false;
}
if (getIslands().inTeam(getWorld(), user.getUniqueId())) {
user.sendMessage("commands.island.reset.must-remove-members");
return false;
}
if (getIWM().getResetLimit(getWorld()) >= 0 ) {
int resetsLeft = getIWM().getResetLimit(getWorld()) - getPlayers().getResets(getWorld(), user.getUniqueId());
if (resetsLeft <= 0) {
user.sendMessage("commands.island.reset.none-left");
return false;
} else {
// Notify how many resets are left
user.sendMessage("commands.island.reset.resets-left", TextVariables.NUMBER, String.valueOf(resetsLeft));
}
}
// Request confirmation
if (getSettings().isResetConfirmation()) {
this.askConfirmation(user, () -> resetIsland(user));
return true;
} else {
return resetIsland(user);
}
}
private boolean resetIsland(User user) {
// Reset the island
Player player = user.getPlayer();
player.setGameMode(GameMode.SPECTATOR);
// Get the player's old island
Island oldIsland = getIslands().getIsland(getWorld(), player.getUniqueId());
// Remove them from this island (it still exists and will be deleted later)
getIslands().removePlayer(getWorld(), player.getUniqueId());
// Remove money inventory etc.
if (getIWM().isOnLeaveResetEnderChest(getWorld())) {
user.getPlayer().getEnderChest().clear();
}
if (getIWM().isOnLeaveResetInventory(getWorld())) {
user.getPlayer().getInventory().clear();
}
if (getSettings().isUseEconomy() && getIWM().isOnLeaveResetMoney(getWorld())) {
// TODO: needs Vault
}
// Add a reset
getPlayers().addReset(getWorld(), user.getUniqueId());
// Create new island and then delete the old one
try {
NewIsland.builder()
.player(user)
.reason(Reason.RESET)
.oldIsland(oldIsland)
.build();
} catch (IOException e) {
getPlugin().logError("Could not create island for player. " + e.getMessage());
user.sendMessage("commands.island.create.unable-create-island");
return false;
}
setCooldown(user);
return true;
}
private int onRestartWaitTime(User user) {
if (!cooldown.containsKey(user.getUniqueId())) {
return 0;
}
return (int) (System.currentTimeMillis() - cooldown.get(user.getUniqueId()) / 1000);
}
private void setCooldown(User user) {
cooldown.put(user.getUniqueId(), System.currentTimeMillis() + (getSettings().getResetLimit() * 1000L));
}
}

View File

@ -0,0 +1,49 @@
package us.tastybento.bskyblock.commands.island;
import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.user.User;
/**
* @author tastybento
*
*/
public class IslandResetnameCommand extends CompositeCommand {
public IslandResetnameCommand(CompositeCommand islandCommand) {
super(islandCommand, "resetname");
}
@Override
public void setup() {
setPermission("island.name");
setOnlyPlayer(true);
setDescription("commands.island.resetname.description");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
*/
@Override
public boolean execute(User user, String label, List<String> args) {
UUID playerUUID = user.getUniqueId();
if (!getIslands().hasIsland(getWorld(), playerUUID)) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getIslands().isOwner(getWorld(), playerUUID)) {
user.sendMessage("general.errors.not-leader");
return false;
}
// Resets the island name
getIslands().getIsland(getWorld(), playerUUID).setName(null);
user.sendMessage("general.success");
return true;
}
}

View File

@ -0,0 +1,68 @@
package us.tastybento.bskyblock.commands.island;
import java.util.List;
import java.util.UUID;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
import us.tastybento.bskyblock.util.Util;
public class IslandSethomeCommand extends CompositeCommand {
public IslandSethomeCommand(CompositeCommand islandCommand) {
super(islandCommand, "sethome");
}
@Override
public void setup() {
setPermission("island.sethome");
setOnlyPlayer(true);
setDescription("commands.island.sethome.description");
new CustomIslandMultiHomeHelp(this);
}
@Override
public boolean execute(User user, String label, List<String> args) {
UUID playerUUID = user.getUniqueId();
// Check island
if (getPlugin().getIslands().getIsland(getWorld(), user.getUniqueId()) == null) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getPlugin().getIslands().userIsOnIsland(getWorld(), user)) {
user.sendMessage("commands.island.sethome.must-be-on-your-island");
return false;
}
if (args.isEmpty()) {
// island sethome
getPlugin().getPlayers().setHomeLocation(playerUUID, user.getLocation());
user.sendMessage("commands.island.sethome.home-set");
} else {
// Dynamic home sizes with permissions
int maxHomes = Util.getPermValue(user.getPlayer(), "island.maxhomes", getSettings().getMaxHomes());
if (maxHomes > 1) {
// Check the number given is a number
int number;
try {
number = Integer.valueOf(args.get(0));
if (number < 1 || number > maxHomes) {
user.sendMessage("commands.island.sethome.num-homes", TextVariables.NUMBER, String.valueOf(maxHomes));
return false;
} else {
getPlugin().getPlayers().setHomeLocation(user, user.getLocation(), number);
user.sendMessage("commands.island.sethome.home-set");
}
} catch (Exception e) {
user.sendMessage("commands.island.sethome.num-homes", TextVariables.NUMBER, String.valueOf(maxHomes));
return false;
}
} else {
user.sendMessage("general.errors.no-permission");
return false;
}
}
return true;
}
}

View File

@ -0,0 +1,77 @@
package us.tastybento.bskyblock.commands.island;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.ChatColor;
import us.tastybento.bskyblock.api.commands.CompositeCommand;
import us.tastybento.bskyblock.api.localization.TextVariables;
import us.tastybento.bskyblock.api.user.User;
/**
* @author tastybento
*
*/
public class IslandSetnameCommand extends CompositeCommand {
public IslandSetnameCommand(CompositeCommand islandCommand) {
super(islandCommand, "setname");
}
@Override
public void setup() {
setPermission("island.name");
setOnlyPlayer(true);
setParameters("commands.island.setname.parameters");
setDescription("commands.island.setname.description");
}
/* (non-Javadoc)
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
*/
@Override
public boolean execute(User user, String label, List<String> args) {
UUID playerUUID = user.getUniqueId();
if (!getIslands().hasIsland(getWorld(), playerUUID)) {
user.sendMessage("general.errors.no-island");
return false;
}
if (!getIslands().isOwner(getWorld(), playerUUID)) {
user.sendMessage("general.errors.not-leader");
return false;
}
// Explain command
if (args.isEmpty()) {
showHelp(this, user);
return false;
}
// Naming the island - join all the arguments with spaces.
String name = args.stream().collect(Collectors.joining( " " ));
// Check if the name isn't too short or too long
if (name.length() < getSettings().getNameMinLength()) {
user.sendMessage("commands.island.setname.too-short", TextVariables.NUMBER, String.valueOf(getSettings().getNameMinLength()));
return false;
}
if (name.length() > getSettings().getNameMaxLength()) {
user.sendMessage("commands.island.setname.too-long", TextVariables.NUMBER, String.valueOf(getSettings().getNameMaxLength()));
return false;
}
// Set the name
if (user.isOp() || user.hasPermission(this.getPermissionPrefix() + ".island.name.format")) {
getIslands().getIsland(getWorld(), playerUUID).setName(ChatColor.translateAlternateColorCodes('&', name));
} else {
getIslands().getIsland(getWorld(), playerUUID).setName(name);
}
user.sendMessage("general.success");
return true;
}
}

Some files were not shown because too many files have changed in this diff Show More