ChestShop-3/com/Acrobot/ChestShop/Utils/uName.java
Acrobot f1ee558e3a - Reformatted code
- Switched from YamlConfiguration to BreezeConfiguration (from ChestShop 4)
- Fixed getDouble()
- Instead of checking for Admin Shops, we just pass in a new AdminShop Container
- Created events for shop creation, protection checks and protection creation
- Expanded string data value parsing, for example - you can use "Ocelot Monster" on the sign
- Collected all external plugin wrappers in a single folder
- Instead of using statics, now we use objects
- Fixed enchantments for armour
- Made config more readable
- Added a setting for removing empty shops
- Switched from System.out to logger
- Also, switched from ugly file logging to Java's native one (FileHandler)
- Added an option to tax transactions even when SERVER_ECONOMY_ACCOUNT is empty
- Changed the Container interface
2012-05-10 16:32:25 +02:00

38 lines
960 B
Java

package com.Acrobot.ChestShop.Utils;
import com.Acrobot.ChestShop.Config.BreezeConfiguration;
import com.Acrobot.ChestShop.Permission;
import org.bukkit.entity.Player;
/**
* @author Acrobot
*/
public class uName {
public static BreezeConfiguration config;
public static String getName(String shortName) {
return config.getString(shortName, shortName);
}
public static void saveName(String name) {
if (name.length() <= 15) {
return;
}
config.set(stripName(name), name);
config.reload();
}
public static String stripName(String name) {
return (name.length() > 15 ? name.substring(0, 15) : name);
}
public static String shortenName(Player player) {
return stripName(player.getName());
}
public static boolean canUseName(Player player, String name) {
return shortenName(player).equals(name) || Permission.otherName(player, name);
}
}