Cleanup info and warning messages.

This commit is contained in:
Thijs Wiefferink 2016-08-01 16:18:05 +02:00
parent 816d136a62
commit 4feee59834
9 changed files with 96 additions and 135 deletions

View File

@ -25,6 +25,7 @@ import me.wiefferink.areashop.messages.Message;
import me.wiefferink.areashop.regions.GeneralRegion;
import net.milkbowl.vault.economy.Economy;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.ConfigurationSection;
@ -217,8 +218,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
worldGuardInterface = (WorldGuardInterface)clazz.getConstructor(AreaShopInterface.class).newInstance(this); // Set our handler
}
} catch (final Exception e) {
e.printStackTrace();
getLogger().severe("Could not load the handler for WorldGuard (tried to load "+wgVersion+"), report this problem to the author.");
getLogger().severe("Could not load the handler for WorldGuard (tried to load "+wgVersion+"), report this problem to the author:"+ExceptionUtils.getStackTrace(e));
error = true;
wgVersion = null;
}
@ -245,8 +245,7 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
worldEditInterface = (WorldEditInterface)clazz.getConstructor(AreaShopInterface.class).newInstance(this); // Set our handler
}
} catch (final Exception e) {
e.printStackTrace();
getLogger().severe("Could not load the handler for WorldEdit (tried to load "+weVersion+"), report this problem to the author.");
getLogger().severe("Could not load the handler for WorldEdit (tried to load "+weVersion+"), report this problem to the author: "+ExceptionUtils.getStackTrace(e));
error = true;
weVersion = null;
}
@ -664,6 +663,22 @@ public final class AreaShop extends JavaPlugin implements AreaShopInterface {
AreaShop.debug(message);
}
/**
* Print a warning to the console
* @param message The message to print
*/
public static void warn(String... message) {
AreaShop.getInstance().getLogger().warning(StringUtils.join(message, " "));
}
/**
* Print an information message to the console
* @param message The message to print
*/
public static void info(String... message) {
AreaShop.getInstance().getLogger().info(StringUtils.join(message, " "));
}
/**
* Print debug message for periodic task
* @param message The message to print

View File

@ -39,7 +39,7 @@ public class SignsFeature extends Feature implements Listener {
RegionSign sign = new RegionSign(region, this, signKey);
Location location = sign.getLocation();
if(location == null) {
plugin.getLogger().warning("Sign with key "+signKey+" of region "+region.getName()+" does not have a proper location");
AreaShop.warn("Sign with key "+signKey+" of region "+region.getName()+" does not have a proper location");
continue;
}
signs.put(sign.getStringLocation(), sign);

View File

@ -83,7 +83,7 @@ public class WorldGuardRegionFlagsFeature extends Feature implements Listener {
wRegion.setPriority(priority);
//AreaShop.debug(" Flag " + flagName + " set: " + value);
} catch(NumberFormatException e) {
plugin.getLogger().warning("The value of flag " + flagName + " is not a number");
AreaShop.warn("The value of flag "+flagName+" is not a number");
result = false;
}
} else if(flagName.equalsIgnoreCase("parent")) {
@ -96,10 +96,10 @@ public class WorldGuardRegionFlagsFeature extends Feature implements Listener {
wRegion.setParent(parentRegion);
//AreaShop.debug(" Flag " + flagName + " set: " + value);
} catch(ProtectedRegion.CircularInheritanceException e) {
plugin.getLogger().warning("The parent set in the config is not correct (circular inheritance)");
AreaShop.warn("The parent set in the config is not correct (circular inheritance)");
}
} else {
plugin.getLogger().warning("The parent set in the config is not correct (region does not exist)");
AreaShop.warn("The parent set in the config is not correct (region does not exist)");
}
} else {
// Parse all other normal flags (groups are also handled)
@ -108,7 +108,7 @@ public class WorldGuardRegionFlagsFeature extends Feature implements Listener {
Flag<?> foundFlag = plugin.getWorldGuardHandler().fuzzyMatchFlag(flagName);
if(foundFlag == null) {
plugin.getLogger().warning("Found wrong flag in flagProfiles section: " + flagName + ", check if that is the correct WorldGuard flag");
AreaShop.warn("Found wrong flag in flagProfiles section: "+flagName+", check if that is the correct WorldGuard flag");
continue;
}
RegionGroupFlag groupFlag = foundFlag.getRegionGroupFlag();
@ -128,7 +128,7 @@ public class WorldGuardRegionFlagsFeature extends Feature implements Listener {
try {
groupValue = plugin.getWorldGuardHandler().parseFlagGroupInput(groupFlag, part.substring(2));
} catch(InvalidFlagFormat e) {
plugin.getLogger().warning("Found wrong group value for flag " + flagName);
AreaShop.warn("Found wrong group value for flag "+flagName);
}
}
} else {
@ -145,7 +145,7 @@ public class WorldGuardRegionFlagsFeature extends Feature implements Listener {
setFlag(wRegion, foundFlag, flagSetting);
//AreaShop.debug(" Flag " + flagName + " set: " + flagSetting);
} catch(InvalidFlagFormat e) {
plugin.getLogger().warning("Found wrong value for flag " + flagName);
AreaShop.warn("Found wrong value for flag "+flagName);
}
}
if(groupValue != null) {

View File

@ -80,7 +80,7 @@ public class FileManager {
worldRegionsRequireSaving = new HashSet<>();
File schemFile = new File(schemFolder);
if(!schemFile.exists() & !schemFile.mkdirs()) {
plugin.getLogger().warning("Could not create schematic files directory: " + schemFile.getAbsolutePath());
AreaShop.warn("Could not create schematic files directory: "+schemFile.getAbsolutePath());
}
loadVersions();
}
@ -329,7 +329,7 @@ public class FileManager {
deleted = false;
}
if(!deleted) {
plugin.getLogger().warning("File could not be deleted: " + file.toString());
AreaShop.warn("File could not be deleted: "+file.toString());
}
}
result = true;
@ -384,7 +384,7 @@ public class FileManager {
deleted = false;
}
if(!deleted) {
plugin.getLogger().warning("File could not be deleted: " + file.toString());
AreaShop.warn("File could not be deleted: "+file.toString());
}
}
@ -516,7 +516,7 @@ public class FileManager {
try {
groupsConfig.save(groupsPath);
} catch (IOException e) {
plugin.getLogger().warning("Groups file could not be saved: " + groupsPath);
AreaShop.warn("Groups file could not be saved: "+groupsPath);
}
}
@ -590,7 +590,7 @@ public class FileManager {
manager.saveChanges();
}
} catch(Exception e) {
plugin.getLogger().warning("WorldGuard regions in world " + world + " could not be saved");
AreaShop.warn("WorldGuard regions in world "+world+" could not be saved");
}
}
}
@ -681,7 +681,7 @@ public class FileManager {
versions = (HashMap<String,Integer>)input.readObject();
input.close();
} catch (IOException | ClassNotFoundException | ClassCastException e) {
plugin.getLogger().warning("Something went wrong reading file: " + versionPath);
AreaShop.warn("Something went wrong reading file: "+versionPath);
versions = null;
}
}
@ -697,14 +697,14 @@ public class FileManager {
*/
public void saveVersions() {
if(!(new File(versionPath).exists())) {
plugin.getLogger().info("versions file created, this should happen only after installing or upgrading the plugin");
AreaShop.info("versions file created, this should happen only after installing or upgrading the plugin");
}
try {
ObjectOutputStream output = new ObjectOutputStream(new FileOutputStream(versionPath));
output.writeObject(versions);
output.close();
} catch (IOException e) {
plugin.getLogger().warning("File could not be saved: " + versionPath);
AreaShop.warn("File could not be saved: "+versionPath);
}
}
@ -749,9 +749,9 @@ public class FileManager {
}
input.close();
output.close();
plugin.getLogger().info("File with default region settings has been saved, should only happen on first startup");
AreaShop.info("File with default region settings has been saved, should only happen on first startup");
} catch(IOException e) {
plugin.getLogger().warning("Something went wrong saving the default region settings: " + defaultFile.getAbsolutePath());
AreaShop.warn("Something went wrong saving the default region settings: "+defaultFile.getAbsolutePath());
}
}
// Load default.yml from the plugin folder, and as backup the default one
@ -761,7 +761,7 @@ public class FileManager {
) {
defaultConfig = YamlConfiguration.loadConfiguration(custom);
if(defaultConfig.getKeys(false).size() == 0) {
plugin.getLogger().warning("File 'default.yml' is empty, check for errors in the log.");
AreaShop.warn("File 'default.yml' is empty, check for errors in the log.");
result = false;
} else {
defaultConfig.addDefaults(YamlConfiguration.loadConfiguration(normal));
@ -790,9 +790,9 @@ public class FileManager {
while ((read = input.read(bytes)) != -1) {
output.write(bytes, 0, read);
}
plugin.getLogger().info("Default config file has been saved, should only happen on first startup");
AreaShop.info("Default config file has been saved, should only happen on first startup");
} catch(IOException e) {
plugin.getLogger().warning("Something went wrong saving the config file: " + configFile.getAbsolutePath());
AreaShop.warn("Something went wrong saving the config file: "+configFile.getAbsolutePath());
}
}
// Load config.yml from the plugin folder
@ -803,7 +803,7 @@ public class FileManager {
) {
config = YamlConfiguration.loadConfiguration(custom);
if(config.getKeys(false).size() == 0) {
plugin.getLogger().warning("File 'config.yml' is empty, check for errors in the log.");
AreaShop.warn("File 'config.yml' is empty, check for errors in the log.");
result = false;
} else {
config.addDefaults(YamlConfiguration.loadConfiguration(normal));
@ -819,7 +819,7 @@ public class FileManager {
}
}
} catch(IOException e) {
plugin.getLogger().warning("Something went wrong while reading the config.yml file: " + configFile.getAbsolutePath());
AreaShop.warn("Something went wrong while reading the config.yml file: "+configFile.getAbsolutePath());
result = false;
}
Utils.initialize(config);
@ -839,7 +839,7 @@ public class FileManager {
) {
groupsConfig = YamlConfiguration.loadConfiguration(reader);
} catch(IOException e) {
plugin.getLogger().warning("Could not load groups.yml file: " + groupFile.getAbsolutePath());
AreaShop.warn("Could not load groups.yml file: "+groupFile.getAbsolutePath());
}
}
if(groupsConfig == null) {
@ -860,7 +860,7 @@ public class FileManager {
File file = new File(regionsPath);
if(!file.exists()) {
if(!file.mkdirs()) {
plugin.getLogger().warning("Could not create region files directory: " + file.getAbsolutePath());
AreaShop.warn("Could not create region files directory: "+file.getAbsolutePath());
return;
}
plugin.setReady(true);
@ -878,10 +878,10 @@ public class FileManager {
) {
config = YamlConfiguration.loadConfiguration(reader);
if(config.getKeys(false).size() == 0) {
plugin.getLogger().warning("Region file '"+regionFile.getName()+"' is empty, check for errors in the log.");
AreaShop.warn("Region file '"+regionFile.getName()+"' is empty, check for errors in the log.");
}
} catch(IOException e) {
plugin.getLogger().warning("Something went wrong reading region file: " + regionFile.getAbsolutePath());
AreaShop.warn("Something went wrong reading region file: "+regionFile.getAbsolutePath());
continue;
}
// Construct the correct type of region
@ -921,8 +921,8 @@ public class FileManager {
for(GeneralRegion region : noRegion) {
noRegionNames.add(region.getName());
}
plugin.getLogger().warning("AreaShop regions that are missing their WorldGuard region: " + Utils.createCommaSeparatedList(noRegionNames));
plugin.getLogger().warning("Remove these regions from AreaShop with '/as del' or recreate their regions in WorldGuard.");
AreaShop.warn("AreaShop regions that are missing their WorldGuard region: "+Utils.createCommaSeparatedList(noRegionNames));
AreaShop.warn("Remove these regions from AreaShop with '/as del' or recreate their regions in WorldGuard.");
}
boolean noWorldRegions = !noWorld.isEmpty();
while(!noWorld.isEmpty()) {
@ -938,18 +938,18 @@ public class FileManager {
for(GeneralRegion region : noRegion) {
noWorldNames.add(region.getName());
}
plugin.getLogger().warning("World " + missingWorld + " is not loaded, the following AreaShop regions are not functional now: " + Utils.createCommaSeparatedList(noWorldNames));
AreaShop.warn("World "+missingWorld+" is not loaded, the following AreaShop regions are not functional now: "+Utils.createCommaSeparatedList(noWorldNames));
noWorld.removeAll(toDisplay);
}
if(noWorldRegions) {
plugin.getLogger().warning("Remove these regions from AreaShop with '/as del' or load the world(s) on the server again.");
AreaShop.warn("Remove these regions from AreaShop with '/as del' or load the world(s) on the server again.");
}
if(!incorrectDuration.isEmpty()) {
List<String> incorrectDurationNames = new ArrayList<>();
for(GeneralRegion region : incorrectDuration) {
incorrectDurationNames.add(region.getName());
}
plugin.getLogger().warning("The following regions have an incorrect time format as duration: "+Utils.createCommaSeparatedList(incorrectDurationNames));
AreaShop.warn("The following regions have an incorrect time format as duration: "+Utils.createCommaSeparatedList(incorrectDurationNames));
}
}
}.runTask(plugin);
@ -969,7 +969,7 @@ public class FileManager {
if(fileStatus != null && fileStatus == AreaShop.versionFilesCurrent) {
return;
}
plugin.getLogger().info("Updating AreaShop data to the latest format:");
AreaShop.info("Updating AreaShop data to the latest format:");
// Update to YAML based format
if(fileStatus == null || fileStatus < 2) {
@ -984,7 +984,7 @@ public class FileManager {
if(rentFile.exists()) {
rentFileFound = true;
if(!oldFolderFile.exists() & !oldFolderFile.mkdirs()) {
plugin.getLogger().warning("Could not create directory: " + oldFolderFile.getAbsolutePath());
AreaShop.warn("Could not create directory: "+oldFolderFile.getAbsolutePath());
}
if(versions.get("rents") == null) {
@ -997,23 +997,23 @@ public class FileManager {
rents = (HashMap<String,HashMap<String,String>>)input.readObject();
input.close();
} catch (IOException | ClassNotFoundException | ClassCastException e) {
plugin.getLogger().warning(" Error: Something went wrong reading file: " + rentPath);
AreaShop.warn(" Error: Something went wrong reading file: "+rentPath);
}
// Delete the file if it is totally wrong
if(rents == null) {
try {
if(!rentFile.delete()) {
plugin.getLogger().warning("Could not delete file: " + rentFile.getAbsolutePath());
AreaShop.warn("Could not delete file: "+rentFile.getAbsolutePath());
}
} catch(Exception e) {
plugin.getLogger().warning("Could not delete file: " + rentFile.getAbsolutePath());
AreaShop.warn("Could not delete file: "+rentFile.getAbsolutePath());
}
} else {
// Move old file
try {
Files.move(new File(rentPath), new File(oldFolderPath + "rents"));
} catch (Exception e) {
plugin.getLogger().warning(" Could not create a backup of '" + rentPath + "', check the file permissions (conversion to next version continues)");
AreaShop.warn(" Could not create a backup of '"+rentPath+"', check the file permissions (conversion to next version continues)");
}
// Check if conversion is needed
if(versions.get("rents") < 1) {
@ -1038,7 +1038,7 @@ public class FileManager {
// Change to version 0
versions.put("rents", 0);
}
plugin.getLogger().info(" Updated version of '" + buyPath + "' from -1 to 0 (switch to using lowercase region names, adding default schematic enabling and profile)");
AreaShop.info(" Updated version of '"+buyPath+"' from -1 to 0 (switch to using lowercase region names, adding default schematic enabling and profile)");
}
if(versions.get("rents") < 1) {
for(String rentName : rents.keySet()) {
@ -1052,13 +1052,13 @@ public class FileManager {
// Change version to 1
versions.put("rents", 1);
}
plugin.getLogger().info(" Updated version of '" + rentPath + "' from 0 to 1 (switch to UUID's for player identification)");
AreaShop.info(" Updated version of '"+rentPath+"' from 0 to 1 (switch to UUID's for player identification)");
}
}
// Save rents to new format
File regionsFile = new File(regionsPath);
if(!regionsFile.exists() & !regionsFile.mkdirs()) {
plugin.getLogger().warning("Could not create directory: " + regionsFile.getAbsolutePath());
AreaShop.warn("Could not create directory: "+regionsFile.getAbsolutePath());
return;
}
for(HashMap<String, String> rent : rents.values()) {
@ -1094,10 +1094,10 @@ public class FileManager {
try {
config.save(new File(regionsPath + File.separator + rent.get("name").toLowerCase() + ".yml"));
} catch (IOException e) {
plugin.getLogger().warning(" Error: Could not save region file while converting: " + regionsPath + File.separator + rent.get("name").toLowerCase() + ".yml");
AreaShop.warn(" Error: Could not save region file while converting: "+regionsPath+File.separator+rent.get("name").toLowerCase()+".yml");
}
}
plugin.getLogger().info(" Updated rent regions to new .yml format (check the /regions folder)");
AreaShop.info(" Updated rent regions to new .yml format (check the /regions folder)");
}
// Change version number
@ -1108,7 +1108,7 @@ public class FileManager {
if(buyFile.exists()) {
buyFileFound = true;
if(!oldFolderFile.exists() & !oldFolderFile.mkdirs()) {
plugin.getLogger().warning("Could not create directory: " + oldFolderFile.getAbsolutePath());
AreaShop.warn("Could not create directory: "+oldFolderFile.getAbsolutePath());
return;
}
@ -1122,23 +1122,23 @@ public class FileManager {
buys = (HashMap<String,HashMap<String,String>>)input.readObject();
input.close();
} catch (IOException | ClassNotFoundException | ClassCastException e) {
plugin.getLogger().warning(" Something went wrong reading file: " + buyPath);
AreaShop.warn(" Something went wrong reading file: "+buyPath);
}
// Delete the file if it is totally wrong
if(buys == null) {
try {
if(!buyFile.delete()) {
plugin.getLogger().warning("Could not delete file: " + buyFile.getAbsolutePath());
AreaShop.warn("Could not delete file: "+buyFile.getAbsolutePath());
}
} catch(Exception e) {
plugin.getLogger().warning("Could not delete file: " + buyFile.getAbsolutePath());
AreaShop.warn("Could not delete file: "+buyFile.getAbsolutePath());
}
} else {
// Backup current file
try {
Files.move(new File(buyPath), new File(oldFolderPath + "buys"));
} catch (Exception e) {
plugin.getLogger().warning(" Could not create a backup of '" + buyPath + "', check the file permissions (conversion to next version continues)");
AreaShop.warn(" Could not create a backup of '"+buyPath+"', check the file permissions (conversion to next version continues)");
}
// Check if conversion is needed
if(versions.get("buys") < 1) {
@ -1163,7 +1163,7 @@ public class FileManager {
// Change to version 0
versions.put("buys", 0);
}
plugin.getLogger().info(" Updated version of '" + buyPath + "' from -1 to 0 (switch to using lowercase region names, adding default schematic enabling and profile)");
AreaShop.info(" Updated version of '"+buyPath+"' from -1 to 0 (switch to using lowercase region names, adding default schematic enabling and profile)");
}
if(versions.get("buys") < 1) {
for(String buyName : buys.keySet()) {
@ -1177,14 +1177,14 @@ public class FileManager {
// Change version to 1
versions.put("buys", 1);
}
plugin.getLogger().info(" Updated version of '" + buyPath + "' from 0 to 1 (switch to UUID's for player identification)");
AreaShop.info(" Updated version of '"+buyPath+"' from 0 to 1 (switch to UUID's for player identification)");
}
}
// Save buys to new format
File regionsFile = new File(regionsPath);
if(!regionsFile.exists() & !regionsFile.mkdirs()) {
plugin.getLogger().warning("Could not create directory: " + regionsFile.getAbsolutePath());
AreaShop.warn("Could not create directory: "+regionsFile.getAbsolutePath());
}
for(HashMap<String, String> buy : buys.values()) {
YamlConfiguration config = new YamlConfiguration();
@ -1217,10 +1217,10 @@ public class FileManager {
try {
config.save(new File(regionsPath + File.separator + buy.get("name").toLowerCase() + ".yml"));
} catch (IOException e) {
plugin.getLogger().warning(" Error: Could not save region file while converting: " + regionsPath + File.separator + buy.get("name").toLowerCase() + ".yml");
AreaShop.warn(" Error: Could not save region file while converting: "+regionsPath+File.separator+buy.get("name").toLowerCase()+".yml");
}
}
plugin.getLogger().info(" Updated buy regions to new .yml format (check the /regions folder)");
AreaShop.info(" Updated buy regions to new .yml format (check the /regions folder)");
}
// Change version number
@ -1248,7 +1248,7 @@ public class FileManager {
// Update versions file to 2
versions.put(AreaShop.versionFiles, 2);
saveVersions();
plugin.getLogger().info(" Updated to YAML based storage (v1 to v2)");
AreaShop.info(" Updated to YAML based storage (v1 to v2)");
}
}
@ -1272,7 +1272,7 @@ public class FileManager {
// Update versions file to 3
versions.put(AreaShop.versionFiles, 3);
saveVersions();
plugin.getLogger().info(" Added last active time to regions (v2 to v3)");
AreaShop.info(" Added last active time to regions (v2 to v3)");
}
}

View File

@ -41,7 +41,7 @@ public class LanguageManager {
langFolder = new File(plugin.getDataFolder()+File.separator+AreaShop.languageFolder);
if(!langFolder.exists()) {
if(!langFolder.mkdirs()) {
plugin.getLogger().warning("Could not create language directory: "+langFolder.getAbsolutePath());
AreaShop.warn("Could not create language directory: "+langFolder.getAbsolutePath());
return;
}
}
@ -58,7 +58,7 @@ public class LanguageManager {
OutputStream output = new FileOutputStream(langFile)
) {
if(input == null) {
plugin.getLogger().warning("Could not save default language to the '"+AreaShop.languageFolder+"' folder: "+language+".yml");
AreaShop.warn("Could not save default language to the '"+AreaShop.languageFolder+"' folder: "+language+".yml");
continue;
}
int read;
@ -69,7 +69,7 @@ public class LanguageManager {
input.close();
output.close();
} catch(IOException e) {
plugin.getLogger().warning("Something went wrong saving a default language file: "+langFile.getPath());
AreaShop.warn("Something went wrong saving a default language file: "+langFile.getPath());
}
}
@ -90,7 +90,7 @@ public class LanguageManager {
) {
YamlConfiguration ymlFile = YamlConfiguration.loadConfiguration(reader);
if(ymlFile.getKeys(false).isEmpty()) {
plugin.getLogger().warning("Language file "+key+".yml has zero messages.");
AreaShop.warn("Language file "+key+".yml has zero messages.");
return result;
}
for(String messageKey : ymlFile.getKeys(false)) {
@ -101,7 +101,7 @@ public class LanguageManager {
}
}
} catch(IOException e) {
plugin.getLogger().warning("Could not load set language file: "+file.getAbsolutePath());
AreaShop.warn("Could not load set language file: "+file.getAbsolutePath());
}
return result;
}

View File

@ -337,7 +337,7 @@ public class BuyRegion extends GeneralRegion {
r = plugin.getEconomy().depositPlayer(oldOwnerName, getWorldName(), getResellPrice());
}
if(r == null || !r.transactionSuccess()) {
plugin.getLogger().warning("Something went wrong with paying '" + oldOwnerName + "' " + getFormattedPrice() + " for his resell of region " + getName() + " to " + player.getName());
AreaShop.warn("Something went wrong with paying '"+oldOwnerName+"' "+getFormattedPrice()+" for his resell of region "+getName()+" to "+player.getName());
}
// Resell is done, disable that now
disableReselling();
@ -389,7 +389,7 @@ public class BuyRegion extends GeneralRegion {
r = plugin.getEconomy().depositPlayer(landlordName, getWorldName(), getPrice());
}
if(r != null && !r.transactionSuccess()) {
plugin.getLogger().warning("Something went wrong with paying '" + landlordName + "' " + getFormattedPrice() + " for his sell of region " + getName() + " to " + player.getName());
AreaShop.warn("Something went wrong with paying '"+landlordName+"' "+getFormattedPrice()+" for his sell of region "+getName()+" to "+player.getName());
}
}
@ -504,7 +504,7 @@ public class BuyRegion extends GeneralRegion {
error = true;
}
if(error || response == null || !response.transactionSuccess()) {
plugin.getLogger().warning("Something went wrong with paying back money to " + getPlayerName() + " while selling region " + getName());
AreaShop.warn("Something went wrong with paying back money to "+getPlayerName()+" while selling region "+getName());
}
}
}
@ -541,7 +541,7 @@ public class BuyRegion extends GeneralRegion {
long lastPlayed = getLastActiveTime();
//AreaShop.debug("currentTime=" + Calendar.getInstance().getTimeInMillis() + ", getLastPlayed()=" + lastPlayed + ", timeInactive=" + (Calendar.getInstance().getTimeInMillis()-player.getLastPlayed()) + ", inactiveSetting=" + inactiveSetting);
if(Calendar.getInstance().getTimeInMillis() > (lastPlayed + inactiveSetting)) {
plugin.getLogger().info("Region " + getName() + " unrented because of inactivity for player " + getPlayerName());
AreaShop.info("Region "+getName()+" unrented because of inactivity for player "+getPlayerName());
AreaShop.debug("currentTime=" + Calendar.getInstance().getTimeInMillis() + ", getLastPlayed()=" + lastPlayed + ", timeInactive=" + (Calendar.getInstance().getTimeInMillis()-player.getLastPlayed()) + ", inactiveSetting=" + inactiveSetting);
return this.sell(true, null);
}

View File

@ -700,8 +700,8 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
File parent = saveFile.getParentFile();
if (parent != null && !parent.exists()) {
if (!parent.mkdirs()) {
plugin.getLogger().warning("Did not save region " + getName() + ", schematic directory could not be created: " + saveFile);
return false;
AreaShop.warn("Did not save region "+getName()+", schematic directory could not be created: "+saveFile);
return false;
}
}
boolean result = plugin.getWorldEditHandler().saveRegionBlocks(saveFile, this);
@ -724,7 +724,7 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
// The path to save the schematic
File restoreFile = new File(plugin.getFileManager().getSchematicFolder() + File.separator + fileName + AreaShop.schematicExtension);
if(!restoreFile.exists() || !restoreFile.isFile()) {
plugin.getLogger().info("Did not restore region " + getName() + ", schematic file does not exist: " + restoreFile);
AreaShop.info("Did not restore region "+getName()+", schematic file does not exist: "+restoreFile);
return false;
}
boolean result = plugin.getWorldEditHandler().restoreRegionBlocks(restoreFile, this);
@ -884,7 +884,7 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
int vertical = Integer.parseInt(configSetting);
middle = middle.setY(vertical);
} catch(NumberFormatException e) {
plugin.getLogger().warning("Could not parse general.teleportLocationY: '"+configSetting+"'");
AreaShop.warn("Could not parse general.teleportLocationY: '"+configSetting+"'");
}
}
startLocation = new Location(getWorld(), middle.getX(), middle.getY(), middle.getZ(), player.getLocation().getYaw(), player.getLocation().getPitch());
@ -1372,10 +1372,10 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
if(player.hasPermission("areashop.limits." + group) && this.matchesLimitGroup(group)) {
String pathPrefix = "limitGroups."+group+".";
if(!plugin.getConfig().isInt(pathPrefix+"total")) {
plugin.getLogger().warning("Limit group "+group+" in the config.yml file does not correctly specify the number of total regions (should be specified as total: <number>)");
AreaShop.warn("Limit group "+group+" in the config.yml file does not correctly specify the number of total regions (should be specified as total: <number>)");
}
if(!plugin.getConfig().isInt(pathPrefix+typePath)) {
plugin.getLogger().warning("Limit group "+group+" in the config.yml file does not correctly specify the number of "+typePath+" regions (should be specified as "+typePath+": <number>)");
AreaShop.warn("Limit group "+group+" in the config.yml file does not correctly specify the number of "+typePath+" regions (should be specified as "+typePath+": <number>)");
}
int totalLimit = plugin.getConfig().getInt("limitGroups." + group + ".total");
int typeLimit = plugin.getConfig().getInt("limitGroups." + group + "."+typePath);
@ -1597,11 +1597,11 @@ public abstract class GeneralRegion implements GeneralRegionInterface, Comparabl
if(!result) {
printed = true;
if(error != null) {
plugin.getLogger().warning("Command execution failed, command=" + command + ", error=" + error + ", stacktrace:");
plugin.getLogger().warning(stacktrace);
plugin.getLogger().warning("--- End of stacktrace ---");
AreaShop.warn("Command execution failed, command="+command+", error="+error+", stacktrace:");
AreaShop.warn(stacktrace);
AreaShop.warn("--- End of stacktrace ---");
} else {
plugin.getLogger().warning("Command execution failed, command=" + command);
AreaShop.warn("Command execution failed, command="+command);
}
}
if(!printed) {

View File

@ -514,7 +514,7 @@ public class RentRegion extends GeneralRegion {
r = plugin.getEconomy().depositPlayer(landlordName, getWorldName(), price);
}
if(r == null || !r.transactionSuccess()) {
plugin.getLogger().warning("Something went wrong with paying '"+landlordName+"' "+Utils.formatCurrency(price)+" for his rent of region "+getName()+" to "+player.getName());
AreaShop.warn("Something went wrong with paying '"+landlordName+"' "+Utils.formatCurrency(price)+" for his rent of region "+getName()+" to "+player.getName());
}
}
@ -654,7 +654,7 @@ public class RentRegion extends GeneralRegion {
error = true;
}
if(error || r == null || !r.transactionSuccess()) {
plugin.getLogger().warning("Something went wrong with paying back to " + getPlayerName() + " money while unrenting region " + getName());
AreaShop.warn("Something went wrong with paying back to "+getPlayerName()+" money while unrenting region "+getName());
}
}
}
@ -694,7 +694,7 @@ public class RentRegion extends GeneralRegion {
long lastPlayed = getLastActiveTime();
//AreaShop.debug("currentTime=" + Calendar.getInstance().getTimeInMillis() + ", getLastPlayed()=" + lastPlayed + ", timeInactive=" + (Calendar.getInstance().getTimeInMillis()-player.getLastPlayed()) + ", inactiveSetting=" + inactiveSetting);
if(Calendar.getInstance().getTimeInMillis() > (lastPlayed + inactiveSetting)) {
plugin.getLogger().info("Region " + getName() + " unrented because of inactivity for player " + getPlayerName());
AreaShop.info("Region "+getName()+" unrented because of inactivity for player "+getPlayerName());
AreaShop.debug("currentTime=" + Calendar.getInstance().getTimeInMillis() + ", getLastPlayed()=" + lastPlayed + ", timeInactive=" + (Calendar.getInstance().getTimeInMillis()-player.getLastPlayed()) + ", inactiveSetting=" + inactiveSetting);
return this.unRent(true, null);
}

View File

@ -9,15 +9,11 @@
# ║ 5: Use '/as reload' or reload/restart your server to see the changes ║
# ╚════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╝
action: "[blue][bold]<%0%>[/bold]"
button: "[bold]<%0%>[/bold]"
command:
- "[bold]%0%[/bold]"
- " hover: %lang:action|Use %1%|%"
- " command: %1%"
helpCommand:
- "[gold]%0% [gray]-[reset]"
@ -25,25 +21,18 @@ helpCommand:
- " command: %0%"
region: "%lang:tRegion|%region%|%"
tRegion:
- "[bold]%0%[/bold]"
- " hover: Region %0%"
- " hover: %lang:action|Region information|%"
- " command: /areashop info region %0%"
player: "%lang:tPlayer|%player%|%"
tPlayer:
- "[bold]%0%[/bold]"
- " hover: Player %0%"
- " hover: %lang:action|Regions of %0%|%"
- " command: /areashop info player %0%"
landlord:
- "[bold]%landlord%[/bold]"
- " hover: Landlord %landlord%"
- " hover: %lang:action|Regions of %landlord%|%"
@ -161,7 +150,6 @@ reload-noPermission: "You don't have permission to reload the config files."
reload-updateCommandChanged: "'/as updaterents' and '/as updatebuys' have been removed, '/as reload' will also update the regions now so use that command instead."
info-help:
- "/as info[break]"
- " %lang:command|all|/as info all|%[break]"
- " %lang:command|rented|/as info rented|% [group] [page][break]"
@ -191,31 +179,22 @@ info-entryForsale: "[darkgreen][bold]►[reset] %lang:region%: For sale for %pri
info-entrySold: "[darkgreen][bold]►[reset] %lang:region%: Sold to %lang:player%."
info-entryReselling: "[darkgreen][bold]►[reset] %lang:region%: Sold to %lang:player% (reselling)."
info-pageStatus:
- "[gray]Page %0%/%1%"
info-pagePrevious:
- " [gray][bold]◄Previous[/bold] "
- " hover: %lang:action|Show previous page|%"
- " command: %0%"
info-pageNoPrevious:
- " [darkgray][bold]◄Previous[/bold] "
- " hover: This is already the first page"
info-pageNext:
- " [gray][bold]Next►[/bold]"
- " hover: %lang:action|Show next page|%"
- " command: %0%"
info-pageNoNext:
- " [darkgray][bold]Next►[/bold]"
- " hover: This is already the last page"
info-playerHelp: "/as info player <name>."
info-playerRents: "Regions rented by %lang:tPlayer|%0%|%: [gray]%1%"
info-playerNoRents: "%lang:tPlayer|%0%|% has not rented a region."
@ -230,7 +209,6 @@ info-regionRented: "[darkgreen][bold]►[reset] Rented by %lang:player% until: [
info-regionBought: "[darkgreen][bold]►[reset] Bought by %lang:player%."
info-regionReselling: "[darkgreen][bold]►[reset] Bought by %lang:player%, currently reselling."
info-regionExtending:
- "[darkgreen][bold]►[reset] "
- "[bold]Extend for[/bold]"
- " hover: Extend rent of %region%"
@ -238,80 +216,61 @@ info-regionExtending:
- " hover: %lang:action|Extend rent of %region%|%"
- " command: /areashop rent %region%"
- ": [gray]%price% per %duration%."
info-regionCanBeRented:
- "[darkgreen][bold]►[reset] "
- "[bold]Rent for[/bold]"
- " hover: Rent %region% for %price% per %duration%"
- " hover: %lang:action|Rent %region%|%"
- " command: /areashop rent %region%"
- ": [gray]%price% per %duration%."
info-regionCanBeBought:
- "[darkgreen][bold]►[reset] "
- "[bold]Buy for[/bold]"
- " hover: Buy %region% for %price%"
- " hover: %lang:action|Buy %region%|%"
- " command: /areashop buy %region%"
- ": [gray]%price%."
info-regionReselPrice: "[darkgreen][bold]►[reset] Resell price: [gray]%resellprice% (you can buy it from %lang:player%)."
info-regionFriends: "[darkgreen][bold]►[reset] Added friends: [gray]%0%."
info-friend: "%lang:tPlayer|%0%|%"
info-friendRemove:
- "%lang:info-friend|%0%|%"
- "[red]✕[gray]"
- " hover: Region %region%"
- " hover: %lang:action|Remove %0% as friend|%"
- " command: /areashop delfriend %0% %region%"
info-regionMoneyBackBuy:
- "[darkgreen][bold]►[reset] Selling payback: [gray]%moneyback% (%moneybackpercent%% of the price)."
info-regionMoneyBackBuyClick:
- "[darkgreen][bold]►[reset] "
- "[bold]Selling payback[/bold]"
- " hover: Sell %region% and get back %moneyback%"
- " hover: %lang:action|Sell %region%|%"
- " command: /areashop sell %region%"
- ": [gray]%moneyback% (%moneybackpercent%% of the price)."
info-regionMoneyBackRent:
- "[darkgreen][bold]►[reset] Unrenting payback: [gray]%moneyback% (%moneybackpercent%% of the remaining time)."
info-regionMoneyBackRentClick:
- "[darkgreen][bold]►[reset] "
- "[bold]Unrenting payback[/bold]"
- " hover: Unrent %region% and get back %moneyback%"
- " hover: %lang:action|Unrent %region%|%"
- " command: /areashop unrent %region%"
- ": [gray]%moneyback% (%moneybackpercent%% of the remaining time)."
info-regionMaxExtends: "[darkgreen][bold]►[reset] Maximum number of extensions: [gray]%maxextends% time(s)."
info-regionNoExtending: "[darkgreen][bold]►[reset] Rent cannot be extended."
info-regionExtendsLeft: "[darkgreen][bold]►[reset] Extensions left: [gray]%extendsleft% time(s) out of %maxextends%."
info-regionMaxRentTime: "[darkgreen][bold]►[reset] In advance renting: [gray]%maxrenttime% at maximum."
info-prefix: "[darkgreen][bold]►[reset] "
info-regionTeleport:
- "[bold]Go to the region[/bold]"
- " hover: %lang:action|Teleport to %region%|%"
- " command: /areashop tp %region%"
info-setRegionTeleport:
- "[bold]set teleport location[/bold]"
- " hover: %region%"
- " hover: %lang:action|Set teleport location|%"
- " command: /areashop settp %region%"
info-regionSigns: "[darkgreen][bold]►[reset] Connected signs: [gray]%0%."
info-regionSignLocation: "[gray](%0%, %1%, %2%, %3%)[reset]"
info-regionGroups: "[darkgreen][bold]►[reset] Assigned groups: [gray]%0%."
@ -456,12 +415,10 @@ addsign-couldNotDetect: "Found multiple regions around the sign, specify region
addsign-couldNotDetectSign: "Found multiple regions around the sign, specify region on the second line (2 of the regions that were found: %lang:tRegion|%0%|% and %lang:tRegion|%1%|%)."
addsign-wrongProfile: "The specified profile does not exist, use one of the following (check config): [gray]%0%."
addsign-profile:
- "[bold]%0%[/bold]"
- " hover: Signprofile %0%"
- " hover: %lang:action|Use this profile|%"
- " command: /areashop linksigns %0%"
addsign-success: "The sign has been added to %lang:region%."
addsign-successProfile: "The sign has been added to %lang:region% with profile %0%."
addsign-alreadyRegistered: "That sign is already registered for region %lang:region%."
@ -521,7 +478,7 @@ delfriend-noPermissionOther: "You don't have permission to delete friends from r
delfriend-noPermission: "You don't have permission to delete friends from your region."
delfriend-successOther: "%lang:tPlayer|%0%|% has been deleted as friend from region %lang:region%."
delfriend-success: "%lang:tPlayer|%0%|% has been deleted as friend from your region %lang:region%."
delfriend-notAdded: "%lang:tPlayer|%0%|% is not added as friend to %lang:region."
delfriend-notAdded: "%lang:tPlayer|%0%|% is not added as friend to %lang:region%."
delfriend-noOwner: "You cannot remove friends from a region without owner."
linksigns-multipleRegions: "Found multiple regions: [gray]%0%."
@ -537,7 +494,6 @@ linksigns-noPermission: "You don't have permission to enter bulk sign linking mo
linksigns-stopped: "Exited sign linking mode."
stack-help:
- "/as stack <amount> <gap> <name> <rent|buy> [group].[break]"
- " [gray]<amount> Number of regions that will be created.[break]"
- " [gray]<gap> Blocks distance between the regions.[break]"
@ -545,7 +501,6 @@ stack-help:
- " [gray]<rent|buy> Make then rent or buy regions.[break]"
- " [gray][group] A group to add the created regions to.[break]"
- " [gray]The regions will be created in the direction you are facing."
stack-accepted: "Starting to create %0% %1% regions with %2% blocks in between, names start with %3% and have a number behind them.%4%"
stack-addToGroup: " Created regions will be added to the group '%0%'."
stack-noPermission: "You don't have permission to create and add regions to AreaShop in bulk."
@ -565,35 +520,26 @@ message-noPermission: "You do not have permission to send AreaShop messages."
message-notOnline: "%0% is not online."
confirm-rent:
- "%lang:prefix%Are you sure you want to rent %lang:tRegion|%0%|%?[break]"
- "[darkgreen][bold]►[reset] %lang:button|Click to rent %0%|%"
- " hover: %lang:action|Rent %0%|%"
- " command: /areashop rent %0%"
confirm-extend:
- "%lang:prefix%Are you sure you want to extend %lang:tRegion|%0%|%?[break]"
- "[darkgreen][bold]►[reset] %lang:button|Click to extend %0%|%"
- " hover: %lang:action|Extend %0%|%"
- " command: /areashop rent %0%"
confirm-unrent:
- "%lang:prefix%Are you sure you want to stop renting %lang:tRegion|%0%|%?[break]"
- "[darkgreen][bold]►[reset] %lang:button|Click to stop renting %0%|%"
- " hover: %lang:action|Stop renting %0%|%"
- " command: /areashop unrent %0%"
confirm-buy:
- "%lang:prefix%Are you sure you want to buy %lang:tRegion|%0%|%?[break]"
- "[darkgreen][bold]►[reset] %lang:button|Click to buy %0%|%"
- " hover: %lang:action|Buy %0%|%"
- " command: /areashop buy %0%"
confirm-sell:
- "%lang:prefix%Are you sure you want to sell %lang:tRegion|%0%|%?[break]"
- "[darkgreen][bold]►[reset] %lang:button|Click to sell %0%|%"
- " hover: %lang:action|Sell %0%|%"