mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
worlds with spaces support implementation
This commit is contained in:
parent
c41b3bd2c0
commit
dbdf7d6a60
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<version>2.14.3</version>
|
||||
<version>2.14.4</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
@ -25,10 +25,12 @@ public class CmdWorld implements RTPCommand, RTPCommandHelpable {
|
||||
public List<String> tabComplete(CommandSender sendi, String[] args) {
|
||||
List<String> list = new ArrayList<>();
|
||||
if (args.length == 2) {
|
||||
for (World w : Bukkit.getWorlds())
|
||||
if (w.getName().startsWith(args[1]) && !Main.getInstance().getRTP().disabledWorlds().contains(w.getName()) &&
|
||||
Main.getInstance().getPerms().getAWorld(sendi, w.getName()))
|
||||
list.add(w.getName());
|
||||
for (World w : Bukkit.getWorlds()) {
|
||||
String _wName = w.getName().replace(" ", "_");
|
||||
if (w.getName().startsWith(args[1]) && !Main.getInstance().getRTP().disabledWorlds().contains(_wName)
|
||||
&& Main.getInstance().getPerms().getAWorld(sendi, _wName))
|
||||
list.add(_wName);
|
||||
}
|
||||
} else if (args.length >= 3) {
|
||||
if (CommandTypes.BIOME.getCmd().permission(sendi))
|
||||
getCmd().addBiomes(list, args);
|
||||
|
@ -116,18 +116,18 @@ public class RTP {
|
||||
return disabledWorlds;
|
||||
}
|
||||
|
||||
public WorldPlayer getPlayerWorld(CommandSender p, String worldName, List<String> biomes, boolean personal) {
|
||||
WorldPlayer pWorld = new WorldPlayer(p, Bukkit.getWorld(worldName));
|
||||
public WorldPlayer getPlayerWorld(CommandSender sendi, String world_name, List<String> biomes, boolean personal) {
|
||||
WorldPlayer pWorld = new WorldPlayer(sendi, Bukkit.getWorld(world_name));
|
||||
// Set all methods
|
||||
if (customWorlds.containsKey(worldName)) {
|
||||
if (customWorlds.containsKey(world_name)) {
|
||||
RTPWorld cWorld = customWorlds.get(pWorld.getWorld().getName());
|
||||
pWorld.setup(cWorld, cWorld.getPrice(), biomes, personal);
|
||||
} else
|
||||
pWorld.setup(defaultWorld, defaultWorld.getPrice(), biomes, personal);
|
||||
//World type
|
||||
WORLD_TYPE world_type = WORLD_TYPE.NORMAL; //World rtp type
|
||||
if (this.world_type.containsKey(worldName))
|
||||
world_type = this.world_type.get(worldName);
|
||||
if (this.world_type.containsKey(world_name))
|
||||
world_type = this.world_type.get(world_name);
|
||||
pWorld.setWorldtype(world_type);
|
||||
return pWorld;
|
||||
}
|
||||
@ -138,8 +138,19 @@ public class RTP {
|
||||
|
||||
public void start(Player p, CommandSender sendi, String world_name, List<String> biomes, boolean delay) {
|
||||
// Check overrides
|
||||
if (world_name == null)
|
||||
if (world_name == null) {
|
||||
world_name = p.getWorld().getName();
|
||||
} else { // Check if nulled or world doesnt exist
|
||||
World _world = Bukkit.getWorld(world_name);
|
||||
if (_world == null) { //Check if world has spaces instead of underscores
|
||||
_world = Bukkit.getWorld(world_name.replace("_", " "));
|
||||
world_name = world_name.replace("_", "");
|
||||
}
|
||||
if (_world == null) {
|
||||
getPl().getText().getNotExist(sendi, world_name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (overriden.containsKey(world_name))
|
||||
world_name = overriden.get(world_name);
|
||||
// Not forced and has 'betterrtp.world.<world>'
|
||||
@ -152,11 +163,6 @@ public class RTP {
|
||||
getPl().getText().getDisabledWorld(sendi, world_name);
|
||||
return;
|
||||
}
|
||||
// Check if nulled or world doesnt exist
|
||||
if (Bukkit.getWorld(world_name) == null) {
|
||||
getPl().getText().getNotExist(sendi, world_name);
|
||||
return;
|
||||
}
|
||||
WorldPlayer pWorld = getPlayerWorld(p, world_name, biomes, true);
|
||||
// Economy
|
||||
if (!getPl().getEco().hasBalance(sendi, pWorld)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
main: me.SuperRonanCraft.BetterRTP.Main
|
||||
version: '2.14.3'
|
||||
version: '2.14.4'
|
||||
name: BetterRTP
|
||||
author: SuperRonanCraft
|
||||
softdepend: [Vault, WorldGuard, GriefPrevention, Towny, Factions, RedProtect, Lands, Residence]
|
||||
|
Loading…
x
Reference in New Issue
Block a user