diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c771fd5..825b18d 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -11,21 +11,22 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
- uses: actions/setup-java@v1
+ uses: actions/setup-java@v3
with:
+ distribution: 'adopt'
java-version: 17
- name: Cache SonarCloud packages
- uses: actions/cache@v1
+ uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
- uses: actions/cache@v1
+ uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
diff --git a/pom.xml b/pom.xml
index eaeb901..130ec45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -49,12 +49,12 @@
17
2.0.9
- 1.19.3-R0.1-SNAPSHOT
- 1.22.1-SNAPSHOT
+ 1.20.3-R0.1-SNAPSHOT
+ 2.0.0-SNAPSHOT
${build.version}-SNAPSHOT
- 4.1.1
+ 4.2
-LOCAL
BentoBoxWorld_Border
@@ -120,21 +120,14 @@
-
-
- org.spigotmc
- spigot-api
- ${spigot.version}
- provided
-
-
-
- org.mockito
- mockito-core
- 3.11.1
- test
-
+
+
+ org.javassist
+ javassist
+ 3.30.2-GA
+
+
org.powermock
powermock-module-junit4
${powermock.version}
@@ -146,12 +139,25 @@
${powermock.version}
test
+
+ org.mockito
+ mockito-core
+ 3.11.1
+ test
+
world.bentobox
bentobox
${bentobox.version}
provided
+
+
+ org.spigotmc
+ spigot-api
+ ${spigot.version}
+ provided
+
@@ -263,13 +269,15 @@
org.jacoco
jacoco-maven-plugin
- 0.8.7
+ 0.8.10
true
**/*Names*
+
+ org/bukkit/Material*
diff --git a/src/main/java/world/bentobox/border/Settings.java b/src/main/java/world/bentobox/border/Settings.java
index 83b0cf6..5fd7ed8 100644
--- a/src/main/java/world/bentobox/border/Settings.java
+++ b/src/main/java/world/bentobox/border/Settings.java
@@ -35,6 +35,11 @@ public class Settings implements ConfigObject {
@ConfigEntry(path = "return-teleport")
private boolean returnTeleport = true;
+ @ConfigComment("")
+ @ConfigComment("Place a safety block under the player if they get teleported back into a non-safe spot.")
+ @ConfigEntry(path = "return-teleport-safety-block")
+ private boolean returnTeleportBlock = true;
+
@ConfigComment("")
@ConfigComment("Barrier blocks on/off. Only applies if the border type is BARRIER.")
@ConfigComment("If false, the border is indicated by particles only.")
@@ -173,4 +178,18 @@ public void setBarrierOffset(int barrierOffset) {
this.barrierOffset = barrierOffset;
getBarrierOffset();
}
+
+ /**
+ * @return the returnTeleportBlock
+ */
+ public boolean isReturnTeleportBlock() {
+ return returnTeleportBlock;
+ }
+
+ /**
+ * @param returnTeleportBlock the returnTeleportBlock to set
+ */
+ public void setReturnTeleportBlock(boolean returnTeleportBlock) {
+ this.returnTeleportBlock = returnTeleportBlock;
+ }
}
diff --git a/src/main/java/world/bentobox/border/listeners/PlayerListener.java b/src/main/java/world/bentobox/border/listeners/PlayerListener.java
index 9bc361d..0cb89a3 100644
--- a/src/main/java/world/bentobox/border/listeners/PlayerListener.java
+++ b/src/main/java/world/bentobox/border/listeners/PlayerListener.java
@@ -155,7 +155,7 @@ public void onPlayerLeaveIsland(PlayerMoveEvent e) {
if (r != null) {
inTeleport.add(p.getUniqueId());
Location targetPos = r.getHitPosition().toLocation(p.getWorld(), p.getLocation().getYaw(), p.getLocation().getPitch());
- if (!addon.getIslands().isSafeLocation(targetPos)) {
+ if (addon.getSettings().isReturnTeleportBlock() && !addon.getIslands().isSafeLocation(targetPos)) {
switch (targetPos.getWorld().getEnvironment()) {
case NETHER:
targetPos.getBlock().getRelative(BlockFace.DOWN).setType(Material.NETHERRACK);
diff --git a/src/main/java/world/bentobox/border/listeners/ShowBarrier.java b/src/main/java/world/bentobox/border/listeners/ShowBarrier.java
index c866890..7cc0150 100644
--- a/src/main/java/world/bentobox/border/listeners/ShowBarrier.java
+++ b/src/main/java/world/bentobox/border/listeners/ShowBarrier.java
@@ -133,7 +133,7 @@ private void showPlayer(Player player, int i, int j, int k, boolean max) {
Location l = new Location(player.getWorld(), i, j, k);
Util.getChunkAtAsync(l).thenAccept(c -> {
if (addon.getSettings().isShowParticles()) {
- if (j < 0 || j > player.getWorld().getMaxHeight()) {
+ if (j < player.getWorld().getMinHeight() || j > player.getWorld().getMaxHeight()) {
User.getInstance(player).spawnParticle(max ? MAX_PARTICLE : PARTICLE, PARTICLE_DUST_RED, i + 0.5D, j + 0.0D, k + 0.5D);
} else {
User.getInstance(player).spawnParticle(max ? MAX_PARTICLE : PARTICLE, PARTICLE_DUST_BLUE, i + 0.5D, j + 0.0D, k + 0.5D);
diff --git a/src/main/resources/addon.yml b/src/main/resources/addon.yml
index f63fd3e..ef18ae2 100644
--- a/src/main/resources/addon.yml
+++ b/src/main/resources/addon.yml
@@ -10,8 +10,8 @@ authors: [tastybento]
permissions:
'[gamemode].border.toggle':
- description: Player can use border toggle command
+ description: Player can use border command
default: op
- '[gamemode].border.set-type':
+ '[gamemode].border.type':
description: Player can use border type setting command
default: true
\ No newline at end of file
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index c821a87..b19ac3b 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -1,30 +1,43 @@
-# Border addon configuration file
+# Border addon configuration file {$version}
# See the documentation at https://docs.bentobox.world/en/latest/addons/Border/
-#
+#
# This list stores GameModes in which Border 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: []
-#
-# Use vanilla world border.
-use-vanilla: true
-#
+#
+# Border type. Options are VANILLA, which uses the vanillia-style board or BARRIER,
+# which uses particles and barrier blocks. If players have permission to use the barrier type
+# they may override this option. If they do not have permission or lose the permission
+# then this setting will be used.
+type: VANILLA
+#
# Teleport players back inside the border if they somehow get outside.
# This will teleport players back inside if they toggle the border with a command.
return-teleport: true
-#
-# Only applies if vanilla isn't used.
-# Use barrier blocks. If false, the border is indicated by particles only.
+#
+# Place a safety block under the player if they get teleported back into a non-safe spot.
+return-teleport-safety-block: true
+#
+# Barrier blocks on/off. Only applies if the border type is BARRIER.
+# If false, the border is indicated by particles only.
use-barrier-blocks: true
-#
-# Default border behavior
+#
+# Turn on barrier by default.
show-by-default: true
-#
-# Only applies if vanilla isn't used.
+#
+# Only applies if VANILLA type isn't used.
# Show max-protection range border. This is a visual border only and not a barrier.
+# This setting is useful for game modes where the protection range can move around, like Boxed
show-max-border: true
-#
-# Only applies if vanilla isn't used.
+#
+# Only applies if VANILLA type isn't used.
# Enables/disables all types of wall particles shown by the addon
show-particles: true
+#
+# Barrier offset.
+# The barrier normally occurs at the protection range limit but this value extends it outwards.
+# This does not extend the protection range, but will enable players to go outside their protected area.
+# The barrier will not go further than the island distance. Minimum and default value is 0.
+barrier-offset: 0
diff --git a/src/main/resources/locales/cs.yml b/src/main/resources/locales/cs.yml
index ab5dd5b..2300c97 100644
--- a/src/main/resources/locales/cs.yml
+++ b/src/main/resources/locales/cs.yml
@@ -1,7 +1,10 @@
-# Translation by: CZghost
-
+---
border:
toggle:
- description: "přepíná hranice ostrova zapnuto/vypnuto"
+ description: přepíná hranice ostrova zapnuto/vypnuto
border-on: "&a Hranice zapnuta."
border-off: "&a Hranice vypnuta."
+ set-type:
+ description: změní typ ohraničení
+ changed: "&a Typ ohraničení změněn na &b[type]&a."
+ error-unavailable-type: "&c Tento typ je nedostupný nebo neexistuje."
diff --git a/src/main/resources/locales/hr.yml b/src/main/resources/locales/hr.yml
new file mode 100644
index 0000000..bbc64e3
--- /dev/null
+++ b/src/main/resources/locales/hr.yml
@@ -0,0 +1,10 @@
+---
+border:
+ toggle:
+ description: uključuje/isključuje obrub
+ border-on: "&a Border omogućen."
+ border-off: "&a Border onemogućen."
+ set-type:
+ description: mijenja vrstu obruba
+ changed: "&a Vrsta obruba promijenjena je u &b[type]&a."
+ error-unavailable-type: "&c Ova vrsta je nedostupna ili ne postoji."
diff --git a/src/main/resources/locales/it.yml b/src/main/resources/locales/it.yml
index 352ee21..0d7a85a 100644
--- a/src/main/resources/locales/it.yml
+++ b/src/main/resources/locales/it.yml
@@ -4,3 +4,7 @@ border:
description: attiva o disattiva il bordo
border-on: "&a Bordo attivato."
border-off: "&c Bordo disattivato."
+ set-type:
+ description: cambia il tipo di bordo
+ changed: "&a Il tipo di bordo è stato modificato in &b[type]&a."
+ error-unavailable-type: "&c Questo tipo non è disponibile o non esiste."
diff --git a/src/main/resources/locales/ja.yml b/src/main/resources/locales/ja.yml
new file mode 100644
index 0000000..4655856
--- /dev/null
+++ b/src/main/resources/locales/ja.yml
@@ -0,0 +1,10 @@
+---
+border:
+ toggle:
+ description: 境界線のオン/オフを切り替えます
+ border-on: "&a 境界線が有効です。"
+ border-off: "&a 境界線が無効になっています。"
+ set-type:
+ description: 境界線の種類を変更します
+ changed: "&a 枠線のタイプが &b[type]&a に変更されました。"
+ error-unavailable-type: "&c このタイプは使用できないか、存在しません。"
diff --git a/src/main/resources/locales/ko.yml b/src/main/resources/locales/ko.yml
index 55b802b..c55c503 100644
--- a/src/main/resources/locales/ko.yml
+++ b/src/main/resources/locales/ko.yml
@@ -4,3 +4,7 @@ border:
description: 월드보더를 키거나 끕니다
border-on: "&a 월드 보더를 활성화 했습니다"
border-off: "&a 월드 보더를 비활성화 했습니다"
+ set-type:
+ description: 테두리 유형을 변경합니다.
+ changed: "&a 테두리 유형이 &b[type]&a로 변경되었습니다."
+ error-unavailable-type: "&c 이 유형은 사용할 수 없거나 존재하지 않습니다."
diff --git a/src/main/resources/locales/nl.yml b/src/main/resources/locales/nl.yml
new file mode 100644
index 0000000..87993ca
--- /dev/null
+++ b/src/main/resources/locales/nl.yml
@@ -0,0 +1,10 @@
+---
+border:
+ toggle:
+ description: schakelt de rand in/uit
+ border-on: "&a Rand ingeschakeld."
+ border-off: "&a Grens uitgeschakeld."
+ set-type:
+ description: verandert het type rand
+ changed: "&a Randtype gewijzigd in &b[type]&a."
+ error-unavailable-type: "&c Dit type is niet beschikbaar of bestaat niet."
diff --git a/src/main/resources/locales/pt.yml b/src/main/resources/locales/pt.yml
index c1d7185..3a69801 100644
--- a/src/main/resources/locales/pt.yml
+++ b/src/main/resources/locales/pt.yml
@@ -4,3 +4,7 @@ border:
description: Ativa/Desativa a borda
border-on: "&a Borda ativada."
border-off: "&a Borda desativada."
+ set-type:
+ description: muda o tipo da borda
+ changed: "&a Tipo de borda alterado para &b[type]&a."
+ error-unavailable-type: "&c Este tipo não está disponível ou não existe."
diff --git a/src/main/resources/locales/ro.yml b/src/main/resources/locales/ro.yml
new file mode 100644
index 0000000..8371592
--- /dev/null
+++ b/src/main/resources/locales/ro.yml
@@ -0,0 +1,10 @@
+---
+border:
+ toggle:
+ description: activează/dezactivează chenarul
+ border-on: "&a Chenar activat."
+ border-off: "&a Chenar este dezactivată."
+ set-type:
+ description: modifică tipul de chenar
+ changed: "&a Tipul de chenar s-a schimbat în &b[type]&a."
+ error-unavailable-type: "&c Acest tip este indisponibil sau nu există."
diff --git a/src/main/resources/locales/tr.yml b/src/main/resources/locales/tr.yml
new file mode 100644
index 0000000..547392e
--- /dev/null
+++ b/src/main/resources/locales/tr.yml
@@ -0,0 +1,10 @@
+---
+border:
+ toggle:
+ description: kenarlığı açar/kapatır
+ border-on: "&a Sınır etkin."
+ border-off: "&a Kenarlık devre dışı."
+ set-type:
+ description: kenarlığın türünü değiştirir
+ changed: "&a Kenarlık türü &b[type]&a olarak değiştirildi."
+ error-unavailable-type: "&c Bu tür kullanılamıyor veya mevcut değil."
diff --git a/src/main/resources/locales/uk.yml b/src/main/resources/locales/uk.yml
new file mode 100644
index 0000000..913549e
--- /dev/null
+++ b/src/main/resources/locales/uk.yml
@@ -0,0 +1,10 @@
+---
+border:
+ toggle:
+ description: вмикає/вимикає рамку
+ border-on: "& Межа ввімкнена."
+ border-off: "& Межа вимкнена."
+ set-type:
+ description: змінює тип рамки
+ changed: Тип рамки &a змінено на &b[type]&a.
+ error-unavailable-type: "&c Цей тип недоступний або не існує."
diff --git a/src/main/resources/locales/vi.yml b/src/main/resources/locales/vi.yml
index e12d921..d7bdaf6 100644
--- a/src/main/resources/locales/vi.yml
+++ b/src/main/resources/locales/vi.yml
@@ -1,5 +1,10 @@
+---
border:
toggle:
description: bật/tắt hiệu ứng rìa đảo
- border-on: '&aĐã bật rìa đảo.'
- border-off: '&aĐã tắt rìa đảo.'
+ border-on: "&aĐã bật rìa đảo."
+ border-off: "&aĐã tắt rìa đảo."
+ set-type:
+ description: thay đổi loại đường viền đảo
+ changed: "&a Loại đường viền đảo đã thay đổi thành &b[type]&a."
+ error-unavailable-type: "&c Loại này không có sẵn hoặc không tồn tại."
diff --git a/src/main/resources/locales/zh-CN.yml b/src/main/resources/locales/zh-CN.yml
new file mode 100644
index 0000000..ecf0f69
--- /dev/null
+++ b/src/main/resources/locales/zh-CN.yml
@@ -0,0 +1,10 @@
+---
+border:
+ toggle:
+ description: 打开/关闭边框
+ border-on: "&a 启用边框。"
+ border-off: "&a 边框已禁用。"
+ set-type:
+ description: 更改边框的类型
+ changed: "&a 边框类型更改为 &b[type]&a。"
+ error-unavailable-type: "&c 此类型不可用或不存在。"
diff --git a/src/main/resources/locales/zh-TW.yml b/src/main/resources/locales/zh-TW.yml
index 00f8f96..0ffd8e6 100644
--- a/src/main/resources/locales/zh-TW.yml
+++ b/src/main/resources/locales/zh-TW.yml
@@ -4,4 +4,7 @@ border:
description: 開啟/關閉 顯示邊界
border-on: "&a開啟 顯示邊界"
border-off: "&a關閉 顯示邊界"
-
+ set-type:
+ description: 更改邊框的類型
+ changed: "&a 邊框類型更改為 &b[type]&a。"
+ error-unavailable-type: "&c 此類型不可用或不存在。"