Ce dev aime les TAB --"

This commit is contained in:
Michel Roux 2012-05-11 15:17:58 +02:00
parent 7eab05fc78
commit 1975864afb
2 changed files with 90 additions and 90 deletions

View File

@ -71,17 +71,17 @@ public class CraftBall extends JavaPlugin implements CommandExecutor {
} }
if (args[0].toLowerCase().equals("list")) { if (args[0].toLowerCase().equals("list")) {
for (Field f : fields) { for (Field f : fields) {
sendMess("-----Field: "+f.name, sender); sendMess("-----Field: "+f.name, sender);
sendMess("-World: "+ f.world.getName(), sender); sendMess("-World: "+ f.world.getName(), sender);
sendMess("-Region: (x,z)", sender); sendMess("-Region: (x,z)", sender);
for (int i=0; i < f.region.npoints; i++) { for (int i=0; i < f.region.npoints; i++) {
sendMess(" -("+f.region.xpoints[i]+","+f.region.ypoints[i]+")", sender); sendMess(" -("+f.region.xpoints[i]+","+f.region.ypoints[i]+")", sender);
} }
sendMess("-BallItem: "+f.ballItem.getType().toString(), sender); sendMess("-BallItem: "+f.ballItem.getType().toString(), sender);
} }
return true; return true;
} }
} }
@ -101,13 +101,13 @@ public class CraftBall extends JavaPlugin implements CommandExecutor {
log_info("Succesfully updated config.yml"); log_info("Succesfully updated config.yml");
} }
if (getConfig().get("fields") == null) { if (getConfig().get("fields") == null) {
fatal("Error no fields found in config.yml"); fatal("Error no fields found in config.yml");
return; return;
} }
List<Map<?, ?>> fieldList = getConfig().getMapList("fields"); List<Map<?, ?>> fieldList = getConfig().getMapList("fields");
int fieldCount = 0; int fieldCount = 0;
for (Map<?, ?> f : fieldList) { for (Map<?, ?> f : fieldList) {
Field field = new Field(); Field field = new Field();
@ -134,14 +134,14 @@ public class CraftBall extends JavaPlugin implements CommandExecutor {
// get region // get region
List<String> points = null; List<String> points = null;
//points = node.getStringList("region"); //points = node.getStringList("region");
if (f.get("region") == null || !(f.get("region") instanceof List <?>)) { if (f.get("region") == null || !(f.get("region") instanceof List <?>)) {
log_warning("Error found in field list: could not find region"); log_warning("Error found in field list: could not find region");
continue; continue;
} }
try { try {
points = (List <String>) f.get("region"); points = (List <String>) f.get("region");
} }
catch (Exception e) { catch (Exception e) {
points = null; points = null;
@ -251,11 +251,11 @@ public class CraftBall extends JavaPlugin implements CommandExecutor {
cRead = new BufferedReader(new InputStreamReader(new FileInputStream(cFile), "UTF-8")); cRead = new BufferedReader(new InputStreamReader(new FileInputStream(cFile), "UTF-8"));
cBuffer = new StringBuffer(); cBuffer = new StringBuffer();
int ch; int ch;
while ((ch = cRead.read()) > -1) { while ((ch = cRead.read()) > -1) {
cBuffer.append((char)ch); cBuffer.append((char)ch);
} }
cString = cBuffer.toString(); cString = cBuffer.toString();
cRead.close(); cRead.close();
} }
catch (Exception e) { catch (Exception e) {
log_warning("Error, couldn't update/load config.yml:"+e.toString()); log_warning("Error, couldn't update/load config.yml:"+e.toString());
@ -274,8 +274,8 @@ public class CraftBall extends JavaPlugin implements CommandExecutor {
//add name variable //add name variable
if (oldV == null) { if (oldV == null) {
cString = "version: 1.1\r".concat(cString); cString = "version: 1.1\r".concat(cString);
cString = cString.replaceAll("(\\s{4}(field\\d+):)", " -\r name: $2\r world: "+getServer().getWorlds().get(0).getName()); cString = cString.replaceAll("(\\s{4}(field\\d+):)", " -\r name: $2\r world: "+getServer().getWorlds().get(0).getName());
log_warning("Updated config.yml from version <1.1, check your world settings in config.yml!"); log_warning("Updated config.yml from version <1.1, check your world settings in config.yml!");
} }
//--- writefile section //--- writefile section
@ -314,8 +314,8 @@ public class CraftBall extends JavaPlugin implements CommandExecutor {
} }
public void fatal(String msg) { public void fatal(String msg) {
mclog.severe(TAG + " " + msg); mclog.severe(TAG + " " + msg);
this.getServer().getPluginManager().disablePlugin(this); this.getServer().getPluginManager().disablePlugin(this);
} }