mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Made API classes 'statics'
This commit is contained in:
parent
290032646f
commit
f876fe8d25
@ -21,6 +21,7 @@ Version 1.3.09
|
||||
= Fixed bug with locale strings when trying to teleport to a non-existent player
|
||||
= Fixed bug with Tree Feller changing durability before checking for axe splintering
|
||||
= Fixed bug with Repair Mastery permission due to typo
|
||||
! API methods can now only be used in a static way
|
||||
! Changed Spout settings to be in their own config file (spout.yml)
|
||||
|
||||
Version 1.3.08
|
||||
|
@ -9,7 +9,10 @@ import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class ChatAPI {
|
||||
public final class ChatAPI {
|
||||
|
||||
private ChatAPI() {}
|
||||
|
||||
/**
|
||||
* Send a message to all members of a party
|
||||
* </br>
|
||||
@ -19,7 +22,7 @@ public class ChatAPI {
|
||||
* @param party The name of the party to send to
|
||||
* @param message The message to send
|
||||
*/
|
||||
public void sendPartyChat(String sender, String party, String message) {
|
||||
public static void sendPartyChat(String sender, String party, String message) {
|
||||
McMMOPartyChatEvent chatEvent = new McMMOPartyChatEvent(sender, party, message);
|
||||
McMMO.p.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
@ -48,7 +51,7 @@ public class ChatAPI {
|
||||
* @param sender The name of the sender to display in the chat
|
||||
* @param message The message to send
|
||||
*/
|
||||
public void sendAdminChat(String sender, String message) {
|
||||
public static void sendAdminChat(String sender, String message) {
|
||||
McMMOAdminChatEvent chatEvent = new McMMOAdminChatEvent(sender, message);
|
||||
McMMO.p.getServer().getPluginManager().callEvent(chatEvent);
|
||||
|
||||
|
@ -6,7 +6,9 @@ import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class ExperienceAPI {
|
||||
public final class ExperienceAPI {
|
||||
|
||||
private ExperienceAPI() {}
|
||||
|
||||
/**
|
||||
* Check the XP of a player. This should be called after giving XP to process level-ups.
|
||||
@ -14,7 +16,7 @@ public class ExperienceAPI {
|
||||
* @param player The player to check
|
||||
* @param skillType The skill to check
|
||||
*/
|
||||
private void checkXP(Player player, SkillType skillType) {
|
||||
private static void checkXP(Player player, SkillType skillType) {
|
||||
if (skillType.equals(SkillType.ALL)) {
|
||||
Skills.xpCheckAll(player, Users.getProfile(player));
|
||||
}
|
||||
@ -32,7 +34,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public void addRawXP(Player player, SkillType skillType, int XP) {
|
||||
public static void addRawXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getProfile(player).addXPOverride(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
@ -46,7 +48,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public void addMultipliedXP(Player player, SkillType skillType, int XP) {
|
||||
public static void addMultipliedXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getProfile(player).addXPOverrideBonus(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
@ -60,7 +62,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to add XP to
|
||||
* @param XP The amount of XP to add
|
||||
*/
|
||||
public void addXP(Player player, SkillType skillType, int XP) {
|
||||
public static void addXP(Player player, SkillType skillType, int XP) {
|
||||
Users.getProfile(player).addXP(skillType, XP);
|
||||
checkXP(player, skillType);
|
||||
}
|
||||
@ -74,7 +76,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to get XP for
|
||||
* @return the amount of XP in a given skill
|
||||
*/
|
||||
public int getXP(Player player, SkillType skillType) {
|
||||
public static int getXP(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillXpLevel(skillType);
|
||||
}
|
||||
|
||||
@ -87,7 +89,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to get the XP amount for
|
||||
* @return the amount of XP left before leveling up a specifc skill
|
||||
*/
|
||||
public int getXPToNextLevel(Player player, SkillType skillType) {
|
||||
public static int getXPToNextLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getXpToLevel(skillType);
|
||||
}
|
||||
|
||||
@ -101,7 +103,7 @@ public class ExperienceAPI {
|
||||
* @param levels Number of levels to add
|
||||
* @param notify True if this should fire a level up notification, false otherwise.
|
||||
*/
|
||||
public void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
|
||||
public static void addLevel(Player player, SkillType skillType, int levels, boolean notify) {
|
||||
Users.getProfile(player).addLevels(skillType, levels);
|
||||
|
||||
if (notify) {
|
||||
@ -118,7 +120,7 @@ public class ExperienceAPI {
|
||||
* @param skillType The skill to get the level for
|
||||
* @return the level of a given skill
|
||||
*/
|
||||
public int getLevel(Player player, SkillType skillType) {
|
||||
public static int getLevel(Player player, SkillType skillType) {
|
||||
return Users.getProfile(player).getSkillLevel(skillType);
|
||||
}
|
||||
|
||||
@ -130,7 +132,7 @@ public class ExperienceAPI {
|
||||
* @param player The player to get the power level for
|
||||
* @return the power level of the player
|
||||
*/
|
||||
public int getPowerLevel(Player player) {
|
||||
public static int getPowerLevel(Player player) {
|
||||
return Users.getProfile(player).getPowerLevel();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,9 @@ import org.bukkit.entity.Player;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class PartyAPI {
|
||||
public final class PartyAPI {
|
||||
|
||||
private PartyAPI() {}
|
||||
|
||||
/**
|
||||
* Get the name of the party a player is in.
|
||||
@ -17,7 +19,7 @@ public class PartyAPI {
|
||||
* @param player The player to check the party name of
|
||||
* @return the name of the player's party
|
||||
*/
|
||||
public String getPartyName(Player player) {
|
||||
public static String getPartyName(Player player) {
|
||||
return Users.getProfile(player).getParty();
|
||||
}
|
||||
|
||||
@ -29,7 +31,7 @@ public class PartyAPI {
|
||||
* @param player The player to check
|
||||
* @return true if the player is in a party, false otherwise
|
||||
*/
|
||||
public boolean inParty(Player player) {
|
||||
public static boolean inParty(Player player) {
|
||||
return Users.getProfile(player).inParty();
|
||||
}
|
||||
|
||||
@ -42,7 +44,7 @@ public class PartyAPI {
|
||||
* @param playerb The second player to check
|
||||
* @return true if the two players are in the same party, false otherwise
|
||||
*/
|
||||
public boolean inSameParty(Player playera, Player playerb) {
|
||||
public static boolean inSameParty(Player playera, Player playerb) {
|
||||
return Party.getInstance().inSameParty(playera, playerb);
|
||||
}
|
||||
|
||||
@ -53,7 +55,7 @@ public class PartyAPI {
|
||||
*
|
||||
* @return the list of parties.
|
||||
*/
|
||||
public ArrayList<String> getParties() {
|
||||
public static ArrayList<String> getParties() {
|
||||
return Party.getInstance().getParties();
|
||||
}
|
||||
|
||||
@ -65,7 +67,7 @@ public class PartyAPI {
|
||||
* @param player The player to add to the party
|
||||
* @param partyName The party to add the player to
|
||||
*/
|
||||
public void addToParty(Player player, String partyName) {
|
||||
public static void addToParty(Player player, String partyName) {
|
||||
Party.getInstance().addToParty(player, Users.getProfile(player), partyName, false, null);
|
||||
}
|
||||
|
||||
@ -76,7 +78,7 @@ public class PartyAPI {
|
||||
*
|
||||
* @param player The player to remove
|
||||
*/
|
||||
public void removeFromParty(Player player) {
|
||||
public static void removeFromParty(Player player) {
|
||||
Party.getInstance().removeFromParty(player, Users.getProfile(player));
|
||||
}
|
||||
|
||||
@ -88,7 +90,7 @@ public class PartyAPI {
|
||||
* @param partyName The party name
|
||||
* @return the leader of the party
|
||||
*/
|
||||
public Player getPartyLeader(String partyName) {
|
||||
public static Player getPartyLeader(String partyName) {
|
||||
return Party.getInstance().getPartyLeader(partyName);
|
||||
}
|
||||
|
||||
@ -100,7 +102,7 @@ public class PartyAPI {
|
||||
* @param partyName The name of the party to set the leader of
|
||||
* @param player The player to set as leader
|
||||
*/
|
||||
public void setPartyLeader(String partyName, String player) {
|
||||
public static void setPartyLeader(String partyName, String player) {
|
||||
Party.getInstance().setPartyLeader(partyName, player);
|
||||
}
|
||||
|
||||
@ -112,7 +114,7 @@ public class PartyAPI {
|
||||
* @param player The player to check
|
||||
* @return all the players in the player's party
|
||||
*/
|
||||
public ArrayList<Player> getAllMembers(Player player) {
|
||||
public static ArrayList<Player> getAllMembers(Player player) {
|
||||
return Party.getInstance().getAllMembers(player);
|
||||
}
|
||||
|
||||
@ -124,7 +126,7 @@ public class PartyAPI {
|
||||
* @param partyName The party to check
|
||||
* @return all online players in this party
|
||||
*/
|
||||
public ArrayList<Player> getOnlineMembers(String partyName) {
|
||||
public static ArrayList<Player> getOnlineMembers(String partyName) {
|
||||
return Party.getInstance().getOnlineMembers(partyName);
|
||||
}
|
||||
|
||||
@ -136,7 +138,7 @@ public class PartyAPI {
|
||||
* @param player The player to check
|
||||
* @return all online players in the player's party
|
||||
*/
|
||||
public ArrayList<Player> getOnlineMembers(Player player) {
|
||||
public static ArrayList<Player> getOnlineMembers(Player player) {
|
||||
return Party.getInstance().getOnlineMembers(player);
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,10 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.datatypes.ToolType;
|
||||
|
||||
public class SpoutToolsAPI {
|
||||
public final class SpoutToolsAPI {
|
||||
|
||||
private SpoutToolsAPI() {}
|
||||
|
||||
public static List<ItemStack> spoutSwords = new ArrayList<ItemStack>();
|
||||
public static List<ItemStack> spoutAxes = new ArrayList<ItemStack>();
|
||||
public static List<ItemStack> spoutPickaxes = new ArrayList<ItemStack>();
|
||||
@ -22,7 +25,7 @@ public class SpoutToolsAPI {
|
||||
* @param spoutTool The tool to add
|
||||
* @param type The type of tool to add
|
||||
*/
|
||||
public void addCustomTool(ItemStack spoutTool, ToolType type) {
|
||||
public static void addCustomTool(ItemStack spoutTool, ToolType type) {
|
||||
switch (type) {
|
||||
case AXE:
|
||||
spoutAxes.add(spoutTool);
|
||||
|
Loading…
Reference in New Issue
Block a user