From 0ea56fe5d29e87958f4534e74379801ea669b2ce Mon Sep 17 00:00:00 2001 From: DroppingAnvil Date: Tue, 12 May 2020 14:41:12 -0500 Subject: [PATCH 1/2] World now per range instead of global + CmdWild cleanup --- .../java/com/massivecraft/factions/cmd/wild/CmdWild.java | 7 ++++--- src/main/resources/config.yml | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/massivecraft/factions/cmd/wild/CmdWild.java b/src/main/java/com/massivecraft/factions/cmd/wild/CmdWild.java index 6a5d556d..f25ac123 100644 --- a/src/main/java/com/massivecraft/factions/cmd/wild/CmdWild.java +++ b/src/main/java/com/massivecraft/factions/cmd/wild/CmdWild.java @@ -20,6 +20,7 @@ import org.bukkit.potion.PotionEffectType; import java.util.HashMap; import java.util.HashSet; +import java.util.Objects; import java.util.Random; /** @@ -29,7 +30,6 @@ public class CmdWild extends FCommand implements WaitedTask { public static HashMap teleportRange; public static HashSet teleporting; public static CmdWild instance; - public static final String tpWorld = FactionsPlugin.getInstance().getConfig().getString("Wild.World", "World"); public CmdWild() { super(); @@ -55,11 +55,12 @@ public class CmdWild extends FCommand implements WaitedTask { int tries = 0; ConfigurationSection c = FactionsPlugin.getInstance().getConfig().getConfigurationSection("Wild.Zones." + teleportRange.get(p)); while (tries < 5) { + assert c != null; int x = new Random().nextInt((c.getInt("Range.MaxX") - c.getInt("Range.MinX")) + 1) + c.getInt("Range.MinX"); int z = new Random().nextInt((c.getInt("Range.MaxZ") - c.getInt("Range.MinZ")) + 1) + c.getInt("Range.MinZ"); if (Board.getInstance().getFactionAt(new FLocation(p.getWorld().getName(), x, z)).isWilderness()) { success = true; - FLocation loc = new FLocation(tpWorld, x, z); + FLocation loc = new FLocation(Objects.requireNonNull(c.getString("World", "World")), x, z); teleportRange.remove(p); if (!FPlayers.getInstance().getByPlayer(p).takeMoney(c.getInt("Cost"))) { p.sendMessage(TL.GENERIC_NOTENOUGHMONEY.toString()); @@ -91,7 +92,7 @@ public class CmdWild extends FCommand implements WaitedTask { public void applyEffects(Player p) { for (String s : FactionsPlugin.getInstance().getConfig().getStringList("Wild.Arrival.Effects")) { - p.addPotionEffect(new PotionEffect(PotionEffectType.getByName(s), 40, 1)); + p.addPotionEffect(new PotionEffect(Objects.requireNonNull(PotionEffectType.getByName(s)), 40, 1)); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d468e480..5a889bca 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1438,8 +1438,6 @@ Wild: Enabled: true # Time to wait in seconds # Wait: 5 - # World players will be teleported to # - World: 'World' # General GUI Settings # GUI: Name: 'Teleporter' @@ -1450,6 +1448,7 @@ Wild: Zones: # You may create your own zones here please just follow the original format # Close: + World: World Range: MinX: -200 MaxX: 200 @@ -1464,6 +1463,7 @@ Wild: Name: '&cLow Range' Slot: 1 Medium: + World: World Range: MinX: -400 MaxX: 400 @@ -1478,6 +1478,7 @@ Wild: Name: '&cMedium Range' Slot: 4 Far: + World: World Range: MinX: -800 MaxX: 800 From 67a9a6db284211df0d5716a4823200aa2dc218fb Mon Sep 17 00:00:00 2001 From: Aeris One Date: Sat, 16 May 2020 12:07:53 +0200 Subject: [PATCH 2/2] Update ja_JP.yml --- src/main/resources/lang/ja_JP.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/lang/ja_JP.yml b/src/main/resources/lang/ja_JP.yml index 102ecf77..038cb28c 100644 --- a/src/main/resources/lang/ja_JP.yml +++ b/src/main/resources/lang/ja_JP.yml @@ -89,8 +89,8 @@ COMMAND: INUSE: That tag is already in use. TOCREATE: to create a new faction FORCREATE: for creating a new faction - ERROR: There was an internal error while trying to create your faction. Please try again. - CREATED: %s created a new faction %s + ERROR: 'There was an internal error while trying to create your faction. Please try again.' + CREATED: '%s created a new faction %s' CREATEDLOG: ' は新しい党派を造りました: ' YOUSHOULD: 'You should now: %s' DEINVITE: