mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
3.0.4 release - RTP shapes
This commit is contained in:
parent
563baee57e
commit
c0846e5413
@ -137,6 +137,7 @@ public class CmdInfo implements RTPCommand, RTPCommandHelpable {
|
|||||||
info.add("&7- &6Price: &f" + _rtpworld.getPrice() + getInfo(_rtpworld, worldDefault, "price"));
|
info.add("&7- &6Price: &f" + _rtpworld.getPrice() + getInfo(_rtpworld, worldDefault, "price"));
|
||||||
info.add("&7- &6World Type: &f" + _rtpworld.getWorldtype().name());
|
info.add("&7- &6World Type: &f" + _rtpworld.getWorldtype().name());
|
||||||
info.add("&7- &6Biomes: &f" + _rtpworld.getBiomes().toString());
|
info.add("&7- &6Biomes: &f" + _rtpworld.getBiomes().toString());
|
||||||
|
info.add("&7- &6Shape: &f" + _rtpworld.getShape().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return info;
|
return info;
|
||||||
|
@ -2,5 +2,5 @@ package me.SuperRonanCraft.BetterRTP.player.rtp;
|
|||||||
|
|
||||||
public enum RTP_SHAPE {
|
public enum RTP_SHAPE {
|
||||||
SQUARE, //Square shaped location finder
|
SQUARE, //Square shaped location finder
|
||||||
ROUND //Circled area location finder
|
CIRCLE //Circled area location finder
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.worlds;
|
package me.SuperRonanCraft.BetterRTP.references.worlds;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_SHAPE;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -21,4 +22,6 @@ public interface RTPWorld {
|
|||||||
List<String> getBiomes();
|
List<String> getBiomes();
|
||||||
|
|
||||||
World getWorld();
|
World getWorld();
|
||||||
|
|
||||||
|
RTP_SHAPE getShape();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.worlds;
|
package me.SuperRonanCraft.BetterRTP.references.worlds;
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_SHAPE;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -14,6 +15,7 @@ public class WorldCustom implements RTPWorld {
|
|||||||
private boolean useWorldborder;
|
private boolean useWorldborder;
|
||||||
private int CenterX, CenterZ, maxBorderRad, minBorderRad, price;
|
private int CenterX, CenterZ, maxBorderRad, minBorderRad, price;
|
||||||
private List<String> Biomes;
|
private List<String> Biomes;
|
||||||
|
private RTP_SHAPE shape;
|
||||||
|
|
||||||
public WorldCustom(String world) {
|
public WorldCustom(String world) {
|
||||||
//String pre = "CustomWorlds.";
|
//String pre = "CustomWorlds.";
|
||||||
@ -30,6 +32,7 @@ public class WorldCustom implements RTPWorld {
|
|||||||
CenterZ = worldDefault.getCenterZ();
|
CenterZ = worldDefault.getCenterZ();
|
||||||
price = worldDefault.getPrice();
|
price = worldDefault.getPrice();
|
||||||
Biomes = worldDefault.getBiomes();
|
Biomes = worldDefault.getBiomes();
|
||||||
|
shape = worldDefault.getShape();
|
||||||
|
|
||||||
//Find Custom World and cache values
|
//Find Custom World and cache values
|
||||||
for (Map<?, ?> m : map) {
|
for (Map<?, ?> m : map) {
|
||||||
@ -85,6 +88,15 @@ public class WorldCustom implements RTPWorld {
|
|||||||
price = worldDefault.getPrice(world);
|
price = worldDefault.getPrice(world);
|
||||||
} else
|
} else
|
||||||
price = worldDefault.getPrice(world);
|
price = worldDefault.getPrice(world);
|
||||||
|
if (test.get("Shape") != null) {
|
||||||
|
if (test.get("Shape").getClass() == String.class) {
|
||||||
|
try {
|
||||||
|
this.shape = RTP_SHAPE.valueOf(test.get("Shape").toString().toUpperCase());
|
||||||
|
} catch (Exception e) {
|
||||||
|
//Invalid shape
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Booleans
|
//Booleans
|
||||||
@ -161,4 +173,9 @@ public class WorldCustom implements RTPWorld {
|
|||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return Bukkit.getWorld(world);
|
return Bukkit.getWorld(world);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RTP_SHAPE getShape() {
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.references.worlds;
|
package me.SuperRonanCraft.BetterRTP.references.worlds;
|
||||||
|
|
||||||
|
|
||||||
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_SHAPE;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -16,6 +17,7 @@ public class WorldDefault implements RTPWorld {
|
|||||||
private int CenterX, CenterZ, maxBorderRad, minBorderRad, price;
|
private int CenterX, CenterZ, maxBorderRad, minBorderRad, price;
|
||||||
private List<String> Biomes;
|
private List<String> Biomes;
|
||||||
private final HashMap<String, Integer> prices = new HashMap<>();
|
private final HashMap<String, Integer> prices = new HashMap<>();
|
||||||
|
private RTP_SHAPE shape;
|
||||||
|
|
||||||
public void setup() {
|
public void setup() {
|
||||||
//Setups
|
//Setups
|
||||||
@ -27,6 +29,11 @@ public class WorldDefault implements RTPWorld {
|
|||||||
CenterX = config.getInt(pre + ".CenterX");
|
CenterX = config.getInt(pre + ".CenterX");
|
||||||
CenterZ = config.getInt(pre + ".CenterZ");
|
CenterZ = config.getInt(pre + ".CenterZ");
|
||||||
maxBorderRad = config.getInt(pre + ".MaxRadius");
|
maxBorderRad = config.getInt(pre + ".MaxRadius");
|
||||||
|
try {
|
||||||
|
shape = RTP_SHAPE.valueOf(config.getString(pre + ".Shape").toUpperCase());
|
||||||
|
} catch (Exception e) {
|
||||||
|
shape = RTP_SHAPE.SQUARE;
|
||||||
|
}
|
||||||
if (maxBorderRad <= 0) {
|
if (maxBorderRad <= 0) {
|
||||||
BetterRTP.getInstance().getText().sms(Bukkit.getConsoleSender(),
|
BetterRTP.getInstance().getText().sms(Bukkit.getConsoleSender(),
|
||||||
"WARNING! Default Maximum radius of '" + maxBorderRad + "' is not allowed! Set to '1000'");
|
"WARNING! Default Maximum radius of '" + maxBorderRad + "' is not allowed! Set to '1000'");
|
||||||
@ -100,4 +107,9 @@ public class WorldDefault implements RTPWorld {
|
|||||||
public World getWorld() {
|
public World getWorld() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RTP_SHAPE getShape() {
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public class WorldPlayer implements RTPWorld {
|
|||||||
private final World world;
|
private final World world;
|
||||||
private WORLD_TYPE world_type;
|
private WORLD_TYPE world_type;
|
||||||
private RTPPermissionGroup.RTPPermConfiguration config = null;
|
private RTPPermissionGroup.RTPPermConfiguration config = null;
|
||||||
private RTP_SHAPE shape = RTP_SHAPE.SQUARE;
|
private RTP_SHAPE shape;
|
||||||
//Economy
|
//Economy
|
||||||
public boolean eco_money_taken = false;
|
public boolean eco_money_taken = false;
|
||||||
|
|
||||||
@ -36,6 +36,7 @@ public class WorldPlayer implements RTPWorld {
|
|||||||
setCenterZ(world.getCenterZ());
|
setCenterZ(world.getCenterZ());
|
||||||
setMaxRad(world.getMaxRad());
|
setMaxRad(world.getMaxRad());
|
||||||
setMinRad(world.getMinRad());
|
setMinRad(world.getMinRad());
|
||||||
|
setShape(world.getShape());
|
||||||
if (world instanceof WorldDefault)
|
if (world instanceof WorldDefault)
|
||||||
setPrice(((WorldDefault) world).getPrice(getWorld().getName()));
|
setPrice(((WorldDefault) world).getPrice(getWorld().getName()));
|
||||||
else
|
else
|
||||||
@ -114,8 +115,8 @@ public class WorldPlayer implements RTPWorld {
|
|||||||
public Location generateLocation() {
|
public Location generateLocation() {
|
||||||
Location loc = null;
|
Location loc = null;
|
||||||
switch (shape) {
|
switch (shape) {
|
||||||
//case ROUND: //DISABLED UNTIL NEXT PATCH
|
case CIRCLE: //DISABLED UNTIL NEXT PATCH
|
||||||
// loc = generateRound(getMaxRad(), getMinRad()); break;
|
loc = generateRound(getMaxRad(), getMinRad()); break;
|
||||||
default:
|
default:
|
||||||
loc = generateSquare(getMaxRad(), getMinRad()); break;
|
loc = generateSquare(getMaxRad(), getMinRad()); break;
|
||||||
}
|
}
|
||||||
@ -204,6 +205,11 @@ public class WorldPlayer implements RTPWorld {
|
|||||||
return Biomes;
|
return Biomes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RTP_SHAPE getShape() {
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
|
||||||
private void setUseWorldborder(boolean bool) {
|
private void setUseWorldborder(boolean bool) {
|
||||||
useWorldborder = bool;
|
useWorldborder = bool;
|
||||||
}
|
}
|
||||||
@ -243,6 +249,10 @@ public class WorldPlayer implements RTPWorld {
|
|||||||
this.world_type = type;
|
this.world_type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setShape(RTP_SHAPE shape) {
|
||||||
|
this.shape = shape;
|
||||||
|
}
|
||||||
|
|
||||||
public RTPPermissionGroup.RTPPermConfiguration getConfig() {
|
public RTPPermissionGroup.RTPPermConfiguration getConfig() {
|
||||||
return this.config;
|
return this.config;
|
||||||
}
|
}
|
||||||
|
@ -52,6 +52,7 @@ Default:
|
|||||||
## If "UseWorldBorder" is set to true above, Center X and Z will be ignored! #
|
## If "UseWorldBorder" is set to true above, Center X and Z will be ignored! #
|
||||||
CenterX: 0
|
CenterX: 0
|
||||||
CenterZ: 0
|
CenterZ: 0
|
||||||
|
Shape: 'square'
|
||||||
|
|
||||||
## Blocks BetterRTP will NOT teleport onto. More Blocks at: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html #
|
## Blocks BetterRTP will NOT teleport onto. More Blocks at: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Material.html #
|
||||||
BlacklistedBlocks:
|
BlacklistedBlocks:
|
||||||
@ -86,6 +87,7 @@ CustomWorlds:
|
|||||||
CenterX: 0
|
CenterX: 0
|
||||||
CenterZ: 0
|
CenterZ: 0
|
||||||
Price: 50
|
Price: 50
|
||||||
|
Shape: 'square'
|
||||||
- other_custom_world:
|
- other_custom_world:
|
||||||
MaxRadius: 10000
|
MaxRadius: 10000
|
||||||
MinRadius: 150
|
MinRadius: 150
|
||||||
@ -96,6 +98,7 @@ CustomWorlds:
|
|||||||
Biomes:
|
Biomes:
|
||||||
- 'desert'
|
- 'desert'
|
||||||
- 'forest'
|
- 'forest'
|
||||||
|
Shape: 'circle'
|
||||||
|
|
||||||
## Override a world and rtp a player executing the command in one world, to another
|
## Override a world and rtp a player executing the command in one world, to another
|
||||||
Overrides:
|
Overrides:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user