mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-28 03:34:43 +02:00
Major cleanup
This commit is contained in:
@ -11,7 +11,6 @@ import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -26,14 +25,13 @@ import org.bukkit.inventory.meta.FireworkMeta;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
|
||||
public class Anniversary {
|
||||
|
||||
private Random random = new Random();
|
||||
|
||||
public final class Anniversary {
|
||||
public static ArrayList<String> hasCelebrated;
|
||||
|
||||
private Anniversary() {}
|
||||
|
||||
//This gets called onEnable
|
||||
public void createAnniversaryFile() {
|
||||
public static void createAnniversaryFile() {
|
||||
File anniversaryFile = new File(mcMMO.p.getDataFolder().getAbsolutePath() + File.separator + "anniversary");
|
||||
|
||||
if (!anniversaryFile.exists()) {
|
||||
@ -62,7 +60,7 @@ public class Anniversary {
|
||||
}
|
||||
|
||||
//This gets called onDisable
|
||||
public void saveAnniversaryFiles() {
|
||||
public static void saveAnniversaryFiles() {
|
||||
try {
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(mcMMO.p.getDataFolder().getAbsolutePath() + File.separator + "anniversary"));
|
||||
for (String player : hasCelebrated) {
|
||||
@ -77,7 +75,7 @@ public class Anniversary {
|
||||
}
|
||||
|
||||
//This gets called from /mcmmo command
|
||||
public void anniversaryCheck(final CommandSender sender) {
|
||||
public static void anniversaryCheck(final CommandSender sender) {
|
||||
if (sender instanceof Player) {
|
||||
GregorianCalendar anniversaryStart = new GregorianCalendar(2013, Calendar.FEBRUARY, 3);
|
||||
GregorianCalendar anniversaryEnd = new GregorianCalendar(2013, Calendar.FEBRUARY, 6);
|
||||
@ -105,11 +103,11 @@ public class Anniversary {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean getDateRange(Date date, Date start, Date end) {
|
||||
private static boolean getDateRange(Date date, Date start, Date end) {
|
||||
return !(date.before(start) || date.after(end));
|
||||
}
|
||||
|
||||
private void spawnFireworks(Player player) {
|
||||
private static void spawnFireworks(Player player) {
|
||||
int power = (int) (Math.random() * 3) + 1;
|
||||
int type = (int) (Math.random() * 5) + 1;
|
||||
|
||||
@ -122,16 +120,16 @@ public class Anniversary {
|
||||
|
||||
Firework fireworks = (Firework) player.getWorld().spawnEntity(player.getLocation(), EntityType.FIREWORK);
|
||||
FireworkMeta fireworkmeta = fireworks.getFireworkMeta();
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(random.nextBoolean()).withColor(colorchoose()).withFade(colorchoose()).with(typen).trail(random.nextBoolean()).build();
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(Misc.getRandom().nextBoolean()).withColor(colorchoose()).withFade(colorchoose()).with(typen).trail(Misc.getRandom().nextBoolean()).build();
|
||||
fireworkmeta.addEffect(effect);
|
||||
fireworkmeta.setPower(power);
|
||||
fireworks.setFireworkMeta(fireworkmeta);
|
||||
}
|
||||
|
||||
private List<Color> colorchoose() {
|
||||
private static List<Color> colorchoose() {
|
||||
// Thanks Zomis and Tejpbit for the help with this function!
|
||||
|
||||
int numberofcolors = random.nextInt(17) + 1;
|
||||
int numberofcolors = Misc.getRandom().nextInt(17) + 1;
|
||||
|
||||
List<Color> allcolors = new ArrayList<Color>();
|
||||
allcolors.add(Color.AQUA);
|
||||
@ -155,7 +153,7 @@ public class Anniversary {
|
||||
List<Color> choosencolors = new ArrayList<Color>();
|
||||
|
||||
for (int i = 0; i < numberofcolors; i++) {
|
||||
choosencolors.add(allcolors.remove(random.nextInt(allcolors.size())));
|
||||
choosencolors.add(allcolors.remove(Misc.getRandom().nextInt(allcolors.size())));
|
||||
}
|
||||
return choosencolors;
|
||||
}
|
||||
|
@ -9,9 +9,10 @@ import org.bukkit.material.MaterialData;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.config.mods.CustomBlocksConfig;
|
||||
|
||||
public class BlockChecks {
|
||||
public final class BlockChecks {
|
||||
private static Config configInstance = Config.getInstance();
|
||||
private static boolean customBlocksEnabled = configInstance.getBlockModsEnabled();
|
||||
|
||||
private BlockChecks() {}
|
||||
|
||||
/**
|
||||
* Checks to see if a block type awards XP.
|
||||
@ -62,7 +63,7 @@ public class BlockChecks {
|
||||
default:
|
||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customItems.contains(item)) {
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customItems.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -79,7 +80,7 @@ public class BlockChecks {
|
||||
public static boolean canActivateAbilities(Block block) {
|
||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(item)) {
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customAbilityBlocks.contains(item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -137,7 +138,7 @@ public class BlockChecks {
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (customBlocksEnabled && ModChecks.isCustomOreBlock(block)) {
|
||||
if (configInstance.getBlockModsEnabled() && ModChecks.isCustomOreBlock(block)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -201,7 +202,7 @@ public class BlockChecks {
|
||||
default:
|
||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customHerbalismBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -237,7 +238,7 @@ public class BlockChecks {
|
||||
default:
|
||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) {
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customMiningBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -265,7 +266,7 @@ public class BlockChecks {
|
||||
default:
|
||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customExcavationBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -288,7 +289,7 @@ public class BlockChecks {
|
||||
default:
|
||||
ItemStack item = (new MaterialData(block.getTypeId(), block.getData())).toItemStack(1);
|
||||
|
||||
if (customBlocksEnabled && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
|
||||
if (configInstance.getBlockModsEnabled() && CustomBlocksConfig.getInstance().customWoodcuttingBlocks.contains(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -297,7 +298,7 @@ public class BlockChecks {
|
||||
}
|
||||
|
||||
public static boolean isLog(Block block) {
|
||||
if (block.getType().equals(Material.LOG) || (customBlocksEnabled && ModChecks.isCustomLogBlock(block))) {
|
||||
if (block.getType().equals(Material.LOG) || (configInstance.getBlockModsEnabled() && ModChecks.isCustomLogBlock(block))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -8,20 +8,12 @@ import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
|
||||
public class ChatManager {
|
||||
private mcMMO plugin;
|
||||
private String playerName;
|
||||
private String message;
|
||||
public final class ChatManager {
|
||||
public ChatManager () {}
|
||||
|
||||
public ChatManager (mcMMO plugin, String playerName, String message) {
|
||||
this.plugin = plugin;
|
||||
this.playerName = playerName;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public void handleAdminChat() {
|
||||
public static void handleAdminChat(String playerName, String message) {
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(playerName, message);
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return;
|
||||
@ -29,20 +21,20 @@ public class ChatManager {
|
||||
|
||||
String adminMessage = chatEvent.getMessage();
|
||||
|
||||
plugin.getLogger().info("[A]<" + playerName + "> " + adminMessage);
|
||||
mcMMO.p.getLogger().info("[A]<" + playerName + "> " + adminMessage);
|
||||
|
||||
for (Player otherPlayer : plugin.getServer().getOnlinePlayers()) {
|
||||
for (Player otherPlayer : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
if (Permissions.adminChat(otherPlayer) || otherPlayer.isOp()) {
|
||||
otherPlayer.sendMessage(LocaleLoader.getString("Commands.AdminChat.Prefix", new Object[] {playerName}) + adminMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handlePartyChat(Party party) {
|
||||
public static void handlePartyChat(Party party, String playerName, String message) {
|
||||
String partyName = party.getName();
|
||||
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(playerName, partyName, message);
|
||||
plugin.getServer().getPluginManager().callEvent(chatEvent);
|
||||
mcMMO.p.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
if (chatEvent.isCancelled()) {
|
||||
return;
|
||||
@ -50,7 +42,7 @@ public class ChatManager {
|
||||
|
||||
String partyMessage = chatEvent.getMessage();
|
||||
|
||||
plugin.getLogger().info("[P](" + partyName + ")" + "<" + playerName + "> " + partyMessage);
|
||||
mcMMO.p.getLogger().info("[P](" + partyName + ")" + "<" + playerName + "> " + partyMessage);
|
||||
|
||||
for (Player member : party.getOnlineMembers()) {
|
||||
member.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Prefix", new Object[] {playerName}) + partyMessage);
|
||||
|
@ -8,32 +8,30 @@ import org.bukkit.inventory.ItemStack;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.Skills;
|
||||
import com.gmail.nossr50.skills.SkillTools;
|
||||
|
||||
public class Item {
|
||||
public final class ChimaeraWing {
|
||||
private ChimaeraWing() {}
|
||||
|
||||
/**
|
||||
* Check for item usage.
|
||||
*
|
||||
* @param player Player whose item usage to check
|
||||
*/
|
||||
public static void itemChecks(Player player) {
|
||||
public static void activationCheck(Player player) {
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
|
||||
if (Config.getInstance().getChimaeraEnabled() && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
|
||||
chimaeraWing(player);
|
||||
if (!Config.getInstance().getChimaeraEnabled() || inHand.getTypeId() != Config.getInstance().getChimaeraItemId()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private static void chimaeraWing(Player player) {
|
||||
PlayerProfile profile = Users.getProfile(player);
|
||||
ItemStack inHand = player.getItemInHand();
|
||||
Block block = player.getLocation().getBlock();
|
||||
int amount = inHand.getAmount();
|
||||
long recentlyHurt = profile.getRecentlyHurt();
|
||||
|
||||
if (Permissions.chimaeraWing(player) && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
|
||||
if (Skills.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
||||
if (SkillTools.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
||||
player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost()));
|
||||
|
||||
for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
|
||||
@ -53,11 +51,11 @@ public class Item {
|
||||
|
||||
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
|
||||
}
|
||||
else if (!Skills.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(recentlyHurt, 60, player)}));
|
||||
else if (!SkillTools.cooldownOver(recentlyHurt, 60, player) && amount >= Config.getInstance().getChimaeraCost()) {
|
||||
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {SkillTools.calculateTimeLeft(recentlyHurt, 60, player)}));
|
||||
}
|
||||
else if (amount <= Config.getInstance().getChimaeraCost()) {
|
||||
player.sendMessage(LocaleLoader.getString("Skills.NeedMore", new Object[] { Misc.prettyItemString(Config.getInstance().getChimaeraItemId()) }));
|
||||
player.sendMessage(LocaleLoader.getString("SkillTools.NeedMore", new Object[] { Misc.prettyItemString(Config.getInstance().getChimaeraItemId()) }));
|
||||
}
|
||||
}
|
||||
}
|
@ -7,13 +7,14 @@ import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillType;
|
||||
|
||||
public abstract class Hardcore {
|
||||
public final class Hardcore {
|
||||
public static double statLossPercentage = Config.getInstance().getHardcoreDeathStatPenaltyPercentage();
|
||||
public static double vampirismStatLeechPercentage = Config.getInstance().getHardcoreVampirismStatLeechPercentage();
|
||||
|
||||
public static boolean statLossEnabled = Config.getInstance().getHardcoreEnabled();
|
||||
public static boolean vampirismEnabled = Config.getInstance().getHardcoreVampirismEnabled();
|
||||
|
||||
private Hardcore() {}
|
||||
|
||||
public static void invokeStatPenalty(Player player) {
|
||||
if (statLossPercentage <= 0 || statLossPercentage > 100) {
|
||||
return;
|
||||
|
@ -12,12 +12,12 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.PlayerStat;
|
||||
import com.gmail.nossr50.skills.SkillType;
|
||||
|
||||
public class Leaderboard {
|
||||
private static mcMMO plugin = mcMMO.p;
|
||||
private final static String location = mcMMO.getUsersFile();
|
||||
public final class Leaderboard {
|
||||
private static HashMap<SkillType, List<PlayerStat>> playerStatHash = new HashMap<SkillType, List<PlayerStat>>();
|
||||
private static long lastUpdate = 0;
|
||||
|
||||
private Leaderboard() {}
|
||||
|
||||
/**
|
||||
* Update the leader boards.
|
||||
*/
|
||||
@ -47,7 +47,7 @@ public class Leaderboard {
|
||||
|
||||
//Read from the FlatFile database and fill our arrays with information
|
||||
try {
|
||||
FileReader file = new FileReader(location);
|
||||
FileReader file = new FileReader(mcMMO.getUsersFilePath());
|
||||
BufferedReader in = new BufferedReader(file);
|
||||
String line = "";
|
||||
ArrayList<String> players = new ArrayList<String>();
|
||||
@ -130,7 +130,7 @@ public class Leaderboard {
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
plugin.getLogger().severe(("Exception while reading " + location + " (Are you sure you formatted it correctly?)" + e.toString()));
|
||||
mcMMO.p.getLogger().severe(("Exception while reading " + mcMMO.getUsersFilePath() + " (Are you sure you formatted it correctly?)" + e.toString()));
|
||||
}
|
||||
|
||||
SkillComparator c = new SkillComparator();
|
||||
|
@ -25,19 +25,19 @@ import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent;
|
||||
import com.gmail.nossr50.events.items.McMMOItemSpawnEvent;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
|
||||
public class Misc {
|
||||
public final class Misc {
|
||||
private static Random random = new Random();
|
||||
|
||||
public static int toolDurabilityLoss = Config.getInstance().getAbilityToolDamage();
|
||||
public static int abilityLengthIncreaseLevel = AdvancedConfig.getInstance().getAbilityLength();
|
||||
public static boolean isSpawnerXPEnabled = Config.getInstance().getExperienceGainsMobspawnersEnabled();
|
||||
|
||||
public static final int PLAYER_RESPAWN_COOLDOWN_SECONDS = 5;
|
||||
public static final int TIME_CONVERSION_FACTOR = 1000;
|
||||
public static final double SKILL_MESSAGE_MAX_SENDING_DISTANCE = 10.0;
|
||||
public static final int NORMAL_SKILL_ACTIVATION_CHANCE = 100;
|
||||
public static final int LUCKY_SKILL_ACTIVATION_CHANCE = 75;
|
||||
|
||||
private Misc() {};
|
||||
|
||||
/**
|
||||
* Calculate activation chance for a skill.
|
||||
*
|
||||
@ -75,7 +75,7 @@ public class Misc {
|
||||
if (tamer instanceof Player) {
|
||||
Player owner = (Player) tamer;
|
||||
|
||||
if (owner == attacker || PartyManager.getInstance().inSameParty(attacker, owner)) {
|
||||
if (owner == attacker || PartyManager.inSameParty(attacker, owner)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -12,16 +12,17 @@ import com.gmail.nossr50.datatypes.mods.CustomBlock;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomItem;
|
||||
import com.gmail.nossr50.datatypes.mods.CustomTool;
|
||||
|
||||
public class ModChecks {
|
||||
public final class ModChecks {
|
||||
private static Config configInstance = Config.getInstance();
|
||||
private static boolean customToolsEnabled = configInstance.getToolModsEnabled();
|
||||
private static boolean customArmorEnabled = configInstance.getArmorModsEnabled();
|
||||
private static boolean customBlocksEnabled = configInstance.getBlockModsEnabled();
|
||||
|
||||
private static CustomToolsConfig toolInstance = CustomToolsConfig.getInstance();
|
||||
private static CustomArmorConfig armorInstance = CustomArmorConfig.getInstance();
|
||||
private static CustomBlocksConfig blocksInstance = CustomBlocksConfig.getInstance();
|
||||
|
||||
private ModChecks() {}
|
||||
|
||||
/**
|
||||
* Get the custom armor associated with an item.
|
||||
*
|
||||
|
@ -1,30 +1,42 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.skills.SkillType;
|
||||
|
||||
public class MOTD {
|
||||
private Player player;
|
||||
private String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
|
||||
public final class Motd {
|
||||
private static final String perkPrefix = LocaleLoader.getString("MOTD.PerksPrefix");
|
||||
private static final PluginDescriptionFile pluginDescription = mcMMO.p.getDescription();
|
||||
|
||||
public MOTD(Player player) {
|
||||
this.player = player;
|
||||
private Motd() {}
|
||||
|
||||
public static void displayAll(Player player) {
|
||||
displayVersion(player, pluginDescription.getVersion());
|
||||
displayHardcoreSettings(player);
|
||||
displayXpPerks(player);
|
||||
displayCooldownPerks(player);
|
||||
displayActivationPerks(player);
|
||||
displayLuckyPerks(player);
|
||||
displayWebsite(player, pluginDescription.getWebsite());
|
||||
}
|
||||
|
||||
/**
|
||||
* Display version info.
|
||||
* @param version The plugin version
|
||||
* @param player Target player
|
||||
* @param version Plugin version
|
||||
*/
|
||||
public void displayVersion(String version) {
|
||||
public static void displayVersion(Player player, String version) {
|
||||
player.sendMessage(LocaleLoader.getString("MOTD.Version", new Object[] {version}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display Hardcore Mode settings.
|
||||
* @param player Target player
|
||||
*/
|
||||
public void displayHardcoreSettings() {
|
||||
public static void displayHardcoreSettings(Player player) {
|
||||
if (Hardcore.statLossEnabled) {
|
||||
if (Hardcore.vampirismEnabled) {
|
||||
player.sendMessage(LocaleLoader.getString("MOTD.Hardcore.VampireOn"));
|
||||
@ -40,8 +52,9 @@ public class MOTD {
|
||||
|
||||
/**
|
||||
* Display XP perks.
|
||||
* @param player Target player
|
||||
*/
|
||||
public void displayXpPerks() {
|
||||
public static void displayXpPerks(Player player) {
|
||||
if (Permissions.xpQuadruple(player)) {
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.xp.name"), LocaleLoader.getString("Perks.xp.desc", new Object[] { 4 }) }));
|
||||
}
|
||||
@ -61,8 +74,9 @@ public class MOTD {
|
||||
|
||||
/**
|
||||
* Display cooldown perks.
|
||||
* @param player Target player
|
||||
*/
|
||||
public void displayCooldownPerks() {
|
||||
public static void displayCooldownPerks(Player player) {
|
||||
if (Permissions.cooldownsHalved(player)) {
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.cooldowns.name"), LocaleLoader.getString("Perks.cooldowns.desc", new Object[] { "1/2" }) }));
|
||||
}
|
||||
@ -76,8 +90,9 @@ public class MOTD {
|
||||
|
||||
/**
|
||||
* Display activiation perks.
|
||||
* @param player Target player
|
||||
*/
|
||||
public void displayActivationPerks() {
|
||||
public static void displayActivationPerks(Player player) {
|
||||
if (Permissions.activationTwelve(player)) {
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.activationtime.name"), LocaleLoader.getString("Perks.activationtime.desc", new Object[] { 12 }) }));
|
||||
}
|
||||
@ -91,8 +106,9 @@ public class MOTD {
|
||||
|
||||
/**
|
||||
* Display "lucky" perks.
|
||||
* @param player Target player
|
||||
*/
|
||||
public void displayLuckyPerks() {
|
||||
public static void displayLuckyPerks(Player player) {
|
||||
for (SkillType skill : SkillType.values()) {
|
||||
if (Permissions.lucky(player, skill)) {
|
||||
player.sendMessage(perkPrefix + LocaleLoader.getString("Effects.Template", new Object[] { LocaleLoader.getString("Perks.lucky.name"), LocaleLoader.getString("Perks.lucky.desc.login") }));
|
||||
@ -103,9 +119,10 @@ public class MOTD {
|
||||
|
||||
/**
|
||||
* Display website info.
|
||||
* @param website The plugin website
|
||||
* @param player Target player
|
||||
* @param website Plugin website
|
||||
*/
|
||||
public void displayWebsite(String website) {
|
||||
public static void displayWebsite(Player player, String website) {
|
||||
player.sendMessage(LocaleLoader.getString("MOTD.Website", new Object[] {website}));
|
||||
}
|
||||
}
|
@ -5,21 +5,11 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.skills.SkillType;
|
||||
|
||||
public class Permissions {
|
||||
public static boolean hasPermission(CommandSender sender, String perm)
|
||||
{
|
||||
if (sender.hasPermission(perm))
|
||||
return true;
|
||||
public final class Permissions {
|
||||
private Permissions() {}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasPermission(Player sender, String perm)
|
||||
{
|
||||
if (sender.hasPermission(perm))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
public static boolean hasPermission(CommandSender sender, String perm) {
|
||||
return (sender.hasPermission(perm));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -12,9 +12,11 @@ import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
|
||||
public class Users {
|
||||
public final class Users {
|
||||
private static Map<String, McMMOPlayer> players = new HashMap<String, McMMOPlayer>();
|
||||
|
||||
private Users() {};
|
||||
|
||||
/**
|
||||
* Load users.
|
||||
*/
|
||||
@ -22,7 +24,7 @@ public class Users {
|
||||
new File(mcMMO.getFlatFileDirectory()).mkdir();
|
||||
|
||||
try {
|
||||
new File(mcMMO.getUsersFile()).createNewFile();
|
||||
new File(mcMMO.getUsersFilePath()).createNewFile();
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
Reference in New Issue
Block a user