Adds 2 debug commands for checking material names.
Changes config.yml to use material names instead of IDs.
This commit is contained in:
@@ -29,6 +29,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisCommand;
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisCommand;
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisDebugGenerateTestHomesCommand;
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisDebugGenerateTestHomesCommand;
|
||||||
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisDebugGetMaterialCommand;
|
||||||
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisDebugMatchMaterialCommand;
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisFlagResetCommand;
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisFlagResetCommand;
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisHomeEvictCommand;
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisHomeEvictCommand;
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisHomeGenerateCommand;
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisHomeGenerateCommand;
|
||||||
@@ -284,6 +286,8 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
RegisterCommandHandler("metropolis", new MetropolisCommand(this));
|
RegisterCommandHandler("metropolis", new MetropolisCommand(this));
|
||||||
|
|
||||||
RegisterCommandHandler("metropolis-debug-generatetesthomes", new MetropolisDebugGenerateTestHomesCommand(this));
|
RegisterCommandHandler("metropolis-debug-generatetesthomes", new MetropolisDebugGenerateTestHomesCommand(this));
|
||||||
|
RegisterCommandHandler("metropolis-debug-getmaterial", new MetropolisDebugGetMaterialCommand(this));
|
||||||
|
RegisterCommandHandler("metropolis-debug-matchmaterial", new MetropolisDebugMatchMaterialCommand(this));
|
||||||
|
|
||||||
RegisterCommandHandler("metropolis-flag-reset", new MetropolisFlagResetCommand(this));
|
RegisterCommandHandler("metropolis-flag-reset", new MetropolisFlagResetCommand(this));
|
||||||
|
|
||||||
@@ -352,6 +356,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private Cuboid getCuboid(int row, int col) {
|
private Cuboid getCuboid(int row, int col) {
|
||||||
//This is only used for debug info
|
//This is only used for debug info
|
||||||
BlockVector min = getPlotMin(row, col, 1);
|
BlockVector min = getPlotMin(row, col, 1);
|
||||||
@@ -396,12 +401,10 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Material safeGetMaterialFromConfig(Configuration config, String name){
|
private Material safeGetMaterialFromConfig(Configuration config, String name){
|
||||||
Material material = null;
|
Material material = Material.AIR;
|
||||||
if(config.isInt(name)){
|
if(config.isString(name)){
|
||||||
material = Material.getMaterial(config.getInt(name));
|
material = Material.matchMaterial(config.getString(name));
|
||||||
}else if(config.isString(name)){
|
if(material == null){
|
||||||
material = Material.getMaterial(config.getString(name));
|
|
||||||
if(material== null){
|
|
||||||
material = Material.matchMaterial(config.getString(name));
|
material = Material.matchMaterial(config.getString(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1078,7 +1081,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void saveCurrentHomes() {
|
private void saveCurrentHomes() {
|
||||||
File outFile = new File(getDataFolder(), "currentHomes.yml");
|
//File outFile = new File(getDataFolder(), "currentHomes.yml");
|
||||||
|
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.majinnaibu.bukkitplugins.metropolis.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin;
|
||||||
|
|
||||||
|
public class MetropolisDebugGetMaterialCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private MetropolisPlugin _plugin;
|
||||||
|
|
||||||
|
public MetropolisDebugGetMaterialCommand(MetropolisPlugin plugin) {
|
||||||
|
_plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
try {
|
||||||
|
sender.sendMessage(String.format("Material.getMaterial(\"%s\") returns \"%s\"", args[0], Material.getMaterial(args[0])));
|
||||||
|
return true;
|
||||||
|
} catch(Exception ex) {
|
||||||
|
_plugin.getLogger().log(Level.ALL, "Error", ex);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.majinnaibu.bukkitplugins.metropolis.commands;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin;
|
||||||
|
|
||||||
|
public class MetropolisDebugMatchMaterialCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private MetropolisPlugin _plugin;
|
||||||
|
|
||||||
|
public MetropolisDebugMatchMaterialCommand(MetropolisPlugin plugin) {
|
||||||
|
_plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
try {
|
||||||
|
sender.sendMessage(String.format("Material.getMaterial(\"%s\") returns \"%s\"", String.join(" ", args), Material.matchMaterial(args[0])));
|
||||||
|
return true;
|
||||||
|
} catch(Exception ex) {
|
||||||
|
_plugin.getLogger().log(Level.ALL, "Error", ex);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package com.majinnaibu.bukkitplugins.metropolis.util;
|
|
||||||
|
|
||||||
public class Material {
|
|
||||||
public static final int signTypeId = 63;
|
|
||||||
}
|
|
||||||
@@ -4,26 +4,27 @@ plot:
|
|||||||
sizeZ: 32
|
sizeZ: 32
|
||||||
offsetX: 0
|
offsetX: 0
|
||||||
offsetY: 0
|
offsetY: 0
|
||||||
offsetZ: 0
|
offsetZ: 0
|
||||||
multiplier: 1
|
multiplier: 1
|
||||||
maxPerPlayer: 1
|
maxPerPlayer: 1
|
||||||
initial: 1
|
initial: 1
|
||||||
floor:
|
floor:
|
||||||
generate: true
|
generate: true
|
||||||
|
clearSpaceAbove: 66
|
||||||
material: GRASS
|
material: GRASS
|
||||||
supports:
|
supports:
|
||||||
generate: true
|
generate: true
|
||||||
generate: true
|
material: STONE
|
||||||
sign:
|
sign:
|
||||||
generate: true
|
generate: true
|
||||||
generate: true
|
road:
|
||||||
width: 4
|
width: 4
|
||||||
clearSpaceAbove: 66
|
clearSpaceAbove: 66
|
||||||
level: 62
|
level: 62
|
||||||
level: 62
|
material: COBBLESTONE
|
||||||
supports:
|
supports:
|
||||||
generate: true
|
generate: true
|
||||||
generate: true
|
material: STONE
|
||||||
spawn:
|
spawn:
|
||||||
generate: true
|
generate: true
|
||||||
setAsWorldSpawn: true
|
setAsWorldSpawn: true
|
||||||
|
|||||||
Reference in New Issue
Block a user