Use plugin logger for diagnostics
This commit is contained in:
2
TODO.md
2
TODO.md
@@ -11,7 +11,7 @@
|
|||||||
| MET-007 | Ready | Update .gitignore for Gradle and remove obsolete Maven and Eclipse project files after the Gradle build succeeds. |
|
| MET-007 | Ready | Update .gitignore for Gradle and remove obsolete Maven and Eclipse project files after the Gradle build succeeds. |
|
||||||
| MET-008 | Done | Analyze Java sources for deprecated or removed Bukkit/Paper APIs and legacy patterns, including logging, event registration, configuration, player lookup, and player-keyed storage. |
|
| MET-008 | Done | Analyze Java sources for deprecated or removed Bukkit/Paper APIs and legacy patterns, including logging, event registration, configuration, player lookup, and player-keyed storage. |
|
||||||
| MET-009 | Done | Review custom scripts and resources for required updates to the Gradle build and modern Paper server workflow. |
|
| MET-009 | Done | Review custom scripts and resources for required updates to the Gradle build and modern Paper server workflow. |
|
||||||
| MET-010 | Ready | Refactor plugin logging to use JavaPlugin.getLogger(). |
|
| MET-010 | Done | Refactor plugin logging to use JavaPlugin.getLogger(). |
|
||||||
| MET-011 | Ready | Refactor event listeners and registration to use Listener, @EventHandler, and the modern plugin manager API. |
|
| MET-011 | Ready | Refactor event listeners and registration to use Listener, @EventHandler, and the modern plugin manager API. |
|
||||||
| MET-012 | Ready | Replace deprecated configuration APIs with the modern Bukkit/Paper configuration API, including load, save, and reload behavior. |
|
| MET-012 | Ready | Replace deprecated configuration APIs with the modern Bukkit/Paper configuration API, including load, save, and reload behavior. |
|
||||||
| MET-013 | Ready | Replace Player-keyed storage with UUID-based storage wherever player identity is persisted or tracked. |
|
| MET-013 | Ready | Replace Player-keyed storage with UUID-based storage wherever player identity is persisted or tracked. |
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.majinnaibu.bukkitplugins.metropolis;
|
package com.majinnaibu.bukkitplugins.metropolis;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
|
|
||||||
@@ -97,21 +96,15 @@ public class Cuboid implements Comparable<Cuboid> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int compareBlockVectors(BlockVector v1, BlockVector v2){
|
public static int compareBlockVectors(BlockVector v1, BlockVector v2){
|
||||||
Logger log = Logger.getLogger("Minecraft");
|
|
||||||
|
|
||||||
if(v1 == null){
|
if(v1 == null){
|
||||||
if(v2 == null){
|
if(v2 == null){
|
||||||
log.info("in Cuboid.compareBlockVectors v1 and v2 are null");
|
|
||||||
return 0;
|
return 0;
|
||||||
}else{
|
}else{
|
||||||
log.info("in Cubiod.compareBlockVectors v1 is null");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}else if(v2 == null){
|
}else if(v2 == null){
|
||||||
log.info("in Cubiod.compareBlockVectors v2 is null");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
log.info(String.format("v1.x: %d, v1.y: %d, v1.z: %d, v2.x: %d, v2.y: %d, v2.z: %d", v1.getBlockX(), v1.getBlockY(), v1.getBlockZ(), v2.getBlockX(), v2.getBlockY(), v2.getBlockZ()));
|
|
||||||
if(v1.getBlockX() < v2.getBlockX()){
|
if(v1.getBlockX() < v2.getBlockX()){
|
||||||
return -1;
|
return -1;
|
||||||
}else if(v1.getBlockX() > v2.getBlockX()){
|
}else if(v1.getBlockX() > v2.getBlockX()){
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -52,7 +51,6 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
|||||||
|
|
||||||
public class MetropolisPlugin extends JavaPlugin {
|
public class MetropolisPlugin extends JavaPlugin {
|
||||||
public static final boolean DEBUG = false;
|
public static final boolean DEBUG = false;
|
||||||
public static final Logger log=Logger.getLogger("Minecraft");
|
|
||||||
private static final int version = 1;
|
private static final int version = 1;
|
||||||
|
|
||||||
public static final int ROAD_NORTH=1;
|
public static final int ROAD_NORTH=1;
|
||||||
@@ -111,7 +109,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
log.info(String.format("%s disabled", pdf.getFullName()));
|
getLogger().info(String.format("%s disabled", pdf.getFullName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -123,21 +121,21 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
_currentHomes = new HashMap<String, Integer>();
|
_currentHomes = new HashMap<String, Integer>();
|
||||||
loadCurrentHomes();
|
loadCurrentHomes();
|
||||||
|
|
||||||
if(DEBUG){log.info("Checking config");}
|
if(DEBUG){getLogger().info("Checking config");}
|
||||||
Configuration config = getConfig();
|
Configuration config = getConfig();
|
||||||
if(!config.contains("version")){
|
if(!config.contains("version")){
|
||||||
//new
|
//new
|
||||||
if(DEBUG){log.info("No config exists. Assuming new installation.");}
|
if(DEBUG){getLogger().info("No config exists. Assuming new installation.");}
|
||||||
}else{
|
}else{
|
||||||
int configVersion = safeGetIntFromConfig(config, "version");
|
int configVersion = safeGetIntFromConfig(config, "version");
|
||||||
if(configVersion < version){
|
if(configVersion < version){
|
||||||
if(DEBUG){log.info(String.format("Updating config from version v%s to v%s.", configVersion, version));}
|
if(DEBUG){getLogger().info(String.format("Updating config from version v%s to v%s.", configVersion, version));}
|
||||||
if(configVersion != version){
|
if(configVersion != version){
|
||||||
//upgrade config
|
//upgrade config
|
||||||
config.set("version", version);
|
config.set("version", version);
|
||||||
}
|
}
|
||||||
saveConfig();
|
saveConfig();
|
||||||
if(DEBUG){log.info("Config updated");}
|
if(DEBUG){getLogger().info("Config updated");}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +144,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
config.options().copyDefaults(true);
|
config.options().copyDefaults(true);
|
||||||
|
|
||||||
if(DEBUG){log.info("Reading configuration from file.");}
|
if(DEBUG){getLogger().info("Reading configuration from file.");}
|
||||||
plotSizeX = safeGetIntFromConfig(config, "plot.sizeX");
|
plotSizeX = safeGetIntFromConfig(config, "plot.sizeX");
|
||||||
plotSizeZ = safeGetIntFromConfig(config, "plot.sizeZ");
|
plotSizeZ = safeGetIntFromConfig(config, "plot.sizeZ");
|
||||||
generateFloor = safeGetBooleanFromConfig(config, "plot.floor.generate");
|
generateFloor = safeGetBooleanFromConfig(config, "plot.floor.generate");
|
||||||
@@ -174,9 +172,9 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
buildUserOverrides();
|
buildUserOverrides();
|
||||||
|
|
||||||
saveConfig();
|
saveConfig();
|
||||||
if(DEBUG){log.info("Done reading config.");}
|
if(DEBUG){getLogger().info("Done reading config.");}
|
||||||
|
|
||||||
log.info(String.format("Metropolis: world name is %s", worldName));
|
getLogger().info(String.format("Metropolis: world name is %s", worldName));
|
||||||
|
|
||||||
Server server = getServer();
|
Server server = getServer();
|
||||||
if(server == null){
|
if(server == null){
|
||||||
@@ -258,18 +256,18 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
if(DEBUG){
|
if(DEBUG){
|
||||||
/*
|
/*
|
||||||
log.info("Metropolis: first 25 plots");
|
getLogger().info("Metropolis: first 25 plots");
|
||||||
|
|
||||||
int n = 5;
|
int n = 5;
|
||||||
|
|
||||||
for (int ix=-n; ix<=n; ix++){
|
for (int ix=-n; ix<=n; ix++){
|
||||||
for (int iz=-n; iz<=n; iz++){
|
for (int iz=-n; iz<=n; iz++){
|
||||||
log.info(getCuboid(iz, ix).toString());
|
getLogger().info(getCuboid(iz, ix).toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
log.info(String.format("roadWidth = %d", roadWidth));
|
getLogger().info(String.format("roadWidth = %d", roadWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
_occupiedPlots = new ArrayList<Plot>();
|
_occupiedPlots = new ArrayList<Plot>();
|
||||||
@@ -280,7 +278,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
_playerJoinListener = new PlayerJoinListener(this);
|
_playerJoinListener = new PlayerJoinListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info(String.format("%s enabled", pdf.getFullName()));
|
getLogger().info(String.format("%s enabled", pdf.getFullName()));
|
||||||
|
|
||||||
RegisterCommandHandler("metropolis", new MetropolisCommand(this));
|
RegisterCommandHandler("metropolis", new MetropolisCommand(this));
|
||||||
|
|
||||||
@@ -304,7 +302,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
processor.load();
|
processor.load();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.info(e.toString());
|
getLogger().info(e.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -412,12 +410,12 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void throwInvalidConfigException() {
|
private void throwInvalidConfigException() {
|
||||||
log.info("Metropolis: ERROR config file is invalid. Please correct Metropolis/config.yml and restart the server.");
|
getLogger().info("Metropolis: ERROR config file is invalid. Please correct Metropolis/config.yml and restart the server.");
|
||||||
throw new RuntimeException("Config file is invalid.");
|
throw new RuntimeException("Config file is invalid.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupSpawn() {
|
private void setupSpawn() {
|
||||||
log.info("Metropolis: Spawn Cuboid is " + _spawnCuboid.toString());
|
getLogger().info("Metropolis: Spawn Cuboid is " + _spawnCuboid.toString());
|
||||||
|
|
||||||
if(generateSpawn){
|
if(generateSpawn){
|
||||||
int x= 0;
|
int x= 0;
|
||||||
@@ -495,7 +493,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
if(homeRegion == null){
|
if(homeRegion == null){
|
||||||
if(DEBUG){
|
if(DEBUG){
|
||||||
log.info(String.format("Creating home for player %s", player.getName()));
|
getLogger().info(String.format("Creating home for player %s", player.getName()));
|
||||||
}
|
}
|
||||||
home = generateHome(player.getName());
|
home = generateHome(player.getName());
|
||||||
}else{
|
}else{
|
||||||
@@ -529,7 +527,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setFloor(int x, int y, int z) {
|
private void setFloor(int x, int y, int z) {
|
||||||
//if(DEBUG){log.info(String.format("setting road at (%d, %d, %d)", x, y, z));}
|
//if(DEBUG){getLogger().info(String.format("setting road at (%d, %d, %d)", x, y, z));}
|
||||||
|
|
||||||
Block block = world.getBlockAt(x, y, z);
|
Block block = world.getBlockAt(x, y, z);
|
||||||
|
|
||||||
@@ -553,7 +551,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
if(plotCuboid == null){
|
if(plotCuboid == null){
|
||||||
if(DEBUG){
|
if(DEBUG){
|
||||||
log.warning("plotCuboid is null");
|
getLogger().warning("plotCuboid is null");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -640,7 +638,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setRoad(int x, int y, int z) {
|
private void setRoad(int x, int y, int z) {
|
||||||
//if(DEBUG){log.info(String.format("setting road at (%d, %d, %d)", x, y, z));}
|
//if(DEBUG){getLogger().info(String.format("setting road at (%d, %d, %d)", x, y, z));}
|
||||||
|
|
||||||
Block block = world.getBlockAt(x, y, z);
|
Block block = world.getBlockAt(x, y, z);
|
||||||
//Set the road block
|
//Set the road block
|
||||||
@@ -718,7 +716,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
//Top
|
//Top
|
||||||
for(col = min; col <= max; col++){
|
for(col = min; col <= max; col++){
|
||||||
if(!areBlocksOccupied(row, col, plotMultiplier)){
|
if(!areBlocksOccupied(row, col, plotMultiplier)){
|
||||||
if(DEBUG){log.info(String.format("row: %d, col: %d", row, col));}
|
if(DEBUG){getLogger().info(String.format("row: %d, col: %d", row, col));}
|
||||||
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -727,7 +725,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
col = max;
|
col = max;
|
||||||
for(row=min + 1; row < max; row++){
|
for(row=min + 1; row < max; row++){
|
||||||
if(!areBlocksOccupied(row, col, plotMultiplier)){
|
if(!areBlocksOccupied(row, col, plotMultiplier)){
|
||||||
if(DEBUG){log.info(String.format("row: %d, col: %d", row, col));}
|
if(DEBUG){getLogger().info(String.format("row: %d, col: %d", row, col));}
|
||||||
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -736,7 +734,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
row = max;
|
row = max;
|
||||||
for(col = max; col >= min; col--){
|
for(col = max; col >= min; col--){
|
||||||
if(!areBlocksOccupied(row, col, plotMultiplier)){
|
if(!areBlocksOccupied(row, col, plotMultiplier)){
|
||||||
if(DEBUG){log.info(String.format("row: %d, col: %d", row, col));}
|
if(DEBUG){getLogger().info(String.format("row: %d, col: %d", row, col));}
|
||||||
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -746,7 +744,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
for(row = max; row > min; row--){
|
for(row = max; row > min; row--){
|
||||||
if(!areBlocksOccupied(row, col, plotMultiplier)){
|
if(!areBlocksOccupied(row, col, plotMultiplier)){
|
||||||
if(row != 0 || col != 0){
|
if(row != 0 || col != 0){
|
||||||
if(DEBUG){log.info(String.format("row: %d, col: %d", row, col));}
|
if(DEBUG){getLogger().info(String.format("row: %d, col: %d", row, col));}
|
||||||
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -757,7 +755,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
max = ring - (plotMultiplier-1);
|
max = ring - (plotMultiplier-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG){log.info(String.format("row: %d, col: %d", row, col));}
|
if(DEBUG){getLogger().info(String.format("row: %d, col: %d", row, col));}
|
||||||
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
return new Cuboid(getPlotMin(row, col, plotMultiplier), getPlotMax(row, col, plotMultiplier));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,11 +782,11 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
for(Plot home: _occupiedPlots){
|
for(Plot home: _occupiedPlots){
|
||||||
int plotCol=Math.abs(getPlotXFromMin(home.getCuboid()));
|
int plotCol=Math.abs(getPlotXFromMin(home.getCuboid()));
|
||||||
int plotRow=Math.abs(getPlotZFromMin(home.getCuboid()));
|
int plotRow=Math.abs(getPlotZFromMin(home.getCuboid()));
|
||||||
if(DEBUG){log.info(String.format("col: %d, row: %d, iSize: %d", plotCol, plotRow, iSize));}
|
if(DEBUG){getLogger().info(String.format("col: %d, row: %d, iSize: %d", plotCol, plotRow, iSize));}
|
||||||
iSize = Math.max(Math.max(plotRow*2+1, plotCol*2+1), iSize);
|
iSize = Math.max(Math.max(plotRow*2+1, plotCol*2+1), iSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG){log.info(String.format("City size is %d", iSize));}
|
if(DEBUG){getLogger().info(String.format("City size is %d", iSize));}
|
||||||
return iSize;
|
return iSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -796,7 +794,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
BlockVector gridMin = getGridMin(row, col, plotMultiplier);
|
BlockVector gridMin = getGridMin(row, col, plotMultiplier);
|
||||||
|
|
||||||
BlockVector bv = new BlockVector(gridMin.getBlockX() + roadWidth/2, gridMin.getBlockY(), gridMin.getBlockZ() + roadWidth/2);
|
BlockVector bv = new BlockVector(gridMin.getBlockX() + roadWidth/2, gridMin.getBlockY(), gridMin.getBlockZ() + roadWidth/2);
|
||||||
log.info(String.format("getPlotMin (%d, %d, %d)", bv.getBlockX(), bv.getBlockY(), bv.getBlockZ()));
|
getLogger().info(String.format("getPlotMin (%d, %d, %d)", bv.getBlockX(), bv.getBlockY(), bv.getBlockZ()));
|
||||||
return bv;
|
return bv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -804,7 +802,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
BlockVector gridMax = getGridMax(row, col, plotMultiplier);
|
BlockVector gridMax = getGridMax(row, col, plotMultiplier);
|
||||||
|
|
||||||
BlockVector bv = new BlockVector(gridMax.getBlockX() - (roadWidth - roadWidth/2), gridMax.getBlockY(), gridMax.getBlockZ() - (roadWidth-roadWidth/2));
|
BlockVector bv = new BlockVector(gridMax.getBlockX() - (roadWidth - roadWidth/2), gridMax.getBlockY(), gridMax.getBlockZ() - (roadWidth-roadWidth/2));
|
||||||
log.info(String.format("getPlotMax (%d, %d, %d)", bv.getBlockX(), bv.getBlockY(), bv.getBlockZ()));
|
getLogger().info(String.format("getPlotMax (%d, %d, %d)", bv.getBlockX(), bv.getBlockY(), bv.getBlockZ()));
|
||||||
return bv;
|
return bv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -812,7 +810,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
BlockVector bv = new BlockVector(col * gridSizeX, level * gridSizeY, row * gridSizeZ);
|
BlockVector bv = new BlockVector(col * gridSizeX, level * gridSizeY, row * gridSizeZ);
|
||||||
log.info(String.format("getGridMin (%d, %d, %d)", bv.getBlockX(), bv.getBlockY(), bv.getBlockZ()));
|
getLogger().info(String.format("getGridMin (%d, %d, %d)", bv.getBlockX(), bv.getBlockY(), bv.getBlockZ()));
|
||||||
return bv;
|
return bv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,7 +818,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
BlockVector bv = new BlockVector((col+plotMultiplier) * gridSizeX*plotMultiplier-1, (level+1/*plotMultiplier*/) * gridSizeY-1, (row+plotMultiplier) * gridSizeZ-1);
|
BlockVector bv = new BlockVector((col+plotMultiplier) * gridSizeX*plotMultiplier-1, (level+1/*plotMultiplier*/) * gridSizeY-1, (row+plotMultiplier) * gridSizeZ-1);
|
||||||
log.info(String.format("getGridMax (%d, %d, %d)", bv.getBlockX(), bv.getBlockY(), bv.getBlockZ()));
|
getLogger().info(String.format("getGridMax (%d, %d, %d)", bv.getBlockX(), bv.getBlockY(), bv.getBlockZ()));
|
||||||
return bv;
|
return bv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -843,7 +841,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
public PlayerHome generateHome(String playerName) {
|
public PlayerHome generateHome(String playerName) {
|
||||||
int multiplier = getPlotMultiplier(playerName);
|
int multiplier = getPlotMultiplier(playerName);
|
||||||
|
|
||||||
if(DEBUG){log.info(String.format("Generating home for %s", playerName));}
|
if(DEBUG){getLogger().info(String.format("Generating home for %s", playerName));}
|
||||||
Cuboid homeCuboid = null;
|
Cuboid homeCuboid = null;
|
||||||
ProtectedRegion phomeRegion = null;
|
ProtectedRegion phomeRegion = null;
|
||||||
String regionName = "h_1_" + playerName;
|
String regionName = "h_1_" + playerName;
|
||||||
@@ -854,7 +852,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
|
|
||||||
homeCuboid = findNextUnownedHomeRegion(multiplier);
|
homeCuboid = findNextUnownedHomeRegion(multiplier);
|
||||||
|
|
||||||
log.info("Metropolis Generating home in " + homeCuboid.toString());
|
getLogger().info("Metropolis Generating home in " + homeCuboid.toString());
|
||||||
|
|
||||||
ProtectedCuboidRegion newHomeRegion = new ProtectedCuboidRegion(regionName, homeCuboid.getMin(), homeCuboid.getMax());
|
ProtectedCuboidRegion newHomeRegion = new ProtectedCuboidRegion(regionName, homeCuboid.getMin(), homeCuboid.getMax());
|
||||||
newHomeRegion.setFlag(DefaultFlag.PVP, StateFlag.State.DENY);
|
newHomeRegion.setFlag(DefaultFlag.PVP, StateFlag.State.DENY);
|
||||||
@@ -873,17 +871,17 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
regionManager.save();
|
regionManager.save();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("Metropolis: ERROR Problem saving region");
|
getLogger().info("Metropolis: ERROR Problem saving region");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
regionManager.save();
|
regionManager.save();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("Metropolis: ERROR Problem saving region");
|
getLogger().info("Metropolis: ERROR Problem saving region");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
log.info(String.format(
|
getLogger().info(String.format(
|
||||||
"New home region (%d, %d, %d) (%d, %d, %d)",
|
"New home region (%d, %d, %d) (%d, %d, %d)",
|
||||||
newHomeRegion.getMinimumPoint().getBlockX(),
|
newHomeRegion.getMinimumPoint().getBlockX(),
|
||||||
newHomeRegion.getMinimumPoint().getBlockY(),
|
newHomeRegion.getMinimumPoint().getBlockY(),
|
||||||
@@ -901,12 +899,12 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
generateFloor(homeCuboid);
|
generateFloor(homeCuboid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG){log.info(String.format("generateSign: %s", String.valueOf(generateSign)));}
|
if(DEBUG){getLogger().info(String.format("generateSign: %s", String.valueOf(generateSign)));}
|
||||||
if(generateSign){
|
if(generateSign){
|
||||||
generateSign(homeCuboid, playerName);
|
generateSign(homeCuboid, playerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(DEBUG){log.info(String.format("Done generating home for %s", playerName));}
|
if(DEBUG){getLogger().info(String.format("Done generating home for %s", playerName));}
|
||||||
|
|
||||||
return new PlayerHome(newHomeRegion);
|
return new PlayerHome(newHomeRegion);
|
||||||
}
|
}
|
||||||
@@ -983,7 +981,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
try{
|
try{
|
||||||
regionManager.removeRegion(regionId);
|
regionManager.removeRegion(regionId);
|
||||||
}catch(Exception ex){
|
}catch(Exception ex){
|
||||||
log.info(String.format("[ERROR] Metropolis: Unable to remove region {%s}.", regionId));
|
getLogger().info(String.format("[ERROR] Metropolis: Unable to remove region {%s}.", regionId));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -992,7 +990,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
try {
|
try {
|
||||||
regionManager.save();
|
regionManager.save();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
log.info(String.format("[SEVERE] Metropolis: Unable to save WorldGuard regions."));
|
getLogger().info(String.format("[SEVERE] Metropolis: Unable to save WorldGuard regions."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ public class PlayerJoinListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerHome home = _plugin.getPlayerHome(player);
|
PlayerHome home = _plugin.getPlayerHome(player);
|
||||||
if(home==null){MetropolisPlugin.log.info("home is null");}
|
if(home==null){_plugin.getLogger().info("home is null");}
|
||||||
else if(home.getCuboid() == null){MetropolisPlugin.log.info("home.getCuboid() is null");}
|
else if(home.getCuboid() == null){_plugin.getLogger().info("home.getCuboid() is null");}
|
||||||
else if(home.getCuboid().getVolume() == 0){MetropolisPlugin.log.info("home.getCuboid().getVolume() is 0");}
|
else if(home.getCuboid().getVolume() == 0){_plugin.getLogger().info("home.getCuboid().getVolume() is 0");}
|
||||||
|
|
||||||
if(home == null || home.getCuboid() == null || home.getCuboid().getVolume() == 0){
|
if(home == null || home.getCuboid() == null || home.getCuboid().getVolume() == 0){
|
||||||
MetropolisPlugin.log.info(String.format("Metropolis: Unable to get or create home for player %s", player.getName()));
|
_plugin.getLogger().info(String.format("Metropolis: Unable to get or create home for player %s", player.getName()));
|
||||||
}else{
|
}else{
|
||||||
Cuboid cuboid = home.getCuboid();
|
Cuboid cuboid = home.getCuboid();
|
||||||
player.sendMessage(String.format("Metropolis: Welcome %s your home is between (%d, %d, %d) and (%d, %d, %d)", player.getName(), cuboid.getMinX(), cuboid.getMinY(), cuboid.getMinZ(), cuboid.getMaxX(), cuboid.getMaxY(), cuboid.getMaxZ()));
|
player.sendMessage(String.format("Metropolis: Welcome %s your home is between (%d, %d, %d) and (%d, %d, %d)", player.getName(), cuboid.getMinX(), cuboid.getMinY(), cuboid.getMinZ(), cuboid.getMaxX(), cuboid.getMaxY(), cuboid.getMaxZ()));
|
||||||
|
|||||||
Reference in New Issue
Block a user