2.4.0.3 - Fixed bug #40

This commit is contained in:
Butzlabben 2018-10-29 18:36:48 +01:00
parent 685a965629
commit e48777bcc5
4 changed files with 23 additions and 17 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>de.butzlabben.world</groupId> <groupId>de.butzlabben.world</groupId>
<artifactId>WorldSystem</artifactId> <artifactId>WorldSystem</artifactId>
<version>2.4.0.1</version> <version>2.4.0.3</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>-</project.build.number> <project.build.number>-</project.build.number>

View File

@ -25,7 +25,7 @@ public class WSGetCommand implements CommandExecutor {
return true; return true;
} }
Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> { Bukkit.getScheduler().runTask(WorldSystem.getInstance(), () -> {
if(SystemWorld.create(p)) if (SystemWorld.create(p))
p.sendMessage(MessageConfig.getSettingUpWorld()); p.sendMessage(MessageConfig.getSettingUpWorld());
}); });
return true; return true;

View File

@ -26,9 +26,6 @@ public class DependenceConfig {
} }
if (op == null) { if (op == null) {
op = Bukkit.getOfflinePlayer(s); op = Bukkit.getOfflinePlayer(s);
if (op == null)
return;
} }
this.op = op; this.op = op;
} }
@ -88,10 +85,10 @@ public class DependenceConfig {
File dconfig = new File("plugins//WorldSystem//dependence.yml"); File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig); YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
String uuid = op.getUniqueId().toString(); String uuid = op.getUniqueId().toString();
String entry = cfg.getString("Dependences." + uuid + ".ActualName");
if (entry != null) { //Fix for #40
if (cfg.isInt("Dependences." + uuid + ".ID"))
return true; return true;
}
return false; return false;
} }

View File

@ -12,6 +12,8 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import de.butzlabben.world.WorldSystem; import de.butzlabben.world.WorldSystem;
@ -318,16 +320,23 @@ public class SystemWorld {
SystemWorld sw = SystemWorld.getSystemWorld(worldname); SystemWorld sw = SystemWorld.getSystemWorld(worldname);
sw.setCreating(true); sw.setCreating(true);
// For #16
WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> { //Run in scheduler so method returns without delay
if (p != null && p.isOnline()) { new BukkitRunnable() {
p.sendMessage(MessageConfig.getWorldCreated()); @Override
SettingsConfig.getCommandsonGet().stream() public void run() {
.map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName()).replace("%uuid", // For #16
p.getUniqueId().toString())) WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> {
.forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s)); if (p != null && p.isOnline()) {
p.sendMessage(MessageConfig.getWorldCreated());
SettingsConfig.getCommandsonGet().stream()
.map(s -> s.replace("%player", p.getName()).replace("%world", sw.getName()).replace("%uuid",
p.getUniqueId().toString()))
.forEach(s -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), s));
}
});
} }
}); }.runTaskLater(WorldSystem.getInstance(), 1);
} }
return true; return true;
} }