This commit is contained in:
Norbi Peti 2020-11-05 15:48:47 +01:00
parent c43598dd2f
commit 017e559641
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
3 changed files with 2 additions and 37 deletions

View file

@ -1,30 +0,0 @@
package buttondevteam.customdimensions;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public class CDCommand implements CommandExecutor {
private final CustomDimensions plugin;
public CDCommand(CustomDimensions plugin) {this.plugin = plugin;}
@Override
public boolean onCommand(CommandSender sender, Command command, String alias, String[] args) {
sender.sendMessage("§bLoading custom dimensions...");
sender.sendMessage("To reload a dimension, specify its name after the command");
try {
if (args.length > 0)
if (!Bukkit.unloadWorld(args[0], true))
sender.sendMessage("§cFailed to unload world " + args[0]);
plugin.reloadConfig(); //Reload ignore list
plugin.load();
} catch (Exception e) {
e.printStackTrace();
}
sender.sendMessage("§bFinished loading custom dimensions!");
sender.sendMessage("See the console for more details");
return true;
}
}

View file

@ -20,7 +20,6 @@ import java.util.*;
public class CustomDimensions extends JavaPlugin implements Listener { public class CustomDimensions extends JavaPlugin implements Listener {
@Override @Override
public void onEnable() { public void onEnable() {
//Objects.requireNonNull(getCommand("cdload")).setExecutor(new CDCommand(this)); - dimensions aren't updated on /minecraft:reload
getLogger().info("Loading custom dimensions..."); getLogger().info("Loading custom dimensions...");
try { try {
load(); load();
@ -30,7 +29,7 @@ public class CustomDimensions extends JavaPlugin implements Listener {
getLogger().info("Finished loading custom dimensions!"); getLogger().info("Finished loading custom dimensions!");
} }
public void load() throws Exception { private void load() throws Exception {
var console = ((CraftServer) Bukkit.getServer()).getServer(); var console = ((CraftServer) Bukkit.getServer()).getServer();
var field = console.getClass().getSuperclass().getDeclaredField("saveData"); var field = console.getClass().getSuperclass().getDeclaredField("saveData");
field.setAccessible(true); field.setAccessible(true);

View file

@ -3,8 +3,4 @@ main: buttondevteam.customdimensions.CustomDimensions
version: '1.4' version: '1.4'
api-version: '1.16' api-version: '1.16'
loadbefore: loadbefore:
- Multiverse-Core - Multiverse-Core
#commands:
# cdload:
# description: Load custom dimensions that aren't loaded at the moment
# permission: customdimensions.load