Cleanup
This commit is contained in:
parent
c43598dd2f
commit
017e559641
3 changed files with 2 additions and 37 deletions
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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);
|
||||||
|
|
|
@ -4,7 +4,3 @@ 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
|
|
Loading…
Reference in a new issue