Compare commits
9 Commits
Author | SHA1 | Date |
---|---|---|
|
0a12a26b06 | |
|
b860a4dac5 | |
|
2da0e5e82b | |
|
a39b6a3f4a | |
|
d70ee5d755 | |
|
efc6b795d1 | |
|
519a2d05fc | |
|
86c089b694 | |
|
3417633c4d |
2
pom.xml
2
pom.xml
|
@ -66,7 +66,7 @@
|
|||
<!-- Do not change unless you want different name for local builds. -->
|
||||
<build.number>-LOCAL</build.number>
|
||||
<!-- This allows to change between versions. -->
|
||||
<build.version>1.14.0</build.version>
|
||||
<build.version>1.15.0</build.version>
|
||||
<!-- Sonar Cloud -->
|
||||
<sonar.projectKey>BentoBoxWorld_Warps</sonar.projectKey>
|
||||
<sonar.organization>bentobox-world</sonar.organization>
|
||||
|
|
|
@ -38,6 +38,7 @@ import world.bentobox.bentobox.database.objects.Island;
|
|||
import world.bentobox.bentobox.lists.Flags;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.warps.Warp;
|
||||
import world.bentobox.warps.event.WarpCreateEvent;
|
||||
import world.bentobox.warps.event.WarpInitiateEvent;
|
||||
import world.bentobox.warps.objects.WarpsData;
|
||||
import world.bentobox.warps.panels.Utils;
|
||||
|
@ -105,7 +106,7 @@ public class WarpSignsManager {
|
|||
}
|
||||
getWarpMap(loc.getWorld()).put(playerUUID, loc);
|
||||
saveWarpList();
|
||||
Bukkit.getPluginManager().callEvent(new WarpInitiateEvent(addon, loc, playerUUID));
|
||||
Bukkit.getPluginManager().callEvent(new WarpCreateEvent(addon, loc, playerUUID));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -350,6 +351,11 @@ public class WarpSignsManager {
|
|||
float yaw = Util.blockFaceToFloat(directionFacing);
|
||||
final Location actualWarp = new Location(inFront.getWorld(), inFront.getBlockX() + 0.5D, inFront.getBlockY(),
|
||||
inFront.getBlockZ() + 0.5D, yaw, 30F);
|
||||
WarpInitiateEvent e = new WarpInitiateEvent(addon, actualWarp, user.getUniqueId());
|
||||
Bukkit.getPluginManager().callEvent(e);
|
||||
if (e.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
//BentoBox prevents people from teleporting to an island when
|
||||
//the user is banned from the island for example.
|
||||
//By checking if the teleport succeeded before sending the messages,
|
||||
|
|
|
@ -4,25 +4,50 @@ warp:
|
|||
description: te téléporte au Warp d'un autre joueur
|
||||
parameters: "<pseudo>"
|
||||
warps:
|
||||
deactivate: "&cAncien panneau de Warp désactivé !"
|
||||
deactivate: "&c Ancienne pancarte de warp désactivée !"
|
||||
error:
|
||||
does-not-exist: "&cCe Warp n'existe plus !"
|
||||
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
|
||||
!"
|
||||
does-not-exist: "&c Oh ! Cette téléportation n'existe plus !"
|
||||
no-permission: "&c Vous n'avez pas le droit de faire cela !"
|
||||
no-remove: "&c Vous ne pouvez pas enlever cette pancarte !"
|
||||
no-warps-yet: "&c Il n'y a pas encore de téléportation disponible"
|
||||
not-enough-level: "&c Le niveau de votre île n'est pas assez élevé !"
|
||||
not-on-island: "&c Vous 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]."
|
||||
not-safe: "&c Cette téléportation n'est pas sûre !"
|
||||
your-level-is: "&c Le niveau de votre île n'est que [level] et doit être supérieur
|
||||
à [required]. Exécutez la commande level."
|
||||
not-correct-rank: "&c Vous n'avez pas le grade adéquat pour poser une chaîne !"
|
||||
help:
|
||||
description: Ouvre le menu des Warps
|
||||
next: "&6Page suivante"
|
||||
player-warped: "& 2 [pseudo] s'est téléporté à votre panneau Warp !"
|
||||
previous: "&6Page précédente"
|
||||
random: "&4 Warp aléatoire "
|
||||
sign-removed: "&cPanneau de Warp supprimé !"
|
||||
player-warped: "&2 [name] s'est rendu à votre pancarte de téléportation [gamemode]
|
||||
!"
|
||||
sign-removed: "&c Panneau de téléportation enlevé !"
|
||||
success: "&a Succès !"
|
||||
title: Panneau Warp
|
||||
warpTip: "&6Placez un panneau et écrivez [text] sur la première ligne."
|
||||
warpToPlayersSign: "&6 Téléportation vers le panneau de [pseudo]"
|
||||
warpTip: "&6 Placer une pancarte de téléportation avec [text] sur le dessus"
|
||||
warpToPlayersSign: "&6 Téléportation a la pancarte de [player]"
|
||||
gui:
|
||||
titles:
|
||||
warp-title: "&0&l Pancarte de téléportation"
|
||||
buttons:
|
||||
previous:
|
||||
name: "&f&l Page précédente"
|
||||
description: "&7 Aller à la page [numéro]."
|
||||
next:
|
||||
name: "&f&l Page suivante"
|
||||
description: "&7 Passer à la page [numéro]."
|
||||
warp:
|
||||
name: "&f&l [name]"
|
||||
description: "[sign_text]"
|
||||
random:
|
||||
name: "&f&l Téléportation aléatoire"
|
||||
description: "&7 Hmm, où vais-je apparaître ?"
|
||||
tips:
|
||||
click-to-previous: "&e Cliquez sur &7 pour afficher la page précédente."
|
||||
click-to-next: "&e Cliquez sur &7 pour afficher la page suivante."
|
||||
click-to-warp: "&e Cliquez sur &7 pour te téléporter."
|
||||
conversations:
|
||||
prefix: "&l&6 [BentoBox]: &r"
|
||||
protection:
|
||||
flags:
|
||||
PLACE_WARP:
|
||||
name: Place téléportation
|
||||
description: Autoriser le placement d'un panneau téléportation
|
||||
|
|
|
@ -1,27 +1,60 @@
|
|||
---
|
||||
# ##########################################################################################
|
||||
# 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: "<player name>"
|
||||
description: 传送至对应玩家的坐标告示牌
|
||||
parameters: <player name>
|
||||
warps:
|
||||
help:
|
||||
description: 打开传送面板
|
||||
title: 传送木牌
|
||||
deactivate: "&c 旧传送牌已停用!"
|
||||
deactivate: '&c检测到不活跃的坐标告示牌!'
|
||||
error:
|
||||
does-not-exist: "&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] 级。 试试岛屿等级命令吧。"
|
||||
next: "&6 次页"
|
||||
player-warped: "&2 [name] 传送到了你的传送牌!"
|
||||
previous: "&6 前页"
|
||||
random: "&4 随机传送"
|
||||
sign-removed: "&c 拆掉传送牌了!"
|
||||
success: "&a 成了!"
|
||||
warpTip: "&6 放个牌子第一行写 [text]"
|
||||
warpToPlayersSign: "&6 正传送到 [player] 的牌子"
|
||||
does-not-exist: '&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]. 使用/is level查看等级.'
|
||||
not-correct-rank: '&c你在团队中的地位不足以让你设立传送点!'
|
||||
help:
|
||||
description: 打开传送点面板
|
||||
player-warped: '&2 [name]传送到了你[gamemode]的坐标告示牌!'
|
||||
sign-removed: '&c坐标告示牌已移除!'
|
||||
success: '&a成功!'
|
||||
warpTip: '&6放置一个顶部为[text]的坐标告示牌'
|
||||
warpToPlayersSign: '&6正在传送至[player]的坐标告示牌'
|
||||
|
||||
gui:
|
||||
titles:
|
||||
# The title of warp panel
|
||||
warp-title: '&0&l坐标告示牌'
|
||||
buttons:
|
||||
# Button that is used in multi-page GUIs which allows to return to previous page.
|
||||
previous:
|
||||
name: '&f&l上一页'
|
||||
description: '&7跳转到第[number]页' # Button that is used in multi-page GUIs which allows to go to next page.
|
||||
next:
|
||||
name: '&f&l下一页'
|
||||
description: '&7跳转到第[number]页' # Button for a warp
|
||||
warp:
|
||||
name: '&f&l [name]'
|
||||
description: '[sign_text]' # Button for a random warp
|
||||
random:
|
||||
name: '&f&l随机传送'
|
||||
description: '&7嗯...我会出现在哪里?'
|
||||
tips:
|
||||
click-to-previous: '&e点击&7 查看上一页.'
|
||||
click-to-next: '&e点击&7 查看下一页.'
|
||||
click-to-warp: '&e点击&7 进行传送.'
|
||||
conversations:
|
||||
# Prefix for messages that are send from server.
|
||||
prefix: '&l&6 [BentoBox]: &r'
|
||||
|
||||
protection:
|
||||
flags:
|
||||
PLACE_WARP:
|
||||
name: 放置传送点
|
||||
description: 允许放置坐标告示牌
|
||||
|
|
|
@ -19,7 +19,7 @@ warps_panel:
|
|||
8: warp_button
|
||||
3:
|
||||
1:
|
||||
icon: TIPPED_ARROW:INSTANT_HEAL::::1
|
||||
icon: tipped_arrow{CustomPotionColor:11546150}
|
||||
title: warps.gui.buttons.previous.name
|
||||
description: warps.gui.buttons.previous.description
|
||||
data:
|
||||
|
@ -37,7 +37,7 @@ warps_panel:
|
|||
7: warp_button
|
||||
8: warp_button
|
||||
9:
|
||||
icon: TIPPED_ARROW:JUMP::::1
|
||||
icon: tipped_arrow{CustomPotionColor:8439583}
|
||||
title: warps.gui.buttons.next.name
|
||||
description: warps.gui.buttons.next.description
|
||||
data:
|
||||
|
|
|
@ -8,7 +8,9 @@ import static org.mockito.ArgumentMatchers.any;
|
|||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doAnswer;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
@ -40,6 +42,7 @@ import org.junit.Before;
|
|||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.stubbing.Answer;
|
||||
|
@ -60,6 +63,7 @@ import world.bentobox.bentobox.managers.PlaceholdersManager;
|
|||
import world.bentobox.bentobox.managers.PlayersManager;
|
||||
import world.bentobox.bentobox.util.Util;
|
||||
import world.bentobox.warps.config.Settings;
|
||||
import world.bentobox.warps.event.WarpCreateEvent;
|
||||
import world.bentobox.warps.event.WarpInitiateEvent;
|
||||
import world.bentobox.warps.managers.SignCacheManager;
|
||||
import world.bentobox.warps.managers.WarpSignsManager;
|
||||
|
@ -349,7 +353,7 @@ public class WarpSignsManagerTest {
|
|||
public void testAddWarp() {
|
||||
Location loc = mock(Location.class);
|
||||
assertTrue(wsm.addWarp(uuid, loc));
|
||||
verify(pim).callEvent(any(WarpInitiateEvent.class));
|
||||
verify(pim).callEvent(any(WarpCreateEvent.class));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -441,6 +445,38 @@ public class WarpSignsManagerTest {
|
|||
PowerMockito.verifyStatic(Util.class);
|
||||
Util.teleportAsync(eq(p), any(), eq(TeleportCause.COMMAND));
|
||||
verify(player).sendMessage(anyString());
|
||||
verify(pim).callEvent(any(WarpInitiateEvent.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link WarpSignsManager#warpPlayer(org.bukkit.World, world.bentobox.bentobox.api.user.User, java.util.UUID)}.
|
||||
*/
|
||||
@Test
|
||||
public void testWarpPlayerEventCancelled() {
|
||||
// Capture the event passed to callEvent
|
||||
ArgumentCaptor<WarpInitiateEvent> eventCaptor = ArgumentCaptor.forClass(WarpInitiateEvent.class);
|
||||
|
||||
// Simulate the event being called and cancelled
|
||||
doAnswer(invocation -> {
|
||||
WarpInitiateEvent event = (WarpInitiateEvent) invocation.getArgument(0);
|
||||
event.setCancelled(true);
|
||||
return null;
|
||||
}).when(pim).callEvent(eventCaptor.capture());
|
||||
|
||||
Player p = mock(Player.class);
|
||||
when(p.getUniqueId()).thenReturn(UUID.randomUUID());
|
||||
when(p.getWorld()).thenReturn(world);
|
||||
when(p.getName()).thenReturn("tastybento");
|
||||
when(p.getLocation()).thenReturn(location);
|
||||
when(p.isOnline()).thenReturn(true);
|
||||
when(p.canSee(any(Player.class))).thenReturn(true);
|
||||
@Nullable
|
||||
User u = User.getInstance(p);
|
||||
PowerMockito.when(Util.teleportAsync(any(), any(), any())).thenReturn(CompletableFuture.completedFuture(true));
|
||||
wsm.warpPlayer(world, u, uuid);
|
||||
PowerMockito.verifyStatic(Util.class, never());
|
||||
Util.teleportAsync(eq(p), any(), eq(TeleportCause.COMMAND));
|
||||
verify(player, never()).sendMessage(anyString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue