Merge remote-tracking branch 'origin/develop'

This commit is contained in:
tastybento 2019-03-28 20:55:09 -07:00
commit aeb5a60e94
14 changed files with 483 additions and 169 deletions

25
pom.xml
View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<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>world.bentobox</groupId>
<artifactId>WelcomeWarpSigns</artifactId>
<version>0.1.0-SNAPSHOT</version>
<artifactId>warps</artifactId>
<version>1.4.0</version>
<name>WelcomeWarpSigns</name>
<description>WelcomeWarpSigns is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like ASkyBlock or AcidIsland.</description>
@ -51,13 +52,21 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
</repository>
<repository>
<id>codemc</id>
<url>https://repo.codemc.org/repository/maven-snapshots/</url>
</repository>
<repository>
<id>codemc-public</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.13-R0.1-SNAPSHOT</version>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
@ -86,12 +95,12 @@
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>bentobox</artifactId>
<version>0.12.0-SNAPSHOT</version>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>world.bentobox</groupId>
<artifactId>Level</artifactId>
<version>0.1.0-SNAPSHOT</version>
<artifactId>level</artifactId>
<version>1.4.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
@ -218,7 +227,7 @@
<id>sonar</id>
<properties>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>tastybento-github</sonar.organization>
<sonar.organization>bentobox-world</sonar.organization>
</properties>
<build>
<plugins>

View File

