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>
<groupId>de.butzlabben.world</groupId>
<artifactId>WorldSystem</artifactId>
<version>2.4.0.1</version>
<version>2.4.0.3</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.number>-</project.build.number>

View File

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

View File

@ -26,9 +26,6 @@ public class DependenceConfig {
}
if (op == null) {
op = Bukkit.getOfflinePlayer(s);
if (op == null)
return;
}
this.op = op;
}
@ -88,10 +85,10 @@ public class DependenceConfig {
File dconfig = new File("plugins//WorldSystem//dependence.yml");
YamlConfiguration cfg = YamlConfiguration.loadConfiguration(dconfig);
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 false;
}

View File

@ -12,6 +12,8 @@ import org.bukkit.OfflinePlayer;
import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.google.common.base.Preconditions;
import de.butzlabben.world.WorldSystem;
@ -318,16 +320,23 @@ public class SystemWorld {
SystemWorld sw = SystemWorld.getSystemWorld(worldname);
sw.setCreating(true);
// For #16
WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> {
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));
//Run in scheduler so method returns without delay
new BukkitRunnable() {
@Override
public void run() {
// For #16
WorldSystem.getInstance().getAdapter().create(event.getWorldCreator(), sw, () -> {
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;
}