@ -1,19 +1,18 @@
package world.bentobox.warps;
import org.bukkit.World;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.World;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.configuration.Config;
import world.bentobox.bentobox.util.Util;
import world.bentobox.level.Level;
import world.bentobox.warps.commands.WarpCommand;
import world.bentobox.warps.commands.WarpsCommand;
import world.bentobox.warps.config.PluginConfig;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.addons.Addon;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.util.Util;
import world.bentobox.warps.config.Settings;
/**
* Addin to BSkyBlock that enables welcome warp signs
@ -21,65 +20,113 @@ import world.bentobox.bentobox.util.Util;
*
*/
public class Warp extends Addon {
// ---------------------------------------------------------------------
// Section: Variables
// ---------------------------------------------------------------------
private static final String BSKYBLOCK = "BSkyBlock";
private static final String ACIDISLAND = "AcidIsland";
/**
* This variable stores string for Level addon.
*/
private static final String LEVEL_ADDON_NAME = "Level";
// The plugin instance.
private BentoBox plugin;
// Warp panel objects
/**
* Warp panel Manager
*/
private WarpPanelManager warpPanelManager;
// Warps signs objects
/**
* Worlds Sign manager.
*/
private WarpSignsManager warpSignsManager;
/**
* This variable stores in which worlds this addon is working.
*/
private Set<World> registeredWorlds;
private PluginConfig settings;
/**
* This variable stores if addon settings.
*/
private Settings settings;
/**
* This variable stores if addon is hooked or not.
*/
private boolean hooked;
// ---------------------------------------------------------------------
// Section: Methods
// ---------------------------------------------------------------------
/**
* Executes code when loading the addon. This is called before {@link #onEnable()}. This should preferably
* be used to setup configuration and worlds.
*/
@Override
public void onLoad()
{
super.onLoad();
// Save default config.yml
this.saveDefaultConfig();
// Load the plugin's config
this.loadSettings();
}
/**
* Executes code when reloading the addon.
*/
@Override
public void onReload()
{
super.onReload();
if (this.hooked) {
this.warpSignsManager.saveWarpList();
this.loadSettings();
this.getLogger().info("WelcomeWarp addon reloaded.");
}
}
@Override
public void onEnable() {
// Load the plugin's config
settings = new PluginConfig(this);
// Get the BSkyBlock plugin. This will be available because this plugin depends on it in plugin.yml.
plugin = this.getPlugin();
// Check if it is enabled - it might be loaded, but not enabled.
if (!plugin.isEnabled()) {
if (!this.getPlugin().isEnabled()) {
this.setState(State.DISABLED);
return;
}
registeredWorlds = new HashSet<>();
// Start warp signs
warpSignsManager = new WarpSignsManager(this, plugin);
warpPanelManager = new WarpPanelManager(this);
// Load the listener
getServer().getPluginManager().registerEvents(new WarpSignsListener(this), plugin);
// Register commands
this.getPlugin().getAddonsManager().getGameModeAddons().forEach(gameModeAddon -> {
if (!this.settings.getDisabledGameModes().contains(gameModeAddon.getDescription().getName()))
{
if (gameModeAddon.getPlayerCommand().isPresent())
{
this.registeredWorlds.add(gameModeAddon.getOverWorld());
// BSkyBlock hook in
this.getPlugin().getAddonsManager().getAddonByName(BSKYBLOCK).ifPresent(acidIsland -> {
CompositeCommand bsbIslandCmd = BentoBox.getInstance().getCommandsManager().getCommand("island");
if (bsbIslandCmd != null) {
new WarpCommand(this, bsbIslandCmd);
new WarpsCommand(this, bsbIslandCmd);
registeredWorlds.add(bsbIslandCmd.getWorld());
}
});
// AcidIsland hook in
this.getPlugin().getAddonsManager().getAddonByName(ACIDISLAND).ifPresent(acidIsland -> {
CompositeCommand acidIslandCmd = getPlugin().getCommandsManager().getCommand("ai");
if (acidIslandCmd != null) {
new WarpCommand(this, acidIslandCmd);
new WarpsCommand(this, acidIslandCmd);
registeredWorlds.add(acidIslandCmd.getWorld());
new WarpCommand(this, gameModeAddon.getPlayerCommand().get());
new WarpsCommand(this, gameModeAddon.getPlayerCommand().get());
this.hooked = true;
}
}
});
// Done
if (hooked)
{
// Start warp signs
warpSignsManager = new WarpSignsManager(this, this.getPlugin());
warpPanelManager = new WarpPanelManager(this);
// Load the listener
getServer().getPluginManager().registerEvents(new WarpSignsListener(this), this.getPlugin());
}
}
@Override
public void onDisable(){
// Save the warps
@ -87,6 +134,21 @@ public class Warp extends Addon {
warpSignsManager.saveWarpList();
}
/**
* This method loads addon configuration settings in memory.
*/
private void loadSettings() {
this.settings = new Config<>(this, Settings.class).loadConfigObject();
if (this.settings == null) {
// Disable
this.logError("WelcomeWarp settings could not load! Addon disabled.");
this.setState(State.DISABLED);
}
}
/**
* Get warp panel manager
* @return
@ -115,7 +177,7 @@ public class Warp extends Addon {
/**
* @return the settings
*/
public PluginConfig getSettings() {
public Settings getSettings() {
return settings;
}
@ -126,7 +188,7 @@ public class Warp extends Addon {
* @return island level or null if there is no level plugin
*/
public Long getLevel(World world, UUID uniqueId) {
return plugin.getAddonsManager().getAddonByName(LEVEL_ADDON_NAME).map(l -> ((Level) l).getIslandLevel(world, uniqueId)).orElse(null);
return this.getPlugin().getAddonsManager().getAddonByName(LEVEL_ADDON_NAME).map(l -> ((Level) l).getIslandLevel(world, uniqueId)).orElse(null);
}
}

View File

@ -15,9 +15,10 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.SignChangeEvent;
import world.bentobox.warps.event.WarpRemoveEvent;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.util.Util;
import world.bentobox.warps.event.WarpRemoveEvent;
/**
* Handles warping. Players can add one sign
@ -99,8 +100,8 @@ public class WarpSignsListener implements Listener {
user.sendMessage("general.errors.you-need", "[permission]", addon.getPermPrefix(b.getWorld()) + ".island.addwarp");
return;
}
// Get level is level addon is available
Long level = addon.getLevel(b.getWorld(), user.getUniqueId());
// Get level if level addon is available
Long level = addon.getLevel(Util.getWorld(b.getWorld()), user.getUniqueId());
if (level != null && level < addon.getSettings().getWarpLevelRestriction()) {
user.sendMessage("warps.error.not-enough-level");
user.sendMessage("warps.error.your-level-is",

View File

@ -24,14 +24,15 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import world.bentobox.warps.objects.WarpsData;
import world.bentobox.warps.event.WarpInitiateEvent;
import world.bentobox.warps.event.WarpListEvent;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.Database;
import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.lists.Flags;
import world.bentobox.bentobox.util.Util;
import world.bentobox.warps.event.WarpInitiateEvent;
import world.bentobox.warps.event.WarpListEvent;
import world.bentobox.warps.objects.WarpsData;
/**
* Handles warping. Players can add one sign
@ -55,8 +56,7 @@ public class WarpSignsManager {
* @return map of warps
*/
public Map<UUID, Location> getWarpMap(World world) {
worldsWarpList.putIfAbsent(world, new HashMap<>());
return worldsWarpList.get(world);
return worldsWarpList.computeIfAbsent(Util.getWorld(world), k -> new HashMap<>());
}
/**
@ -163,15 +163,18 @@ public class WarpSignsManager {
private void loadWarpList() {
addon.getLogger().info("Loading warps...");
worldsWarpList = new HashMap<>();
WarpsData warps = handler.loadObject("warps");
// Load into map
if (warps != null) {
warps.getWarpSigns().forEach((k,v) -> {
if (k != null && (k.getBlock().getType().equals(Material.SIGN) || k.getBlock().getType().equals(Material.WALL_SIGN))) {
// Add to map
getWarpMap(k.getWorld()).put(v, k);
}
});
WarpsData warps = new WarpsData();
if (handler.objectExists("warps")) {
warps = handler.loadObject("warps");
// Load into map
if (warps != null) {
warps.getWarpSigns().forEach((k,v) -> {
if (k != null && k.getWorld() != null && (k.getBlock().getType().equals(Material.SIGN) || k.getBlock().getType().equals(Material.WALL_SIGN))) {
// Add to map
getWarpMap(k.getWorld()).put(v, k);
}
});
}
}
}
@ -278,7 +281,7 @@ public class WarpSignsManager {
inFront.getBlockZ() + 0.5D, yaw, 30F);
user.teleport(actualWarp);
if (pvp) {
user.sendRawMessage(user.getTranslation("protection.flags.PVP_OVERWORLD.active"));
user.sendMessage("protection.flags.PVP_OVERWORLD.active");
user.getWorld().playSound(user.getLocation(), Sound.ENTITY_ARROW_HIT, 1F, 1F);
} else {
user.getWorld().playSound(user.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 1F, 1F);
@ -350,16 +353,33 @@ public class WarpSignsManager {
addon.getWarpSignsManager().removeWarp(world, owner);
return;
}
// Find out if island is locked
// TODO: Fire event
if (this.plugin.getIWM().inWorld(user.getWorld()) &&
Flags.PREVENT_TELEPORT_WHEN_FALLING.isSetForWorld(user.getWorld()) &&
user.getPlayer().getFallDistance() > 0) {
// We're sending the "hint" to the player to tell them they cannot teleport while falling.
user.sendMessage(Flags.PREVENT_TELEPORT_WHEN_FALLING.getHintReference());
return;
}
Island island = addon.getPlugin().getIslands().getIsland(world, owner);
boolean pvp = false;
if (island != null) {
//if ((warpSpot.getWorld().equals(IslandWorld.getIslandWorld()) && island.getFlag(SettingsFlag.PVP_OVERWORLD))
// || (warpSpot.getWorld().equals(IslandWorld.getNetherWorld()) && island.getFlag(SettingsFlag.PVP_NETHER))) {
// pvp = true;
//}
// Check for PVP
switch (warpSpot.getWorld().getEnvironment()) {
case NETHER:
pvp = island.isAllowed(Flags.PVP_NETHER);
break;
case NORMAL:
pvp = island.isAllowed(Flags.PVP_OVERWORLD);
break;
case THE_END:
pvp = island.isAllowed(Flags.PVP_END);
break;
default:
break;
}
}
// Find out which direction the warp is facing
Block b = warpSpot.getBlock();
@ -384,7 +404,7 @@ public class WarpSignsManager {
return;
}
if (!(plugin.getIslands().isSafeLocation(warpSpot))) {
user.sendMessage("warps.error.NotSafe");
user.sendMessage("warps.error.not-safe");
// WALL_SIGN's will always be unsafe if the place in front is obscured.
if (b.getType().equals(Material.SIGN)) {
addon.getLogger().warning(
@ -395,13 +415,13 @@ public class WarpSignsManager {
} else {
final Location actualWarp = new Location(warpSpot.getWorld(), warpSpot.getBlockX() + 0.5D, warpSpot.getBlockY(),
warpSpot.getBlockZ() + 0.5D);
user.teleport(actualWarp);
if (pvp) {
//user.sendLegacyMessage(user.getTranslation("igs." + SettingsFlag.PVP_OVERWORLD) + " " + user.getTranslation("igs.Allowed"));
user.sendMessage("protection.flags.PVP_OVERWORLD.active");
user.getWorld().playSound(user.getLocation(), Sound.ENTITY_ARROW_HIT, 1F, 1F);
} else {
user.getWorld().playSound(user.getLocation(), Sound.ENTITY_BAT_TAKEOFF, 1F, 1F);
}
user.teleport(actualWarp);
return;
}
}

View File

@ -6,9 +6,9 @@ import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import world.bentobox.warps.Warp;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.warps.Warp;
/**
* The /is warp <name> command
@ -33,18 +33,6 @@ public class WarpCommand extends CompositeCommand {
this.setDescription("warp.help.description");
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
List<String> options = new ArrayList<>();
final Set<UUID> warpList = addon.getWarpSignsManager().listWarps(getWorld());
for (UUID warp : warpList) {
options.add(addon.getPlugin().getPlayers().getName(warp));
}
return Optional.of(options);
}
@Override
public boolean execute(User user, String label, List<String> args) {
if (args.size() == 1) {
@ -71,5 +59,17 @@ public class WarpCommand extends CompositeCommand {
return false;
}
@Override
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
List<String> options = new ArrayList<>();
final Set<UUID> warpList = addon.getWarpSignsManager().listWarps(getWorld());
for (UUID warp : warpList) {
options.add(addon.getPlugin().getPlayers().getName(warp));
}
return Optional.of(options);
}
}

View File

@ -1,24 +0,0 @@
package world.bentobox.warps.config;
import world.bentobox.warps.Warp;
public class PluginConfig {
private int warpLevelRestriction;
/**
* Loads the various settings from the config.yml file into the plugin
*/
public PluginConfig(Warp plugin) {
plugin.saveDefaultConfig();
warpLevelRestriction = plugin.getConfig().getInt("warplevelrestriction",10);
// All done
}
/**
* @return the warpLevelRestriction
*/
public int getWarpLevelRestriction() {
return warpLevelRestriction;
}
}

View File

@ -0,0 +1,142 @@
package world.bentobox.warps.config;
import java.util.HashSet;
import java.util.Set;
import world.bentobox.bentobox.api.configuration.ConfigComment;
import world.bentobox.bentobox.api.configuration.ConfigEntry;
import world.bentobox.bentobox.api.configuration.StoreAt;
import world.bentobox.bentobox.database.objects.DataObject;
@StoreAt(filename="config.yml", path="addons/WelcomeWarps")
@ConfigComment("WelcomeWarps Configuration [version]")
@ConfigComment("This config file is dynamic and saved when the server is shutdown.")
@ConfigComment("You cannot edit it while the server is running because changes will")
@ConfigComment("be lost! Use in-game settings GUI or edit when server is offline.")
@ConfigComment("")
public class Settings implements DataObject
{
@ConfigComment("")
@ConfigComment("Warp Restriction - needed levels to be able to create a warp")
@ConfigComment("0 or negative values will disable this restriction 10 is default")
@ConfigEntry(path = "warplevelrestriction")
private int warpLevelRestriction;
@ConfigComment("")
@ConfigComment("Text that player must put on sign to make it a warp sign")
@ConfigComment("Not case sensitive!")
@ConfigEntry(path = "welcomeLine")
private String welcomeLine;
@ConfigComment("")
@ConfigComment("This list stores GameModes in which Level addon should not work.")
@ConfigComment("To disable addon it is necessary to write its name in new line that starts with -. Example:")
@ConfigComment("disabled-gamemodes:")
@ConfigComment(" - BSkyBlock")
@ConfigEntry(path = "disabled-gamemodes")
private Set<String> disabledGameModes = new HashSet<>();
@ConfigComment("")
private String uniqueId = "config";
// ---------------------------------------------------------------------
// Section: Constructor
// ---------------------------------------------------------------------
/**
* Loads the various settings from the config.yml file into the plugin
*/
public Settings()
{
// empty constructor
}
// ---------------------------------------------------------------------
// Section: Methods
// ---------------------------------------------------------------------
/**
* @return the warpLevelRestriction
*/
public int getWarpLevelRestriction()
{
return warpLevelRestriction;
}
/**
* @return the uniqueId
*/
@Override
public String getUniqueId()
{
return uniqueId;
}
/**
* @param uniqueId - unique ID the uniqueId to set
*/
@Override
public void setUniqueId(String uniqueId)
{
this.uniqueId = uniqueId;
}
/**
* This method sets the warpLevelRestriction object value.
* @param warpLevelRestriction the warpLevelRestriction object new value.
*
*/
public void setWarpLevelRestriction(int warpLevelRestriction)
{
this.warpLevelRestriction = warpLevelRestriction;
}
/**
* This method returns the welcomeLine object.
* @return the welcomeLine object.
*/
public String getWelcomeLine()
{
return welcomeLine;
}
/**
* This method sets the welcomeLine object value.
* @param welcomeLine the welcomeLine object new value.
*
*/
public void setWelcomeLine(String welcomeLine)
{
this.welcomeLine = welcomeLine;
}
/**
* This method returns the disabledGameModes object.
* @return the disabledGameModes object.
*/
public Set<String> getDisabledGameModes()
{
return disabledGameModes;
}
/**
* This method sets the disabledGameModes object value.
* @param disabledGameModes the disabledGameModes object new value.
*
*/
public void setDisabledGameModes(Set<String> disabledGameModes)
{
this.disabledGameModes = disabledGameModes;
}
}

View File

@ -13,6 +13,7 @@ permissions:
bskyblock.island.addwarp:
description: Player can create a welcome warp sign
default: true
acidisland.island.warp:
description: Player can use warp or warps commands
default: true
@ -20,3 +21,16 @@ permissions:
description: Player can create a welcome warp sign
default: true
caveblock.island.warp:
description: Player can use warp or warps commands
default: true
caveblock.island.addwarp:
description: Player can create a welcome warp sign
default: true
skygrid.island.warp:
description: Player can use warp or warps commands
default: true
skygrid.island.addwarp:
description: Player can create a welcome warp sign
default: true

View File

@ -1,9 +1,21 @@
# WelcomeWarps Configuration ${version}
# 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.
#
#
# Warp Restriction - needed levels to be able to create a warp
# 0 or negative values will disable this restriction
# 10 is default
# 0 or negative values will disable this restriction 10 is default
warplevelrestriction: 10
#
# Text that player must put on sign to make it a warp sign
# Not case sensitive!
welcomeLine: [WELCOME]
welcomeLine: '[Welcome]'
#
# This list stores GameModes in which Level addon should not work.
# To disable addon it is necessary to write its name in new line that starts with -. Example:
# disabled-gamemodes:
# - BSkyBlock
disabled-gamemodes: []
#
uniqueId: config

View File

@ -3,30 +3,31 @@
# the one at http://yaml-online-parser.appspot.com #
###########################################################################################
warps:
warp:
help:
description: "warp to the player's warp sign"
parameters: <name>
warps:
deactivate: "&cOld warp sign deactivated!"
success: "&ASuccess!"
sign-removed: "&CWarp sign removed!"
title: "Warp Signs"
error:
does-not-exist: "&cOh snap! That warp no longer exists!"
duplicate: "&CDuplicate sign placed"
no-permission: "&CYou do not have permission to do that!"
no-remove: "&CYou cannot remove that sign!"
no-warps-yet: "&CThere are no warps available yet"
not-enough-level: "&CYour island level is not high enough!"
not-on-island: "&CYou must be on your island to do that!"
not-safe: "&cThat warp is not safe!"
your-level-is: "&cYou island level is only [level] and must be higher than [required]"
help:
description: "open the warps panel"
next: "&6Next page"
player-warped: "&2[name] warped to your warp sign!"
previous: "&6Previous page"
next: "&6Next page"
warpToPlayersSign: "&6Warping to [player]'s sign"
# The [text] is replaced with the welcome line text from config.yml
sign-removed: "&CWarp sign removed!"
success: "&ASuccess!"
title: "Warp Signs"
warpTip: "&6Place a warp sign with [text] on the top"
error:
does-not-exist: "&cOh snap! That warp no longer exists!"
no-remove: "&CYou cannot remove that sign!"
not-enough-level: "&CYour island level is not high enough!"
no-permission: "&CYou do not have permission to do that!"
not-on-island: "&CYou must be on your island to do that!"
duplicate: "&CDuplicate sign placed"
no-warps-yet: "&CThere are no warps available yet"
your-level-is: "&cYou island level is only [level] and must be higher than [required]"
help:
description: "open the warps panel"
warp:
help:
parameters: "<name>"
description: "warp to the player's warp sign"
warpToPlayersSign: "&6Warping to [player]'s sign"

View File

@ -0,0 +1,31 @@
###########################################################################################
# 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 #
###########################################################################################
warp:
help:
description: "te téléporte au Warp d'un autre joueur"
parameters: <pseudo>
warps:
deactivate: "&cAncien panneau de Warp désactivé !"
error:
does-not-exist: "&cCe Warp n'existe plus !"
duplicate: "&cPanneau dupliqué placé."
no-permission: "&cVous n'avez pas la permission pour faire cela !"
no-remove: "&cVous ne pouvez pas supprimer ce panneau !"
no-warps-yet: "&cIl n'y a encore aucun Warp sur ce serveur."
not-enough-level: "&cVotre niveau d'île n'est pas assez élevé pour faire cela !"
not-on-island: "&cVous devez être sur votre île pour faire cela !"
not-safe: "&cCe Warp n'est pas sûr!"
your-level-is: "&cVotre île est seulement niveau [level] et doit être niveau [required]."
help:
description: "Ouvre le menu des Warps"
next: "&6Page suivante"
player-warped: "&2[name] s'est téléporté sur votre île !"
previous: "&6Page précédente"
sign-removed: "&cPanneau de Warp supprimé !"
success: "&aSuccès !"
title: "Panneau Warp"
warpTip: "&6Placez un panneau et écrivez [text] sur la première ligne."
warpToPlayersSign: "&6Téléportation sur l'île de [player]..."

View File

@ -0,0 +1,33 @@
###########################################################################################
# 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 #
###########################################################################################
warp:
help:
description: "プレイヤーのワープサインにワープする"
parameters: <名>
warps:
deactivate: "&c前のワープサインが無効になりました!"
error:
does-not-exist: "&cそのワープはもう存在しません"
duplicate: "&C重複サインを配置"
no-permission: "&C許可がありません"
no-remove: "&Cワープサインは外せません"
no-warps-yet: "&C利用可能なワープはまだありません"
not-enough-level: "&C島のレベルは十分に高くありません"
not-on-island: "&Cあなたの島にいなければなりません"
not-safe: "&cワープは安全ではありません。!"
your-level-is: "&c島レベルはわずか[level]で、[required]より高くなければなりません"
help:
description: "ワープパネルを開く"
next: "&6次のページ"
player-warped: "&2[name]はあなたのワープサインに反った!"
previous: "&6前のページ"
sign-removed: "&Cワープサインを削除!"
success: "&A完了!"
title: "ワープサイン"
warpTip: "&6最初の行に[text]と一緒にワープサインを置きます"
warpToPlayersSign: "&6[player]のサインに反っている"

View File

@ -3,27 +3,31 @@
# 请在 http://yaml-online-parser.appspot.com 等 YAML 检查器中检查您的编辑. #
###########################################################################################
warp:
help:
description: 传送到该玩家的传送木牌处
parameters: <玩家名称>
warps:
removed: "&C传送木牌已移除"
success: "&A成功!"
sign-removed: "&C传送木牌已移除!"
title: "传送木牌"
previous: "&6上一页"
next: "&6下一页"
warpToPlayersSign: "&6正传送到 [player] 的传送木牌"
warpTip: "&6放置一个第一行是 [text] 的木牌以创建传送木牌"
error:
no-remove: "&C无权移除传送木牌!"
not-enough-level: "&C岛屿等级不够高!"
no-permission: "&C权限不足!"
not-on-island: "&C操作必须在空岛上进行!"
deactivate: "&c禁用的旧转移标志!"
error:
does-not-exist: "&c转移不再存在!"
duplicate: "&C木牌重复"
no-permission: "&C权限不足!"
no-remove: "&C无权移除传送木牌!"
no-warps-yet: "&C暂无可用传送木牌"
not-enough-level: "&C岛屿等级不够高!"
not-on-island: "&C操作必须在空岛上进行!"
not-safe: "&c转移不安全!"
your-level-is: "&c岛屿当前等级 [level], 需要等级 [required]"
help:
description: "打开传送面板"
warp:
help:
parameters: "<玩家名称>"
description: "传送到该玩家的传送木牌处"
help:
description: 打开传送面板
next: "&6下一页"
player-warped: "&2[name]转移到你的标志!"
previous: "&6上一页"
sign-removed: "&C传送木牌已移除!"
success: "&A成功!"
title: 传送木牌
warpTip: "&6放置一个第一行是 [text] 的木牌以创建传送木牌"
warpToPlayersSign: "&6正传送到 [player] 的传送木牌"

View File

@ -1,5 +1,6 @@
package world.bentobox.warps;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@ -9,6 +10,7 @@ import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Bukkit;
@ -33,17 +35,16 @@ import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import world.bentobox.warps.Warp;
import world.bentobox.warps.WarpSignsListener;
import world.bentobox.warps.WarpSignsManager;
import world.bentobox.warps.config.PluginConfig;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.managers.IslandWorldManager;
import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.LocalesManager;
import world.bentobox.bentobox.util.Util;
import world.bentobox.warps.config.Settings;
@RunWith(PowerMockRunner.class)
@PrepareForTest({Bukkit.class})
@PrepareForTest({Bukkit.class, Util.class})
public class WarpSignsListenerTest {
private Warp addon;
@ -56,7 +57,7 @@ public class WarpSignsListenerTest {
private UUID uuid;
private String[] lines;
private FileConfiguration config;
private PluginConfig settings;
private Settings settings;
private IslandsManager im;
@Before
@ -111,7 +112,7 @@ public class WarpSignsListenerTest {
// Lines
lines = new String[] {"[WELCOME]", "line2", "line3", "line4"};
settings = mock(PluginConfig.class);
settings = mock(Settings.class);
when(settings.getWarpLevelRestriction()).thenReturn(10);
when(addon.getSettings()).thenReturn(settings);
@ -122,6 +123,14 @@ public class WarpSignsListenerTest {
// Sufficient level
when(addon.getLevel(Mockito.any(), Mockito.any())).thenReturn(100L);
IslandWorldManager iwm = mock(IslandWorldManager.class);
when(plugin.getIWM()).thenReturn(iwm);
when(iwm.getAddon(Mockito.any())).thenReturn(Optional.empty());
// Util
PowerMockito.mockStatic(Util.class);
when(Util.getWorld(Mockito.any())).thenReturn(world);
}
@Test