mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
if( -> if (
This commit is contained in:
parent
435a6fde34
commit
291effdbc8
@ -83,8 +83,8 @@ public final class AbilityAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isBleeding(LivingEntity entity) {
|
public static boolean isBleeding(LivingEntity entity) {
|
||||||
if(entity.isValid()) {
|
if (entity.isValid()) {
|
||||||
if(entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
if (entity.hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -516,7 +516,7 @@ public final class ExperienceAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull PrimarySkillType skillType) throws InvalidPlayerException, UnsupportedOperationException {
|
public static float getOfflineXPRaw(@NotNull OfflinePlayer offlinePlayer, @NotNull PrimarySkillType skillType) throws InvalidPlayerException, UnsupportedOperationException {
|
||||||
if(SkillTools.isChildSkill(skillType))
|
if (SkillTools.isChildSkill(skillType))
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
|
|
||||||
return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(skillType);
|
return getOfflineProfile(offlinePlayer).getSkillXpLevelRaw(skillType);
|
||||||
@ -1149,7 +1149,7 @@ public final class ExperienceAPI {
|
|||||||
{
|
{
|
||||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
for(PrimarySkillType skillType : PrimarySkillType.values())
|
||||||
{
|
{
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
||||||
{
|
{
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
@ -1167,7 +1167,7 @@ public final class ExperienceAPI {
|
|||||||
{
|
{
|
||||||
for(BlockState bs : blockStates)
|
for(BlockState bs : blockStates)
|
||||||
{
|
{
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
if (ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
|
||||||
{
|
{
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
@ -1183,7 +1183,7 @@ public final class ExperienceAPI {
|
|||||||
{
|
{
|
||||||
for(PrimarySkillType skillType : PrimarySkillType.values())
|
for(PrimarySkillType skillType : PrimarySkillType.values())
|
||||||
{
|
{
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
||||||
{
|
{
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
@ -1198,7 +1198,7 @@ public final class ExperienceAPI {
|
|||||||
*/
|
*/
|
||||||
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
public static void addXpFromBlockBySkill(BlockState blockState, McMMOPlayer mcMMOPlayer, PrimarySkillType skillType)
|
||||||
{
|
{
|
||||||
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
if (ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
|
||||||
{
|
{
|
||||||
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public final class PartyAPI {
|
|||||||
* @return true if the player is in a party, false otherwise
|
* @return true if the player is in a party, false otherwise
|
||||||
*/
|
*/
|
||||||
public static boolean inParty(Player player) {
|
public static boolean inParty(Player player) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return UserManager.getPlayer(player).inParty();
|
return UserManager.getPlayer(player).inParty();
|
||||||
@ -94,14 +94,14 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void addToParty(Player player, String partyName) {
|
public static void addToParty(Player player, String partyName) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer == null)
|
if (mmoPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
||||||
@ -109,7 +109,7 @@ public final class PartyAPI {
|
|||||||
if (party == null) {
|
if (party == null) {
|
||||||
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName);
|
||||||
} else {
|
} else {
|
||||||
if(mcMMO.p.getPartyManager().isPartyFull(player, party))
|
if (mcMMO.p.getPartyManager().isPartyFull(player, party))
|
||||||
{
|
{
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
NotificationManager.sendPlayerInformation(player, NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull", party.toString());
|
||||||
return;
|
return;
|
||||||
@ -140,7 +140,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
|
public static void addToParty(Player player, String partyName, boolean bypassLimit) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
Party party = mcMMO.p.getPartyManager().getParty(partyName);
|
||||||
@ -161,7 +161,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
public static void removeFromParty(Player player) {
|
public static void removeFromParty(Player player) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled() || UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mcMMO.p.getPartyManager().removeFromParty(UserManager.getPlayer(player));
|
mcMMO.p.getPartyManager().removeFromParty(UserManager.getPlayer(player));
|
||||||
@ -176,7 +176,7 @@ public final class PartyAPI {
|
|||||||
* @return the leader of the party
|
* @return the leader of the party
|
||||||
*/
|
*/
|
||||||
public static @Nullable String getPartyLeader(String partyName) {
|
public static @Nullable String getPartyLeader(String partyName) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return mcMMO.p.getPartyManager().getPartyLeaderName(partyName);
|
return mcMMO.p.getPartyManager().getPartyLeaderName(partyName);
|
||||||
@ -192,7 +192,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static void setPartyLeader(String partyName, String playerName) {
|
public static void setPartyLeader(String partyName, String playerName) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mcMMO.p.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), mcMMO.p.getPartyManager().getParty(partyName));
|
mcMMO.p.getPartyManager().setPartyLeader(mcMMO.p.getServer().getOfflinePlayer(playerName).getUniqueId(), mcMMO.p.getPartyManager().getParty(partyName));
|
||||||
@ -208,7 +208,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
|
public static List<OfflinePlayer> getOnlineAndOfflineMembers(Player player) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ public final class PartyAPI {
|
|||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static LinkedHashSet<String> getMembers(Player player) {
|
public static LinkedHashSet<String> getMembers(Player player) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return (LinkedHashSet<String>) mcMMO.p.getPartyManager().getAllMembers(player).values();
|
return (LinkedHashSet<String>) mcMMO.p.getPartyManager().getAllMembers(player).values();
|
||||||
@ -245,7 +245,7 @@ public final class PartyAPI {
|
|||||||
* @return all the player names and uuids in the player's party
|
* @return all the player names and uuids in the player's party
|
||||||
*/
|
*/
|
||||||
public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
|
public static LinkedHashMap<UUID, String> getMembersMap(Player player) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return mcMMO.p.getPartyManager().getAllMembers(player);
|
return mcMMO.p.getPartyManager().getAllMembers(player);
|
||||||
@ -260,7 +260,7 @@ public final class PartyAPI {
|
|||||||
* @return all online players in this party
|
* @return all online players in this party
|
||||||
*/
|
*/
|
||||||
public static List<Player> getOnlineMembers(String partyName) {
|
public static List<Player> getOnlineMembers(String partyName) {
|
||||||
if(!mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (!mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return mcMMO.p.getPartyManager().getOnlineMembers(partyName);
|
return mcMMO.p.getPartyManager().getOnlineMembers(partyName);
|
||||||
|
@ -125,7 +125,7 @@ public class ChatManager {
|
|||||||
* @param targetChatChannel target chat channel
|
* @param targetChatChannel target chat channel
|
||||||
*/
|
*/
|
||||||
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
|
public void setOrToggleChatChannel(@NotNull McMMOPlayer mmoPlayer, @NotNull ChatChannel targetChatChannel) {
|
||||||
if(targetChatChannel == mmoPlayer.getChatChannel()) {
|
if (targetChatChannel == mmoPlayer.getChatChannel()) {
|
||||||
//Disabled message
|
//Disabled message
|
||||||
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
|
mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Chat.Channel.Off", StringUtils.getCapitalized(targetChatChannel.toString())));
|
||||||
mmoPlayer.setChatMode(ChatChannel.NONE);
|
mmoPlayer.setChatMode(ChatChannel.NONE);
|
||||||
@ -144,7 +144,7 @@ public class ChatManager {
|
|||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
for(int i = 0; i < args.length; i++) {
|
for(int i = 0; i < args.length; i++) {
|
||||||
if(i + 1 >= args.length) {
|
if (i + 1 >= args.length) {
|
||||||
stringBuilder.append(args[i]);
|
stringBuilder.append(args[i]);
|
||||||
} else {
|
} else {
|
||||||
stringBuilder.append(args[i]).append(" ");
|
stringBuilder.append(args[i]).append(" ");
|
||||||
@ -162,12 +162,12 @@ public class ChatManager {
|
|||||||
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
|
public boolean isMessageAllowed(@NotNull McMMOPlayer mmoPlayer) {
|
||||||
switch (mmoPlayer.getChatChannel()) {
|
switch (mmoPlayer.getChatChannel()) {
|
||||||
case ADMIN:
|
case ADMIN:
|
||||||
if(mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
|
if (mmoPlayer.getPlayer().isOp() || Permissions.adminChat(mmoPlayer.getPlayer())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PARTY:
|
case PARTY:
|
||||||
if(mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) {
|
if (mmoPlayer.getParty() != null && Permissions.partyChat(mmoPlayer.getPlayer())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -206,7 +206,7 @@ public class ChatManager {
|
|||||||
* @return true if the chat channel is enabled
|
* @return true if the chat channel is enabled
|
||||||
*/
|
*/
|
||||||
public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) {
|
public boolean isChatChannelEnabled(@NotNull ChatChannel chatChannel) {
|
||||||
if(!isChatEnabled) {
|
if (!isChatEnabled) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
switch(chatChannel) {
|
switch(chatChannel) {
|
||||||
|
@ -20,12 +20,12 @@ public class SamePartyPredicate<T extends CommandSender> implements Predicate<T>
|
|||||||
@Override
|
@Override
|
||||||
public boolean test(T t) {
|
public boolean test(T t) {
|
||||||
//Include the console in the audience
|
//Include the console in the audience
|
||||||
if(t instanceof ConsoleCommandSender) {
|
if (t instanceof ConsoleCommandSender) {
|
||||||
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
|
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
|
||||||
} else {
|
} else {
|
||||||
if(t instanceof Player player) {
|
if (t instanceof Player player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
if(mcMMOPlayer != null) {
|
if (mcMMOPlayer != null) {
|
||||||
return mcMMOPlayer.getParty() == party;
|
return mcMMOPlayer.getParty() == party;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,15 +48,15 @@ public abstract class AbstractPlayerAuthor implements Author {
|
|||||||
*/
|
*/
|
||||||
protected @NotNull String getSanitizedName(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
protected @NotNull String getSanitizedName(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
||||||
//Already in cache
|
//Already in cache
|
||||||
if(sanitizedNameCache.containsKey(chatChannel)) {
|
if (sanitizedNameCache.containsKey(chatChannel)) {
|
||||||
//Update cache
|
//Update cache
|
||||||
if(useDisplayName && hasPlayerDisplayNameChanged()) {
|
if (useDisplayName && hasPlayerDisplayNameChanged()) {
|
||||||
updateLastKnownDisplayName();
|
updateLastKnownDisplayName();
|
||||||
updateSanitizedNameCache(chatChannel, true);
|
updateSanitizedNameCache(chatChannel, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//Update last known display name
|
//Update last known display name
|
||||||
if(useDisplayName && hasPlayerDisplayNameChanged()) {
|
if (useDisplayName && hasPlayerDisplayNameChanged()) {
|
||||||
updateLastKnownDisplayName();
|
updateLastKnownDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ public abstract class AbstractPlayerAuthor implements Author {
|
|||||||
* @param useDisplayName whether to use this authors display name
|
* @param useDisplayName whether to use this authors display name
|
||||||
*/
|
*/
|
||||||
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
private void updateSanitizedNameCache(@NotNull ChatChannel chatChannel, boolean useDisplayName) {
|
||||||
if(useDisplayName) {
|
if (useDisplayName) {
|
||||||
sanitizedNameCache.put(chatChannel, TextUtils.sanitizeForSerializer(player.getDisplayName()));
|
sanitizedNameCache.put(chatChannel, TextUtils.sanitizeForSerializer(player.getDisplayName()));
|
||||||
} else {
|
} else {
|
||||||
//No need to sanitize a basic String
|
//No need to sanitize a basic String
|
||||||
|
@ -57,7 +57,7 @@ public class AdminChatMailer extends AbstractChatMailer {
|
|||||||
* @return the styled string, based on a locale entry
|
* @return the styled string, based on a locale entry
|
||||||
*/
|
*/
|
||||||
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) {
|
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor) {
|
||||||
if(canColor) {
|
if (canColor) {
|
||||||
return LocaleLoader.getTextComponent("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message);
|
return LocaleLoader.getTextComponent("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message);
|
||||||
} else {
|
} else {
|
||||||
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message));
|
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Admin", author.getAuthoredName(ChatChannel.ADMIN), message));
|
||||||
@ -83,7 +83,7 @@ public class AdminChatMailer extends AbstractChatMailer {
|
|||||||
McMMOChatEvent chatEvent = new McMMOAdminChatEvent(pluginRef, chatMessage, isAsync);
|
McMMOChatEvent chatEvent = new McMMOAdminChatEvent(pluginRef, chatMessage, isAsync);
|
||||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||||
|
|
||||||
if(!chatEvent.isCancelled()) {
|
if (!chatEvent.isCancelled()) {
|
||||||
sendMail(chatMessage);
|
sendMail(chatMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ public class PartyChatMailer extends AbstractChatMailer {
|
|||||||
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
|
McMMOChatEvent chatEvent = new McMMOPartyChatEvent(pluginRef, chatMessage, party, isAsync);
|
||||||
Bukkit.getPluginManager().callEvent(chatEvent);
|
Bukkit.getPluginManager().callEvent(chatEvent);
|
||||||
|
|
||||||
if(!chatEvent.isCancelled()) {
|
if (!chatEvent.isCancelled()) {
|
||||||
sendMail(chatMessage);
|
sendMail(chatMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,14 +60,14 @@ public class PartyChatMailer extends AbstractChatMailer {
|
|||||||
* @return the styled string, based on a locale entry
|
* @return the styled string, based on a locale entry
|
||||||
*/
|
*/
|
||||||
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) {
|
public @NotNull TextComponent addStyle(@NotNull Author author, @NotNull String message, boolean canColor, boolean isLeader) {
|
||||||
if(canColor) {
|
if (canColor) {
|
||||||
if(isLeader) {
|
if (isLeader) {
|
||||||
return LocaleLoader.getTextComponent("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message);
|
return LocaleLoader.getTextComponent("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message);
|
||||||
} else {
|
} else {
|
||||||
return LocaleLoader.getTextComponent("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message);
|
return LocaleLoader.getTextComponent("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(isLeader) {
|
if (isLeader) {
|
||||||
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message));
|
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party.Leader", author.getAuthoredName(ChatChannel.PARTY), message));
|
||||||
} else {
|
} else {
|
||||||
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message));
|
return TextUtils.ofLegacyTextRaw(LocaleLoader.getString("Chat.Style.Party", author.getAuthoredName(ChatChannel.PARTY), message));
|
||||||
|
@ -52,7 +52,7 @@ public class PartyChatMessage extends AbstractChatMessage {
|
|||||||
messagePartyChatSpies(spyMessage);
|
messagePartyChatSpies(spyMessage);
|
||||||
|
|
||||||
//Console message
|
//Console message
|
||||||
if(ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
|
if (ChatConfig.getInstance().isConsoleIncludedInAudience(ChatChannel.PARTY))
|
||||||
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
|
mcMMO.p.getChatManager().sendConsoleMessage(author, spyMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,11 +67,11 @@ public class PartyChatMessage extends AbstractChatMessage {
|
|||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getPlayer();
|
||||||
|
|
||||||
//Check for toggled players
|
//Check for toggled players
|
||||||
if(mcMMOPlayer.isPartyChatSpying()) {
|
if (mcMMOPlayer.isPartyChatSpying()) {
|
||||||
Party adminParty = mcMMOPlayer.getParty();
|
Party adminParty = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
//Only message admins not part of this party
|
//Only message admins not part of this party
|
||||||
if(adminParty == null || adminParty != getParty()) {
|
if (adminParty == null || adminParty != getParty()) {
|
||||||
//TODO: Hacky, rewrite later
|
//TODO: Hacky, rewrite later
|
||||||
Audience audience = mcMMO.getAudiences().player(player);
|
Audience audience = mcMMO.getAudiences().player(player);
|
||||||
audience.sendMessage(spyMessage);
|
audience.sendMessage(spyMessage);
|
||||||
|
@ -47,7 +47,7 @@ public class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerSkillCommands() {
|
private void registerSkillCommands() {
|
||||||
if(mcMMO.p.getGeneralConfig().isMasterySystemEnabled()) {
|
if (mcMMO.p.getGeneralConfig().isMasterySystemEnabled()) {
|
||||||
bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef));
|
bukkitCommandManager.registerCommand(new PowerLevelCommand(pluginRef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,11 +56,11 @@ public class CommandManager {
|
|||||||
* Registers chat commands if the chat system is enabled
|
* Registers chat commands if the chat system is enabled
|
||||||
*/
|
*/
|
||||||
private void registerChatCommands() {
|
private void registerChatCommands() {
|
||||||
if(ChatConfig.getInstance().isChatEnabled()) {
|
if (ChatConfig.getInstance().isChatEnabled()) {
|
||||||
if(ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
|
if (ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.ADMIN)) {
|
||||||
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
|
bukkitCommandManager.registerCommand(new AdminChatCommand(pluginRef));
|
||||||
}
|
}
|
||||||
if(pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
|
if (pluginRef.getPartyConfig().isPartyEnabled() && ChatConfig.getInstance().isChatChannelEnabled(ChatChannel.PARTY)) {
|
||||||
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
|
bukkitCommandManager.registerCommand(new PartyChatCommand(pluginRef));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public class CommandManager {
|
|||||||
bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> {
|
bukkitCommandManager.getCommandConditions().addCondition(POWER_LEVEL_CONDITION, (context) -> {
|
||||||
BukkitCommandIssuer issuer = context.getIssuer();
|
BukkitCommandIssuer issuer = context.getIssuer();
|
||||||
|
|
||||||
if(issuer.getIssuer() instanceof Player) {
|
if (issuer.getIssuer() instanceof Player) {
|
||||||
validateLoadedData(issuer.getPlayer());
|
validateLoadedData(issuer.getPlayer());
|
||||||
} else {
|
} else {
|
||||||
throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole"));
|
throw new ConditionFailedException(LocaleLoader.getString("Commands.NoConsole"));
|
||||||
@ -88,7 +88,7 @@ public class CommandManager {
|
|||||||
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
|
bukkitCommandManager.getCommandConditions().addCondition(ADMIN_CONDITION, (context) -> {
|
||||||
BukkitCommandIssuer issuer = context.getIssuer();
|
BukkitCommandIssuer issuer = context.getIssuer();
|
||||||
|
|
||||||
if(issuer.getIssuer() instanceof Player) {
|
if (issuer.getIssuer() instanceof Player) {
|
||||||
validateLoadedData(issuer.getPlayer());
|
validateLoadedData(issuer.getPlayer());
|
||||||
validateAdmin(issuer.getPlayer());
|
validateAdmin(issuer.getPlayer());
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ public class CommandManager {
|
|||||||
bukkitCommandManager.getCommandConditions().addCondition(MMO_DATA_LOADED, (context) -> {
|
bukkitCommandManager.getCommandConditions().addCondition(MMO_DATA_LOADED, (context) -> {
|
||||||
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
|
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
|
||||||
|
|
||||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||||
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -105,7 +105,7 @@ public class CommandManager {
|
|||||||
bukkitCommandManager.getCommandConditions().addCondition(PARTY_CONDITION, (context) -> {
|
bukkitCommandManager.getCommandConditions().addCondition(PARTY_CONDITION, (context) -> {
|
||||||
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
|
BukkitCommandIssuer bukkitCommandIssuer = context.getIssuer();
|
||||||
|
|
||||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||||
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
validateLoadedData(bukkitCommandIssuer.getPlayer());
|
||||||
validatePlayerParty(bukkitCommandIssuer.getPlayer());
|
validatePlayerParty(bukkitCommandIssuer.getPlayer());
|
||||||
//TODO: Is there even a point in validating permission? look into this later
|
//TODO: Is there even a point in validating permission? look into this later
|
||||||
@ -115,20 +115,20 @@ public class CommandManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) {
|
private void validatePermission(@NotNull String permissionNode, @NotNull Permissible permissible) {
|
||||||
if(!permissible.hasPermission(permissionNode)) {
|
if (!permissible.hasPermission(permissionNode)) {
|
||||||
throw new ConditionFailedException(LocaleLoader.getString("mcMMO.NoPermission"));
|
throw new ConditionFailedException(LocaleLoader.getString("mcMMO.NoPermission"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void validateAdmin(@NotNull Player player) {
|
public void validateAdmin(@NotNull Player player) {
|
||||||
if(!player.isOp() && !Permissions.adminChat(player)) {
|
if (!player.isOp() && !Permissions.adminChat(player)) {
|
||||||
throw new ConditionFailedException("You are lacking the correct permissions to use this command.");
|
throw new ConditionFailedException("You are lacking the correct permissions to use this command.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateLoadedData(@NotNull Player player) {
|
public void validateLoadedData(@NotNull Player player) {
|
||||||
if(UserManager.getPlayer(player) == null) {
|
if (UserManager.getPlayer(player) == null) {
|
||||||
throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad"));
|
throw new ConditionFailedException(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ public class CommandManager {
|
|||||||
public void validatePlayerParty(@NotNull Player player) {
|
public void validatePlayerParty(@NotNull Player player) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
|
if (!pluginRef.getPartyConfig().isPartyEnabled() || mmoPlayer.getParty() == null) {
|
||||||
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
|
throw new ConditionFailedException(LocaleLoader.getString("Commands.Party.None"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ public class McmmoCommand implements CommandExecutor {
|
|||||||
|
|
||||||
private void displayOtherCommands(CommandSender sender) {
|
private void displayOtherCommands(CommandSender sender) {
|
||||||
//Don't show them this category if they have none of the permissions
|
//Don't show them this category if they have none of the permissions
|
||||||
if(!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
|
if (!Permissions.skillreset(sender) && !Permissions.mmoedit(sender) && !Permissions.adminChat(sender) && !Permissions.mcgod(sender))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
sender.sendMessage(LocaleLoader.getString("Commands.Other"));
|
||||||
|
@ -23,12 +23,12 @@ public class McscoreboardCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
if (!mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Scoreboard.Disabled"));
|
sender.sendMessage(LocaleLoader.getString("Scoreboard.Disabled"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ScoreboardManager.isPlayerBoardSetup(sender.getName())) {
|
if (!ScoreboardManager.isPlayerBoardSetup(sender.getName())) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Scoreboard.NotSetupYet"));
|
sender.sendMessage(LocaleLoader.getString("Scoreboard.NotSetupYet"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (mcMMO.p.isXPEventEnabled()) {
|
if (mcMMO.p.isXPEventEnabled()) {
|
||||||
|
|
||||||
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
||||||
{
|
{
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Stop"),
|
LocaleLoader.getString("Commands.Event.Stop"),
|
||||||
@ -45,7 +45,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
10, 10*20, 20);
|
10, 10*20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
if (mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
||||||
{
|
{
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Stop.Subtitle"));
|
||||||
@ -82,7 +82,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
int newXpRate = Integer.parseInt(args[0]);
|
int newXpRate = Integer.parseInt(args[0]);
|
||||||
|
|
||||||
if(newXpRate < 0)
|
if (newXpRate < 0)
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
sender.sendMessage(ChatColor.RED+LocaleLoader.getString("Commands.NegativeNumberWarn"));
|
||||||
return true;
|
return true;
|
||||||
@ -90,7 +90,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
|
|
||||||
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
ExperienceConfig.getInstance().setExperienceGainsGlobalMultiplier(newXpRate);
|
||||||
|
|
||||||
if(mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
if (mcMMO.p.getAdvancedConfig().useTitlesForXPEvent())
|
||||||
{
|
{
|
||||||
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
NotificationManager.broadcastTitle(mcMMO.p.getServer(),
|
||||||
LocaleLoader.getString("Commands.Event.Start"),
|
LocaleLoader.getString("Commands.Event.Start"),
|
||||||
@ -98,7 +98,7 @@ public class XprateCommand implements TabExecutor {
|
|||||||
10, 10*20, 20);
|
10, 10*20, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
if (mcMMO.p.getGeneralConfig().broadcastEventMessages())
|
||||||
{
|
{
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.Start"));
|
||||||
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
mcMMO.p.getServer().broadcastMessage(LocaleLoader.getString("Commands.Event.XP", newXpRate));
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
//public class DropTreasureCommand implements CommandExecutor {
|
//public class DropTreasureCommand implements CommandExecutor {
|
||||||
// @Override
|
// @Override
|
||||||
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
// public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
// if(sender instanceof Player) {
|
// if (sender instanceof Player) {
|
||||||
// if(!sender.isOp()) {
|
// if (!sender.isOp()) {
|
||||||
// sender.sendMessage("This command is for Operators only");
|
// sender.sendMessage("This command is for Operators only");
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
@ -27,13 +27,13 @@
|
|||||||
// Location location = player.getLocation();
|
// Location location = player.getLocation();
|
||||||
// McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
// McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
//
|
//
|
||||||
// if(mmoPlayer == null) {
|
// if (mmoPlayer == null) {
|
||||||
// //TODO: Localize
|
// //TODO: Localize
|
||||||
// player.sendMessage("Your player data is not loaded yet");
|
// player.sendMessage("Your player data is not loaded yet");
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if(args.length == 0) {
|
// if (args.length == 0) {
|
||||||
// mcMMO.p.getLogger().info(player.toString() +" is dropping all mcMMO treasures via admin command at location "+location.toString());
|
// mcMMO.p.getLogger().info(player.toString() +" is dropping all mcMMO treasures via admin command at location "+location.toString());
|
||||||
// for(Rarity rarity : FishingTreasureConfig.getInstance().fishingRewards.keySet()) {
|
// for(Rarity rarity : FishingTreasureConfig.getInstance().fishingRewards.keySet()) {
|
||||||
// for(FishingTreasure fishingTreasure : FishingTreasureConfig.getInstance().fishingRewards.get(rarity)) {
|
// for(FishingTreasure fishingTreasure : FishingTreasureConfig.getInstance().fishingRewards.get(rarity)) {
|
||||||
|
@ -13,7 +13,7 @@ public class PlayerDebugCommand implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender);
|
||||||
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
||||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
||||||
|
@ -25,9 +25,9 @@ public class AdminChatCommand extends BaseCommand {
|
|||||||
@Default @Conditions(CommandManager.ADMIN_CONDITION)
|
@Default @Conditions(CommandManager.ADMIN_CONDITION)
|
||||||
public void processCommand(String[] args) {
|
public void processCommand(String[] args) {
|
||||||
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
||||||
if(args == null || args.length == 0) {
|
if (args == null || args.length == 0) {
|
||||||
//Process with no arguments
|
//Process with no arguments
|
||||||
if(bukkitCommandIssuer.isPlayer()) {
|
if (bukkitCommandIssuer.isPlayer()) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||||
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN);
|
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.ADMIN);
|
||||||
} else {
|
} else {
|
||||||
@ -35,10 +35,10 @@ public class AdminChatCommand extends BaseCommand {
|
|||||||
mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments.");
|
mcMMO.p.getLogger().info("You cannot switch chat channels as console, please provide full arguments.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(bukkitCommandIssuer.isPlayer()) {
|
if (bukkitCommandIssuer.isPlayer()) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||||
|
|
||||||
if(mmoPlayer == null)
|
if (mmoPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Message contains the original command so it needs to be passed to this method to trim it
|
//Message contains the original command so it needs to be passed to this method to trim it
|
||||||
|
@ -30,9 +30,9 @@ public class PartyChatCommand extends BaseCommand {
|
|||||||
public void processCommand(String[] args) {
|
public void processCommand(String[] args) {
|
||||||
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
BukkitCommandIssuer bukkitCommandIssuer = (BukkitCommandIssuer) getCurrentCommandIssuer();
|
||||||
|
|
||||||
if(args == null || args.length == 0) {
|
if (args == null || args.length == 0) {
|
||||||
//Process with no arguments
|
//Process with no arguments
|
||||||
if(bukkitCommandIssuer.isPlayer()) {
|
if (bukkitCommandIssuer.isPlayer()) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||||
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY);
|
pluginRef.getChatManager().setOrToggleChatChannel(mmoPlayer, ChatChannel.PARTY);
|
||||||
} else {
|
} else {
|
||||||
@ -45,7 +45,7 @@ public class PartyChatCommand extends BaseCommand {
|
|||||||
/*
|
/*
|
||||||
* Player Logic
|
* Player Logic
|
||||||
*/
|
*/
|
||||||
if(bukkitCommandIssuer.getIssuer() instanceof Player) {
|
if (bukkitCommandIssuer.getIssuer() instanceof Player) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(bukkitCommandIssuer.getPlayer());
|
||||||
processCommandArgsPlayer(mmoPlayer, args);
|
processCommandArgsPlayer(mmoPlayer, args);
|
||||||
/*
|
/*
|
||||||
@ -72,14 +72,14 @@ public class PartyChatCommand extends BaseCommand {
|
|||||||
* @param args command arguments
|
* @param args command arguments
|
||||||
*/
|
*/
|
||||||
private void processCommandArgsConsole(@NotNull String[] args) {
|
private void processCommandArgsConsole(@NotNull String[] args) {
|
||||||
if(args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
//Only specific a party and not the message
|
//Only specific a party and not the message
|
||||||
mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards.");
|
mcMMO.p.getLogger().severe("You need to specify a party name and then write a message afterwards.");
|
||||||
} else {
|
} else {
|
||||||
//Grab party
|
//Grab party
|
||||||
Party targetParty = mcMMO.p.getPartyManager().getParty(args[0]);
|
Party targetParty = mcMMO.p.getPartyManager().getParty(args[0]);
|
||||||
|
|
||||||
if(targetParty != null) {
|
if (targetParty != null) {
|
||||||
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
|
pluginRef.getChatManager().processConsoleMessage(StringUtils.buildStringAfterNthElement(args, 1), targetParty);
|
||||||
} else {
|
} else {
|
||||||
mcMMO.p.getLogger().severe("A party with that name doesn't exist!");
|
mcMMO.p.getLogger().severe("A party with that name doesn't exist!");
|
||||||
|
@ -28,7 +28,7 @@ public class ConvertDatabaseCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel());
|
DatabaseManager oldDatabase = DatabaseManagerFactory.createDatabaseManager(previousType, mcMMO.getUsersFilePath(), mcMMO.p.getLogger(), mcMMO.p.getPurgeTime(), mcMMO.p.getAdvancedConfig().getStartingLevel());
|
||||||
if(oldDatabase == null) {
|
if (oldDatabase == null) {
|
||||||
sender.sendMessage("Unable to load the old database! Check your log for errors.");
|
sender.sendMessage("Unable to load the old database! Check your log for errors.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
EventUtils.tryLevelChangeEvent(player, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||||
} else {
|
} else {
|
||||||
EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
EventUtils.tryLevelChangeEvent(mmoPlayer, skill, value, xpRemoved, true, XPGainReason.COMMAND);
|
||||||
@ -45,7 +45,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value));
|
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardAll.1", value));
|
||||||
@ -53,7 +53,7 @@ public class AddlevelsCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
player.sendMessage(LocaleLoader.getString("Commands.addlevels.AwardSkill.1", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
||||||
|
@ -26,7 +26,7 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
protected void handleCommand(Player player, PlayerProfile profile, PrimarySkillType skill, int value) {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
//Check if player profile is loaded
|
//Check if player profile is loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
UserManager.getPlayer(player).applyXpGain(skill, value, XPGainReason.COMMAND, XPGainSource.COMMAND);
|
||||||
@ -39,7 +39,7 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value));
|
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardAll", value));
|
||||||
@ -47,7 +47,7 @@ public class AddxpCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
player.sendMessage(LocaleLoader.getString("Commands.addxp.AwardSkill", value, mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
||||||
|
@ -24,16 +24,16 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
PrimarySkillType skill;
|
PrimarySkillType skill;
|
||||||
|
|
||||||
if(args.length < 2) {
|
if (args.length < 2) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if(args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) {
|
if (args.length == 2 && !isSilent(args) || args.length == 3 && isSilent(args)) {
|
||||||
if (CommandUtils.noConsoleUsage(sender)) {
|
if (CommandUtils.noConsoleUsage(sender)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!permissionsCheckSelf(sender)) {
|
if (!permissionsCheckSelf(sender)) {
|
||||||
if(command.getPermissionMessage() != null)
|
if (command.getPermissionMessage() != null)
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
sender.sendMessage("(mcMMO) No permission!");
|
sender.sendMessage("(mcMMO) No permission!");
|
||||||
return true;
|
return true;
|
||||||
@ -56,7 +56,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(sender.getName()) == null)
|
if (UserManager.getPlayer(sender.getName()) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
@ -65,7 +65,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
|
|
||||||
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args));
|
editValues((Player) sender, UserManager.getPlayer(sender.getName()).getProfile(), skill, Integer.parseInt(args[1]), isSilent(args));
|
||||||
return true;
|
return true;
|
||||||
} else if((args.length == 3 && !isSilent(args))
|
} else if ((args.length == 3 && !isSilent(args))
|
||||||
|| (args.length == 4 && isSilent(args))) {
|
|| (args.length == 4 && isSilent(args))) {
|
||||||
if (!permissionsCheckOthers(sender)) {
|
if (!permissionsCheckOthers(sender)) {
|
||||||
sender.sendMessage(command.getPermissionMessage());
|
sender.sendMessage(command.getPermissionMessage());
|
||||||
@ -104,7 +104,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
//Check loading by name
|
//Check loading by name
|
||||||
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
||||||
|
|
||||||
if(CommandUtils.unloadedProfile(sender, profile)) {
|
if (CommandUtils.unloadedProfile(sender, profile)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
private boolean isSilent(String[] args) {
|
private boolean isSilent(String[] args) {
|
||||||
int length = args.length;
|
int length = args.length;
|
||||||
|
|
||||||
if(length == 0)
|
if (length == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return args[length-1].equalsIgnoreCase("-s");
|
return args[length-1].equalsIgnoreCase("-s");
|
||||||
|
@ -41,7 +41,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer != null) {
|
if (mmoPlayer != null) {
|
||||||
EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
EventUtils.tryLevelEditEvent(mmoPlayer, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
||||||
} else {
|
} else {
|
||||||
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
EventUtils.tryLevelEditEvent(player, skill, value, xpRemoved, value > skillLevel, XPGainReason.COMMAND, skillLevel);
|
||||||
@ -51,7 +51,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
protected void handlePlayerMessageAll(Player player, int value, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
|
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.AllSkills.1", value));
|
||||||
@ -59,7 +59,7 @@ public class MmoeditCommand extends ExperienceCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
protected void handlePlayerMessageSkill(Player player, int value, PrimarySkillType skill, boolean isSilent) {
|
||||||
if(isSilent)
|
if (isSilent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), value));
|
player.sendMessage(LocaleLoader.getString("Commands.mmoedit.Modified.1", mcMMO.p.getSkillTools().getLocalizedSkillName(skill), value));
|
||||||
|
@ -87,7 +87,7 @@ public class SkillresetCommand implements TabExecutor {
|
|||||||
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
profile = mcMMO.getDatabaseManager().loadPlayerProfile(playerName);
|
||||||
|
|
||||||
//Check if it was present in DB
|
//Check if it was present in DB
|
||||||
if(CommandUtils.unloadedProfile(sender, profile)) {
|
if (CommandUtils.unloadedProfile(sender, profile)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PartyChangePasswordCommand implements CommandExecutor {
|
public class PartyChangePasswordCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -90,7 +90,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null)
|
||||||
{
|
{
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
@ -207,7 +207,7 @@ public class PartyCommand implements TabExecutor {
|
|||||||
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Not Loaded
|
//Not Loaded
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
|
@ -19,7 +19,7 @@ public class PartyCreateCommand implements CommandExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
player.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -23,7 +23,7 @@ public class PartyInfoCommand implements CommandExecutor {
|
|||||||
switch (args.length) {
|
switch (args.length) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -20,7 +20,7 @@ import java.util.Locale;
|
|||||||
public class PartyItemShareCommand implements CommandExecutor {
|
public class PartyItemShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -34,7 +34,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
@ -62,7 +62,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getPartyManager().isPartyFull(player, targetParty))
|
if (mcMMO.p.getPartyManager().isPartyFull(player, targetParty))
|
||||||
{
|
{
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
player.sendMessage(LocaleLoader.getString("Commands.Party.PartyFull", targetParty.toString()));
|
||||||
return true;
|
return true;
|
||||||
|
@ -55,7 +55,7 @@ public class PartyLockCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void togglePartyLock(CommandSender sender, boolean lock) {
|
private void togglePartyLock(CommandSender sender, boolean lock) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
|
@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class PartyXpShareCommand implements CommandExecutor {
|
public class PartyXpShareCommand implements CommandExecutor {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -37,7 +37,7 @@ public class PartyAllianceCommand implements TabExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -21,7 +21,7 @@ public class PtpAcceptCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
|
@ -45,21 +45,21 @@ public class PtpCommand implements TabExecutor {
|
|||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(player.getWorld()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (!UserManager.hasPlayerDataKey(player)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer((Player) sender) == null)
|
if (UserManager.getPlayer((Player) sender) == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return true;
|
return true;
|
||||||
@ -228,13 +228,13 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
protected static void handleTeleportWarmup(Player teleportingPlayer, Player targetPlayer) {
|
||||||
if(UserManager.getPlayer(targetPlayer) == null)
|
if (UserManager.getPlayer(targetPlayer) == null)
|
||||||
{
|
{
|
||||||
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
targetPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer(teleportingPlayer) == null)
|
if (UserManager.getPlayer(teleportingPlayer) == null)
|
||||||
{
|
{
|
||||||
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
teleportingPlayer.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
|
@ -85,7 +85,7 @@ public class McrankCommand implements TabExecutor {
|
|||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(sender.getName());
|
||||||
|
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return;
|
return;
|
||||||
|
@ -24,22 +24,22 @@ public class XPBarCommand implements TabExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
|
||||||
if(sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer((Player) sender);
|
||||||
if(mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad");
|
NotificationManager.sendPlayerInformationChatOnlyPrefixed(mmoPlayer.getPlayer(), "Profile.PendingLoad");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.length == 0) {
|
if (args.length == 0) {
|
||||||
return false;
|
return false;
|
||||||
} else if(args.length < 2) {
|
} else if (args.length < 2) {
|
||||||
String option = args[0];
|
String option = args[0];
|
||||||
|
|
||||||
if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
|
if (option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString())) {
|
||||||
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null);
|
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(ExperienceBarManager.XPBarSettingTarget.RESET, null);
|
||||||
return true;
|
return true;
|
||||||
} else if(option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
|
} else if (option.equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.DISABLE.toString())) {
|
||||||
mmoPlayer.getExperienceBarManager().disableAllBars();
|
mmoPlayer.getExperienceBarManager().disableAllBars();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@ -50,7 +50,7 @@ public class XPBarCommand implements TabExecutor {
|
|||||||
} else if (args.length == 2) {
|
} else if (args.length == 2) {
|
||||||
String skillName = args[1];
|
String skillName = args[1];
|
||||||
|
|
||||||
if(SkillUtils.isSkill(skillName)) {
|
if (SkillUtils.isSkill(skillName)) {
|
||||||
|
|
||||||
PrimarySkillType targetSkill = mcMMO.p.getSkillTools().matchSkill(skillName);
|
PrimarySkillType targetSkill = mcMMO.p.getSkillTools().matchSkill(skillName);
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ public class XPBarCommand implements TabExecutor {
|
|||||||
String option = args[0].toLowerCase();
|
String option = args[0].toLowerCase();
|
||||||
|
|
||||||
ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option);
|
ExperienceBarManager.XPBarSettingTarget settingTarget = getSettingTarget(option);
|
||||||
if(settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
|
if (settingTarget != null && settingTarget != ExperienceBarManager.XPBarSettingTarget.RESET) {
|
||||||
//Change setting
|
//Change setting
|
||||||
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill);
|
mmoPlayer.getExperienceBarManager().xpBarSettingToggle(settingTarget, targetSkill);
|
||||||
return true;
|
return true;
|
||||||
@ -103,7 +103,7 @@ public class XPBarCommand implements TabExecutor {
|
|||||||
|
|
||||||
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
|
return StringUtil.copyPartialMatches(args[0], options, new ArrayList<>(ExperienceBarManager.XPBarSettingTarget.values().length));
|
||||||
case 2:
|
case 2:
|
||||||
if(!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
|
if (!args[0].equalsIgnoreCase(ExperienceBarManager.XPBarSettingTarget.RESET.toString()))
|
||||||
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
|
return StringUtil.copyPartialMatches(args[1], mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES, new ArrayList<>(mcMMO.p.getSkillTools().LOCALIZED_SKILL_NAMES.size()));
|
||||||
default:
|
default:
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
|
@ -54,7 +54,7 @@ public class AcrobaticsCommand extends SkillCommand {
|
|||||||
|
|
||||||
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
AbstractSubSkill abstractSubSkill = InteractionManager.getAbstractByName("Roll");
|
||||||
|
|
||||||
if(abstractSubSkill != null)
|
if (abstractSubSkill != null)
|
||||||
{
|
{
|
||||||
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
|
String[] rollStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.ACROBATICS_ROLL);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class ArcheryCommand extends SkillCommand {
|
|||||||
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
|
messages.add(getStatMessage(SubSkillType.ARCHERY_SKILL_SHOT, skillShotBonus));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
if (Permissions.canUseSubSkill(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
|
messages.add(getStatMessage(SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ public class AxesCommand extends SkillCommand {
|
|||||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", skullSplitterLengthEndurance) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
if (Permissions.canUseSubSkill(player, SubSkillType.AXES_AXES_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
|
messages.add(getStatMessage(SubSkillType.AXES_AXES_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.AXES_AXES_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class CrossbowsCommand extends SkillCommand {
|
|||||||
String.valueOf(mmoPlayer.getCrossbowsManager().getTrickShotMaxBounceCount())));
|
String.valueOf(mmoPlayer.getCrossbowsManager().getTrickShotMaxBounceCount())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
if (Permissions.canUseSubSkill(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
|
messages.add(getStatMessage(CROSSBOWS_CROSSBOWS_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, CROSSBOWS_CROSSBOWS_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class ExcavationCommand extends SkillCommand {
|
|||||||
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
|
//messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
if (Permissions.canUseSubSkill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
|
||||||
messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
messages.add(getStatMessage(false, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
||||||
percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
|
percent.format(excavationManager.getArchaelogyExperienceOrbChance() / 100.0D)));
|
||||||
messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
messages.add(getStatMessage(true, false, SubSkillType.EXCAVATION_ARCHAEOLOGY,
|
||||||
|
@ -72,7 +72,7 @@ public class FishingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(totalEnchantChance >= 1)
|
if (totalEnchantChance >= 1)
|
||||||
magicChance = percent.format(totalEnchantChance / 100.0);
|
magicChance = percent.format(totalEnchantChance / 100.0);
|
||||||
else
|
else
|
||||||
magicChance = percent.format(0);
|
magicChance = percent.format(0);
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
// protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
// protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
// List<String> messages = new ArrayList<>();
|
// List<String> messages = new ArrayList<>();
|
||||||
//
|
//
|
||||||
// if(SkillUtils.canUseSubskill(player, MACES_MACES_LIMIT_BREAK)) {
|
// if (SkillUtils.canUseSubskill(player, MACES_MACES_LIMIT_BREAK)) {
|
||||||
// messages.add(getStatMessage(MACES_MACES_LIMIT_BREAK,
|
// messages.add(getStatMessage(MACES_MACES_LIMIT_BREAK,
|
||||||
// String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, MACES_MACES_LIMIT_BREAK, 1000))));
|
// String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, MACES_MACES_LIMIT_BREAK, 1000))));
|
||||||
// }
|
// }
|
||||||
|
@ -111,7 +111,7 @@ public class MiningCommand extends SkillCommand {
|
|||||||
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
//messages.add(LocaleLoader.getString("Mining.Effect.DropChance", doubleDropChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canTripleDrop) {
|
if (canTripleDrop) {
|
||||||
messages.add(getStatMessage(SubSkillType.MINING_MOTHER_LODE, tripleDropChance)
|
messages.add(getStatMessage(SubSkillType.MINING_MOTHER_LODE, tripleDropChance)
|
||||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
@ -26,14 +26,14 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
/*
|
/*
|
||||||
* Only allow players to use this command
|
* Only allow players to use this command
|
||||||
*/
|
*/
|
||||||
if(commandSender instanceof Player player)
|
if (commandSender instanceof Player player)
|
||||||
{
|
{
|
||||||
if(args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
|
if (args == null || args.length < 1 || args[0] == null || args[0].isEmpty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(Permissions.mmoinfo(player))
|
if (Permissions.mmoinfo(player))
|
||||||
{
|
{
|
||||||
if(args[0].equalsIgnoreCase( "???"))
|
if (args[0].equalsIgnoreCase( "???"))
|
||||||
{
|
{
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.Header"));
|
||||||
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
player.sendMessage(LocaleLoader.getString("Commands.MmoInfo.SubSkillHeader", "???"));
|
||||||
@ -59,7 +59,7 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
public SubSkillType matchSubSkill(String name) {
|
public SubSkillType matchSubSkill(String name) {
|
||||||
for(SubSkillType subSkillType : SubSkillType.values())
|
for(SubSkillType subSkillType : SubSkillType.values())
|
||||||
{
|
{
|
||||||
if(subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|
if (subSkillType.getNiceNameNoSpaces(subSkillType).equalsIgnoreCase(name)
|
||||||
|| subSkillType.name().equalsIgnoreCase(name))
|
|| subSkillType.name().equalsIgnoreCase(name))
|
||||||
return subSkillType;
|
return subSkillType;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
// send header
|
// send header
|
||||||
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
player.sendMessage(LocaleLoader.getString("Skills.Overhaul.Header", skillName));
|
||||||
|
|
||||||
if(!SkillTools.isChildSkill(skill))
|
if (!SkillTools.isChildSkill(skill))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* NON-CHILD SKILLS
|
* NON-CHILD SKILLS
|
||||||
@ -177,7 +177,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
for(int i = 0; i < parentList.size(); i++)
|
for(int i = 0; i < parentList.size(); i++)
|
||||||
{
|
{
|
||||||
if(i+1 < parentList.size())
|
if (i+1 < parentList.size())
|
||||||
{
|
{
|
||||||
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
parentMessage.append(LocaleLoader.getString("Effects.Child.ParentList", mcMMO.p.getSkillTools().getLocalizedSkillName(parentList.get(i)), mcMMOPlayer.getSkillLevel(parentList.get(i))));
|
||||||
parentMessage.append(ChatColor.GRAY).append(", ");
|
parentMessage.append(ChatColor.GRAY).append(", ");
|
||||||
@ -237,7 +237,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
|
|
||||||
int length;
|
int length;
|
||||||
|
|
||||||
if(abilityLengthCap <= 0)
|
if (abilityLengthCap <= 0)
|
||||||
{
|
{
|
||||||
length = 2 + (int) (skillValue / abilityLengthVar);
|
length = 2 + (int) (skillValue / abilityLengthVar);
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
String templateKey = isCustom ? "Ability.Generic.Template.Custom" : "Ability.Generic.Template";
|
||||||
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
String statDescriptionKey = !isExtra ? subSkillType.getLocaleKeyStatDescription() : subSkillType.getLocaleKeyStatExtraDescription();
|
||||||
|
|
||||||
if(isCustom)
|
if (isCustom)
|
||||||
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
|
return LocaleLoader.getString(templateKey, LocaleLoader.getString(statDescriptionKey, vars));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -274,7 +274,7 @@ public abstract class SkillCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String getLimitBreakDescriptionParameter() {
|
protected String getLimitBreakDescriptionParameter() {
|
||||||
if(mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
if (mcMMO.p.getAdvancedConfig().canApplyLimitBreakPVE()) {
|
||||||
return "(PVP/PVE)";
|
return "(PVP/PVE)";
|
||||||
} else {
|
} else {
|
||||||
return "(PVP)";
|
return "(PVP)";
|
||||||
|
@ -101,13 +101,13 @@ public class SwordsCommand extends SkillCommand {
|
|||||||
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", serratedStrikesLengthEndurance) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB))
|
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_STAB))
|
||||||
{
|
{
|
||||||
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
messages.add(getStatMessage(SubSkillType.SWORDS_STAB,
|
||||||
String.valueOf(mmoPlayer.getSwordsManager().getStabDamage())));
|
String.valueOf(mmoPlayer.getSwordsManager().getStabDamage())));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
if (SkillUtils.canUseSubskill(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
|
messages.add(getStatMessage(SubSkillType.SWORDS_SWORDS_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -31,12 +31,12 @@ public class TridentsCommand extends SkillCommand {
|
|||||||
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
|
||||||
List<String> messages = new ArrayList<>();
|
List<String> messages = new ArrayList<>();
|
||||||
|
|
||||||
if(SkillUtils.canUseSubskill(player, TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
if (SkillUtils.canUseSubskill(player, TRIDENTS_TRIDENTS_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(TRIDENTS_TRIDENTS_LIMIT_BREAK,
|
messages.add(getStatMessage(TRIDENTS_TRIDENTS_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, TRIDENTS_TRIDENTS_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, TRIDENTS_TRIDENTS_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(SkillUtils.canUseSubskill(player, TRIDENTS_IMPALE)) {
|
if (SkillUtils.canUseSubskill(player, TRIDENTS_IMPALE)) {
|
||||||
messages.add(getStatMessage(TRIDENTS_IMPALE,
|
messages.add(getStatMessage(TRIDENTS_IMPALE,
|
||||||
String.valueOf(mmoPlayer.getTridentsManager().impaleDamageBonus())));
|
String.valueOf(mmoPlayer.getTridentsManager().impaleDamageBonus())));
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ public class UnarmedCommand extends SkillCommand {
|
|||||||
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
|
//messages.add(LocaleLoader.getString("Unarmed.Ability.Chance.IronGrip", ironGripChance) + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", ironGripChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
if (Permissions.canUseSubSkill(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK)) {
|
||||||
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
|
messages.add(getStatMessage(SubSkillType.UNARMED_UNARMED_LIMIT_BREAK,
|
||||||
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
|
String.valueOf(CombatUtils.getLimitBreakDamageAgainstQuality(player, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK, 1000))));
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Clean Cuts
|
//Clean Cuts
|
||||||
if(canTripleDrop) {
|
if (canTripleDrop) {
|
||||||
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.WOODCUTTING_CLEAN_CUTS);
|
String[] tripleDropStrings = ProbabilityUtil.getRNGDisplayValues(mmoPlayer, SubSkillType.WOODCUTTING_CLEAN_CUTS);
|
||||||
tripleDropChance = tripleDropStrings[0];
|
tripleDropChance = tripleDropStrings[0];
|
||||||
tripleDropChanceLucky = tripleDropStrings[1];
|
tripleDropChanceLucky = tripleDropStrings[1];
|
||||||
@ -80,7 +80,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", doubleDropChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canTripleDrop) {
|
if (canTripleDrop) {
|
||||||
messages.add(getStatMessage(SubSkillType.WOODCUTTING_CLEAN_CUTS, tripleDropChance)
|
messages.add(getStatMessage(SubSkillType.WOODCUTTING_CLEAN_CUTS, tripleDropChance)
|
||||||
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
+ (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", tripleDropChanceLucky) : ""));
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ public class WoodcuttingCommand extends SkillCommand {
|
|||||||
if (canKnockOnWood) {
|
if (canKnockOnWood) {
|
||||||
String lootNote;
|
String lootNote;
|
||||||
|
|
||||||
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
if (RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
|
||||||
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Rank2");
|
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Rank2");
|
||||||
} else {
|
} else {
|
||||||
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Normal");
|
lootNote = LocaleLoader.getString("Woodcutting.SubSkill.KnockOnWood.Loot.Normal");
|
||||||
|
@ -52,7 +52,7 @@ public abstract class BukkitConfig {
|
|||||||
try {
|
try {
|
||||||
config.save(configFile);
|
config.save(configFile);
|
||||||
|
|
||||||
if(copyDefaults && !savedDefaults) {
|
if (copyDefaults && !savedDefaults) {
|
||||||
copyMissingDefaultsFromResource();
|
copyMissingDefaultsFromResource();
|
||||||
savedDefaults = true;
|
savedDefaults = true;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ public abstract class BukkitConfig {
|
|||||||
YamlConfiguration saveDefaultConfigToDisk() {
|
YamlConfiguration saveDefaultConfigToDisk() {
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "Copying default config to disk: " + fileName + " to defaults/" + fileName);
|
LogUtils.debug(mcMMO.p.getLogger(), "Copying default config to disk: " + fileName + " to defaults/" + fileName);
|
||||||
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
|
try(InputStream inputStream = mcMMO.p.getResource(fileName)) {
|
||||||
if(inputStream == null) {
|
if (inputStream == null) {
|
||||||
mcMMO.p.getLogger().severe("Unable to copy default config: " + fileName);
|
mcMMO.p.getLogger().severe("Unable to copy default config: " + fileName);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class WorldBlacklist {
|
|||||||
closeRead(fileReader);
|
closeRead(fileReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blacklist.size() > 0)
|
if (blacklist.size() > 0)
|
||||||
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
plugin.getLogger().info(blacklist.size() + " entries in mcMMO World Blacklist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,10 +195,10 @@ public class PotionConfig extends LegacyConfigLoader {
|
|||||||
PotionUtil.setBasePotionType(potionMeta, potionType, extended, upgraded);
|
PotionUtil.setBasePotionType(potionMeta, potionType, extended, upgraded);
|
||||||
|
|
||||||
// // Use the name of the potion to indicate upgrade status if not set in PotionData
|
// // Use the name of the potion to indicate upgrade status if not set in PotionData
|
||||||
// if(convertPotionConfigName(key).toUpperCase().contains("STRONG"))
|
// if (convertPotionConfigName(key).toUpperCase().contains("STRONG"))
|
||||||
// upgraded = true;
|
// upgraded = true;
|
||||||
//
|
//
|
||||||
// if(convertPotionConfigName(key).toUpperCase().contains("LONG"))
|
// if (convertPotionConfigName(key).toUpperCase().contains("LONG"))
|
||||||
// extended = true;
|
// extended = true;
|
||||||
|
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
|
@ -20,7 +20,7 @@ public class RepairConfigManager {
|
|||||||
repairables.addAll(mainRepairConfig.getLoadedRepairables());
|
repairables.addAll(mainRepairConfig.getLoadedRepairables());
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
if(fileName.equals(REPAIR_VANILLA_YML))
|
if (fileName.equals(REPAIR_VANILLA_YML))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!pattern.matcher(fileName).matches()) {
|
if (!pattern.matcher(fileName).matches()) {
|
||||||
|
@ -21,7 +21,7 @@ public class SalvageConfigManager {
|
|||||||
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
|
salvageables.addAll(mainSalvageConfig.getLoadedSalvageables());
|
||||||
|
|
||||||
for (String fileName : dataFolder.list()) {
|
for (String fileName : dataFolder.list()) {
|
||||||
if(fileName.equals(SALVAGE_VANILLA_YML))
|
if (fileName.equals(SALVAGE_VANILLA_YML))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!pattern.matcher(fileName).matches()) {
|
if (!pattern.matcher(fileName).matches()) {
|
||||||
|
@ -50,7 +50,7 @@ public class FishingTreasureConfig extends BukkitConfig {
|
|||||||
List<String> reason = new ArrayList<>();
|
List<String> reason = new ArrayList<>();
|
||||||
ConfigurationSection enchantment_drop_rates = config.getConfigurationSection("Enchantment_Drop_Rates");
|
ConfigurationSection enchantment_drop_rates = config.getConfigurationSection("Enchantment_Drop_Rates");
|
||||||
|
|
||||||
if(enchantment_drop_rates != null) {
|
if (enchantment_drop_rates != null) {
|
||||||
for (String tier : enchantment_drop_rates.getKeys(false)) {
|
for (String tier : enchantment_drop_rates.getKeys(false)) {
|
||||||
double totalEnchantDropRate = 0;
|
double totalEnchantDropRate = 0;
|
||||||
double totalItemDropRate = 0;
|
double totalItemDropRate = 0;
|
||||||
|
@ -33,7 +33,7 @@ public class FlatFileDataProcessor {
|
|||||||
assert !lineData.isEmpty();
|
assert !lineData.isEmpty();
|
||||||
|
|
||||||
//Make sure the data line is "correct"
|
//Make sure the data line is "correct"
|
||||||
if(lineData.charAt(lineData.length() - 1) != ':') {
|
if (lineData.charAt(lineData.length() - 1) != ':') {
|
||||||
// Length checks depend on last rawSplitData being ':'
|
// Length checks depend on last rawSplitData being ':'
|
||||||
// We add it here if it is missing
|
// We add it here if it is missing
|
||||||
lineData = lineData.concat(":");
|
lineData = lineData.concat(":");
|
||||||
@ -48,9 +48,9 @@ public class FlatFileDataProcessor {
|
|||||||
boolean anyBadData = false;
|
boolean anyBadData = false;
|
||||||
|
|
||||||
//This is the minimum size of the split array needed to be considered proper data
|
//This is the minimum size of the split array needed to be considered proper data
|
||||||
if(splitDataLine.length < getMinimumSplitDataLength()) {
|
if (splitDataLine.length < getMinimumSplitDataLength()) {
|
||||||
//Data is considered junk
|
//Data is considered junk
|
||||||
if(!corruptDataFound) {
|
if (!corruptDataFound) {
|
||||||
logger.severe("Some corrupt data was found in mcmmo.users and has been repaired, it is possible that some player data has been lost in this process.");
|
logger.severe("Some corrupt data was found in mcmmo.users and has been repaired, it is possible that some player data has been lost in this process.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
@ -59,9 +59,9 @@ public class FlatFileDataProcessor {
|
|||||||
builder.appendFlag(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE);
|
builder.appendFlag(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE);
|
||||||
|
|
||||||
//TODO: This block here is probably pointless
|
//TODO: This block here is probably pointless
|
||||||
if(splitDataLine.length >= 10 //The value here is kind of arbitrary, it shouldn't be too low to avoid false positives, but also we aren't really going to correctly identify when player data has been corrupted or not with 100% accuracy ever
|
if (splitDataLine.length >= 10 //The value here is kind of arbitrary, it shouldn't be too low to avoid false positives, but also we aren't really going to correctly identify when player data has been corrupted or not with 100% accuracy ever
|
||||||
&& splitDataLine[0] != null && !splitDataLine[0].isEmpty()) {
|
&& splitDataLine[0] != null && !splitDataLine[0].isEmpty()) {
|
||||||
if(splitDataLine[0].length() <= 16 && splitDataLine[0].length() >= 3) {
|
if (splitDataLine[0].length() <= 16 && splitDataLine[0].length() >= 3) {
|
||||||
logger.severe("Not enough data found to recover corrupted player data for user: "+splitDataLine[0]);
|
logger.severe("Not enough data found to recover corrupted player data for user: "+splitDataLine[0]);
|
||||||
registerData(builder.appendFlag(FlatFileDataFlag.TOO_INCOMPLETE));
|
registerData(builder.appendFlag(FlatFileDataFlag.TOO_INCOMPLETE));
|
||||||
return;
|
return;
|
||||||
@ -81,14 +81,14 @@ public class FlatFileDataProcessor {
|
|||||||
String name = splitDataLine[USERNAME_INDEX];
|
String name = splitDataLine[USERNAME_INDEX];
|
||||||
String strOfUUID = splitDataLine[UUID_INDEX];
|
String strOfUUID = splitDataLine[UUID_INDEX];
|
||||||
|
|
||||||
if(name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
reportBadDataLine("No name found for data", "[MISSING NAME]", lineData);
|
reportBadDataLine("No name found for data", "[MISSING NAME]", lineData);
|
||||||
builder.appendFlag(FlatFileDataFlag.MISSING_NAME);
|
builder.appendFlag(FlatFileDataFlag.MISSING_NAME);
|
||||||
anyBadData = true;
|
anyBadData = true;
|
||||||
badDataValues[USERNAME_INDEX] = true;
|
badDataValues[USERNAME_INDEX] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strOfUUID.isEmpty() || strOfUUID.equalsIgnoreCase("NULL")) {
|
if (strOfUUID.isEmpty() || strOfUUID.equalsIgnoreCase("NULL")) {
|
||||||
invalidUUID = true;
|
invalidUUID = true;
|
||||||
badDataValues[UUID_INDEX] = true;
|
badDataValues[UUID_INDEX] = true;
|
||||||
reportBadDataLine("Empty/null UUID for user", "Empty/null", lineData);
|
reportBadDataLine("Empty/null UUID for user", "Empty/null", lineData);
|
||||||
@ -110,20 +110,20 @@ public class FlatFileDataProcessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Duplicate UUID is no good, reject them
|
//Duplicate UUID is no good, reject them
|
||||||
if(!invalidUUID && uuid != null && uuids.contains(uuid)) {
|
if (!invalidUUID && uuid != null && uuids.contains(uuid)) {
|
||||||
registerData(builder.appendFlag(FlatFileDataFlag.DUPLICATE_UUID));
|
registerData(builder.appendFlag(FlatFileDataFlag.DUPLICATE_UUID));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uuids.add(uuid);
|
uuids.add(uuid);
|
||||||
|
|
||||||
if(names.contains(name)) {
|
if (names.contains(name)) {
|
||||||
builder.appendFlag(FlatFileDataFlag.DUPLICATE_NAME);
|
builder.appendFlag(FlatFileDataFlag.DUPLICATE_NAME);
|
||||||
anyBadData = true;
|
anyBadData = true;
|
||||||
badDataValues[USERNAME_INDEX] = true;
|
badDataValues[USERNAME_INDEX] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!name.isEmpty())
|
if (!name.isEmpty())
|
||||||
names.add(name);
|
names.add(name);
|
||||||
|
|
||||||
//Make sure the data is up to date schema wise, if it isn't we adjust it to the correct size and flag it for repair
|
//Make sure the data is up to date schema wise, if it isn't we adjust it to the correct size and flag it for repair
|
||||||
@ -136,9 +136,9 @@ public class FlatFileDataProcessor {
|
|||||||
|
|
||||||
//Check each data for bad values
|
//Check each data for bad values
|
||||||
for(int i = 0; i < DATA_ENTRY_COUNT; i++) {
|
for(int i = 0; i < DATA_ENTRY_COUNT; i++) {
|
||||||
if(shouldNotBeEmpty(splitDataLine[i], i)) {
|
if (shouldNotBeEmpty(splitDataLine[i], i)) {
|
||||||
|
|
||||||
if(i == OVERHAUL_LAST_LOGIN) {
|
if (i == OVERHAUL_LAST_LOGIN) {
|
||||||
builder.appendFlag(FlatFileDataFlag.LAST_LOGIN_SCHEMA_UPGRADE);
|
builder.appendFlag(FlatFileDataFlag.LAST_LOGIN_SCHEMA_UPGRADE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,13 +149,13 @@ public class FlatFileDataProcessor {
|
|||||||
|
|
||||||
boolean isCorrectType = isOfExpectedType(splitDataLine[i], getExpectedValueType(i));
|
boolean isCorrectType = isOfExpectedType(splitDataLine[i], getExpectedValueType(i));
|
||||||
|
|
||||||
if(!isCorrectType) {
|
if (!isCorrectType) {
|
||||||
anyBadData = true;
|
anyBadData = true;
|
||||||
badDataValues[i] = true;
|
badDataValues[i] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(anyBadData) {
|
if (anyBadData) {
|
||||||
builder.appendFlag(FlatFileDataFlag.BAD_VALUES);
|
builder.appendFlag(FlatFileDataFlag.BAD_VALUES);
|
||||||
builder.appendBadDataValues(badDataValues);
|
builder.appendBadDataValues(badDataValues);
|
||||||
}
|
}
|
||||||
@ -166,7 +166,7 @@ public class FlatFileDataProcessor {
|
|||||||
public @NotNull String[] isDataSchemaUpToDate(@NotNull String[] splitDataLine, @NotNull FlatFileDataBuilder builder, boolean[] badDataValues) {
|
public @NotNull String[] isDataSchemaUpToDate(@NotNull String[] splitDataLine, @NotNull FlatFileDataBuilder builder, boolean[] badDataValues) {
|
||||||
assert splitDataLine.length <= DATA_ENTRY_COUNT; //should NEVER be higher
|
assert splitDataLine.length <= DATA_ENTRY_COUNT; //should NEVER be higher
|
||||||
|
|
||||||
if(splitDataLine.length < DATA_ENTRY_COUNT) {
|
if (splitDataLine.length < DATA_ENTRY_COUNT) {
|
||||||
int oldLength = splitDataLine.length;
|
int oldLength = splitDataLine.length;
|
||||||
splitDataLine = Arrays.copyOf(splitDataLine, DATA_ENTRY_COUNT);
|
splitDataLine = Arrays.copyOf(splitDataLine, DATA_ENTRY_COUNT);
|
||||||
int newLength = splitDataLine.length;
|
int newLength = splitDataLine.length;
|
||||||
@ -184,7 +184,7 @@ public class FlatFileDataProcessor {
|
|||||||
|
|
||||||
|
|
||||||
public boolean shouldNotBeEmpty(@Nullable String data, int index) {
|
public boolean shouldNotBeEmpty(@Nullable String data, int index) {
|
||||||
if(getExpectedValueType(index) == ExpectedType.IGNORED) {
|
if (getExpectedValueType(index) == ExpectedType.IGNORED) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return data == null || data.isEmpty();
|
return data == null || data.isEmpty();
|
||||||
@ -248,7 +248,7 @@ public class FlatFileDataProcessor {
|
|||||||
FlatFileDataContainer flatFileDataContainer = builder.build();
|
FlatFileDataContainer flatFileDataContainer = builder.build();
|
||||||
flatFileDataContainers.add(flatFileDataContainer);
|
flatFileDataContainers.add(flatFileDataContainer);
|
||||||
|
|
||||||
if(flatFileDataContainer.getDataFlags() != null)
|
if (flatFileDataContainer.getDataFlags() != null)
|
||||||
flatFileDataFlags.addAll(flatFileDataContainer.getDataFlags());
|
flatFileDataFlags.addAll(flatFileDataContainer.getDataFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ public class FlatFileDataProcessor {
|
|||||||
for(FlatFileDataContainer dataContainer : flatFileDataContainers) {
|
for(FlatFileDataContainer dataContainer : flatFileDataContainers) {
|
||||||
String[] splitData = FlatFileDataUtil.getPreparedSaveDataLine(dataContainer);
|
String[] splitData = FlatFileDataUtil.getPreparedSaveDataLine(dataContainer);
|
||||||
|
|
||||||
if(splitData == null)
|
if (splitData == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//We add a trailing : as it is needed for some reason (is it?)
|
//We add a trailing : as it is needed for some reason (is it?)
|
||||||
|
@ -101,15 +101,15 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
this.startingLevel = startingLevel;
|
this.startingLevel = startingLevel;
|
||||||
this.testing = testing;
|
this.testing = testing;
|
||||||
|
|
||||||
if(!usersFile.exists()) {
|
if (!usersFile.exists()) {
|
||||||
initEmptyDB();
|
initEmptyDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!testing) {
|
if (!testing) {
|
||||||
List<FlatFileDataFlag> flatFileDataFlags = checkFileHealthAndStructure();
|
List<FlatFileDataFlag> flatFileDataFlags = checkFileHealthAndStructure();
|
||||||
|
|
||||||
if(flatFileDataFlags != null) {
|
if (flatFileDataFlags != null) {
|
||||||
if(!flatFileDataFlags.isEmpty()) {
|
if (!flatFileDataFlags.isEmpty()) {
|
||||||
logger.info("Detected "+flatFileDataFlags.size() + " data entries which need correction.");
|
logger.info("Detected "+flatFileDataFlags.size() + " data entries which need correction.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
if (lastPlayed == -1) {
|
if (lastPlayed == -1) {
|
||||||
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(uuid);
|
OfflinePlayer player = mcMMO.p.getServer().getOfflinePlayer(uuid);
|
||||||
|
|
||||||
if(player.getLastPlayed() != 0) {
|
if (player.getLastPlayed() != 0) {
|
||||||
lastPlayed = player.getLastPlayed();
|
lastPlayed = player.getLastPlayed();
|
||||||
rewrite = true;
|
rewrite = true;
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
out = new FileWriter(usersFilePath);
|
out = new FileWriter(usersFilePath);
|
||||||
out.write(writer.toString());
|
out.write(writer.toString());
|
||||||
|
|
||||||
if(testing) {
|
if (testing) {
|
||||||
System.out.println(writer);
|
System.out.println(writer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -354,15 +354,15 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
boolean wroteUser = false;
|
boolean wroteUser = false;
|
||||||
// While not at the end of the file
|
// While not at the end of the file
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
writer.append(line).append("\r\n");
|
writer.append(line).append("\r\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check for incomplete or corrupted data
|
//Check for incomplete or corrupted data
|
||||||
if(!line.contains(":")) {
|
if (!line.contains(":")) {
|
||||||
|
|
||||||
if(!corruptDataFound) {
|
if (!corruptDataFound) {
|
||||||
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
@ -373,9 +373,9 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String[] splitData = line.split(":");
|
String[] splitData = line.split(":");
|
||||||
|
|
||||||
//This would be rare, but check the splitData for having enough entries to contain a UUID
|
//This would be rare, but check the splitData for having enough entries to contain a UUID
|
||||||
if(splitData.length < UUID_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
|
if (splitData.length < UUID_INDEX) { //UUID have been in mcMMO DB for a very long time so any user without
|
||||||
|
|
||||||
if(!corruptDataFound) {
|
if (!corruptDataFound) {
|
||||||
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
logger.severe("mcMMO found some unexpected or corrupted data in mcmmo.users and is removing it, it is possible some data has been lost.");
|
||||||
corruptDataFound = true;
|
corruptDataFound = true;
|
||||||
}
|
}
|
||||||
@ -397,7 +397,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
/*
|
/*
|
||||||
* If we couldn't find the user in the DB we need to add him
|
* If we couldn't find the user in the DB we need to add him
|
||||||
*/
|
*/
|
||||||
if(!wroteUser) {
|
if (!wroteUser) {
|
||||||
writeUserToLine(profile, writer);
|
writeUserToLine(profile, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,7 +498,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
public @NotNull List<PlayerStat> readLeaderboard(@Nullable PrimarySkillType primarySkillType, int pageNumber, int statsPerPage) throws InvalidSkillException {
|
public @NotNull List<PlayerStat> readLeaderboard(@Nullable PrimarySkillType primarySkillType, int pageNumber, int statsPerPage) throws InvalidSkillException {
|
||||||
//Fix for a plugin that people are using that is throwing SQL errors
|
//Fix for a plugin that people are using that is throwing SQL errors
|
||||||
if(primarySkillType != null && SkillTools.isChildSkill(primarySkillType)) {
|
if (primarySkillType != null && SkillTools.isChildSkill(primarySkillType)) {
|
||||||
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
||||||
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
||||||
}
|
}
|
||||||
@ -572,11 +572,11 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
private @NotNull UserQuery getUserQuery(@Nullable UUID uuid, @Nullable String playerName) throws NullPointerException {
|
private @NotNull UserQuery getUserQuery(@Nullable UUID uuid, @Nullable String playerName) throws NullPointerException {
|
||||||
boolean hasName = playerName != null && !playerName.equalsIgnoreCase("null");
|
boolean hasName = playerName != null && !playerName.equalsIgnoreCase("null");
|
||||||
|
|
||||||
if(hasName && uuid != null) {
|
if (hasName && uuid != null) {
|
||||||
return new UserQueryFull(playerName, uuid);
|
return new UserQueryFull(playerName, uuid);
|
||||||
} else if (uuid != null) {
|
} else if (uuid != null) {
|
||||||
return new UserQueryUUIDImpl(uuid);
|
return new UserQueryUUIDImpl(uuid);
|
||||||
} else if(hasName) {
|
} else if (hasName) {
|
||||||
return new UserQueryNameImpl(playerName);
|
return new UserQueryNameImpl(playerName);
|
||||||
} else {
|
} else {
|
||||||
throw new NullPointerException("Both name and UUID cannot be null, at least one must be non-null!");
|
throw new NullPointerException("Both name and UUID cannot be null, at least one must be non-null!");
|
||||||
@ -610,7 +610,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,12 +620,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
|
|
||||||
/* Don't read corrupt data */
|
/* Don't read corrupt data */
|
||||||
if(rawSplitData.length < (USERNAME_INDEX + 1)) {
|
if (rawSplitData.length < (USERNAME_INDEX + 1)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we found the player
|
// we found the player
|
||||||
if(playerName.equalsIgnoreCase(rawSplitData[USERNAME_INDEX])) {
|
if (playerName.equalsIgnoreCase(rawSplitData[USERNAME_INDEX])) {
|
||||||
return loadFromLine(rawSplitData);
|
return loadFromLine(rawSplitData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -660,24 +660,24 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String line;
|
String line;
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Find if the line contains the player we want.
|
// Find if the line contains the player we want.
|
||||||
String[] rawSplitData = line.split(":");
|
String[] rawSplitData = line.split(":");
|
||||||
|
|
||||||
/* Don't read corrupt data */
|
/* Don't read corrupt data */
|
||||||
if(rawSplitData.length < (UUID_INDEX + 1)) {
|
if (rawSplitData.length < (UUID_INDEX + 1)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
|
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
|
||||||
if(fromDataUUID.equals(uuid)) {
|
if (fromDataUUID.equals(uuid)) {
|
||||||
return loadFromLine(rawSplitData);
|
return loadFromLine(rawSplitData);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if(testing) {
|
if (testing) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -716,20 +716,20 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String line;
|
String line;
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Find if the line contains the player we want.
|
// Find if the line contains the player we want.
|
||||||
String[] rawSplitData = line.split(":");
|
String[] rawSplitData = line.split(":");
|
||||||
|
|
||||||
/* Don't read corrupt data */
|
/* Don't read corrupt data */
|
||||||
if(rawSplitData.length < (UUID_INDEX + 1)) {
|
if (rawSplitData.length < (UUID_INDEX + 1)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
|
UUID fromDataUUID = UUID.fromString(rawSplitData[UUID_INDEX]);
|
||||||
if(fromDataUUID.equals(uuid)) {
|
if (fromDataUUID.equals(uuid)) {
|
||||||
//Matched UUID, now check if name matches
|
//Matched UUID, now check if name matches
|
||||||
String dbPlayerName = rawSplitData[USERNAME_INDEX];
|
String dbPlayerName = rawSplitData[USERNAME_INDEX];
|
||||||
|
|
||||||
@ -746,7 +746,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
return loadFromLine(rawSplitData);
|
return loadFromLine(rawSplitData);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
if(testing) {
|
if (testing) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -774,7 +774,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private @NotNull PlayerProfile grabUnloadedProfile(@NotNull UUID uuid, @Nullable String playerName) {
|
private @NotNull PlayerProfile grabUnloadedProfile(@NotNull UUID uuid, @Nullable String playerName) {
|
||||||
if(playerName == null) {
|
if (playerName == null) {
|
||||||
playerName = ""; //No name for you boy!
|
playerName = ""; //No name for you boy!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -793,7 +793,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
String line;
|
String line;
|
||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
if(line.startsWith("#")) {
|
if (line.startsWith("#")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1014,7 +1014,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
|
|
||||||
while ((line = in.readLine()) != null) {
|
while ((line = in.readLine()) != null) {
|
||||||
|
|
||||||
if(line.startsWith("#"))
|
if (line.startsWith("#"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
String[] data = line.split(":");
|
String[] data = line.split(":");
|
||||||
@ -1145,12 +1145,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
//Analyze the data
|
//Analyze the data
|
||||||
while ((currentLine = bufferedReader.readLine()) != null) {
|
while ((currentLine = bufferedReader.readLine()) != null) {
|
||||||
//Commented lines
|
//Commented lines
|
||||||
if(currentLine.startsWith("#") && dbCommentDate == null) { //The first commented line in the file is likely to be our note about when the file was created
|
if (currentLine.startsWith("#") && dbCommentDate == null) { //The first commented line in the file is likely to be our note about when the file was created
|
||||||
dbCommentDate = currentLine;
|
dbCommentDate = currentLine;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentLine.isEmpty())
|
if (currentLine.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//TODO: We are never passing empty lines, should we remove the flag for them?
|
//TODO: We are never passing empty lines, should we remove the flag for them?
|
||||||
@ -1158,12 +1158,12 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Only update the file if needed
|
//Only update the file if needed
|
||||||
if(!dataProcessor.getFlatFileDataFlags().isEmpty()) {
|
if (!dataProcessor.getFlatFileDataFlags().isEmpty()) {
|
||||||
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
|
flagsFound = new ArrayList<>(dataProcessor.getFlatFileDataFlags());
|
||||||
logger.info("Updating FlatFile Database...");
|
logger.info("Updating FlatFile Database...");
|
||||||
fileWriter = new FileWriter(usersFilePath);
|
fileWriter = new FileWriter(usersFilePath);
|
||||||
//Write data to file
|
//Write data to file
|
||||||
if(dbCommentDate != null)
|
if (dbCommentDate != null)
|
||||||
fileWriter.write(dbCommentDate + "\r\n");
|
fileWriter.write(dbCommentDate + "\r\n");
|
||||||
|
|
||||||
fileWriter.write(dataProcessor.processDataForSave().toString());
|
fileWriter.write(dataProcessor.processDataForSave().toString());
|
||||||
@ -1176,7 +1176,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flagsFound == null || flagsFound.isEmpty()) {
|
if (flagsFound == null || flagsFound.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return flagsFound;
|
return flagsFound;
|
||||||
@ -1184,7 +1184,7 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void closeResources(BufferedReader bufferedReader, FileWriter fileWriter) {
|
private void closeResources(BufferedReader bufferedReader, FileWriter fileWriter) {
|
||||||
if(bufferedReader != null) {
|
if (bufferedReader != null) {
|
||||||
try {
|
try {
|
||||||
bufferedReader.close();
|
bufferedReader.close();
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
this.h2 = h2;
|
this.h2 = h2;
|
||||||
String connectionString = getConnectionString(h2);
|
String connectionString = getConnectionString(h2);
|
||||||
|
|
||||||
if(!h2 && mcMMO.p.getGeneralConfig().getMySQLPublicKeyRetrieval()) {
|
if (!h2 && mcMMO.p.getGeneralConfig().getMySQLPublicKeyRetrieval()) {
|
||||||
connectionString+=
|
connectionString+=
|
||||||
"&allowPublicKeyRetrieval=true";
|
"&allowPublicKeyRetrieval=true";
|
||||||
}
|
}
|
||||||
@ -140,7 +140,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
String connectionString = "jdbc:mysql://" + mcMMO.p.getGeneralConfig().getMySQLServerName()
|
String connectionString = "jdbc:mysql://" + mcMMO.p.getGeneralConfig().getMySQLServerName()
|
||||||
+ ":" + mcMMO.p.getGeneralConfig().getMySQLServerPort() + "/" + mcMMO.p.getGeneralConfig().getMySQLDatabaseName();
|
+ ":" + mcMMO.p.getGeneralConfig().getMySQLServerPort() + "/" + mcMMO.p.getGeneralConfig().getMySQLDatabaseName();
|
||||||
|
|
||||||
if(!mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 17, 0) //Temporary hack for SQL and 1.17 support
|
if (!mcMMO.getCompatibilityManager().getMinecraftGameVersion().isAtLeast(1, 17, 0) //Temporary hack for SQL and 1.17 support
|
||||||
&& mcMMO.p.getGeneralConfig().getMySQLSSL())
|
&& mcMMO.p.getGeneralConfig().getMySQLSSL())
|
||||||
connectionString +=
|
connectionString +=
|
||||||
"?verifyServerCertificate=false"+
|
"?verifyServerCertificate=false"+
|
||||||
@ -247,7 +247,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
if(uuid != null)
|
if (uuid != null)
|
||||||
cleanupUser(uuid);
|
cleanupUser(uuid);
|
||||||
|
|
||||||
Misc.profileCleanup(playerName);
|
Misc.profileCleanup(playerName);
|
||||||
@ -400,7 +400,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
List<PlayerStat> stats = new ArrayList<>();
|
List<PlayerStat> stats = new ArrayList<>();
|
||||||
|
|
||||||
//Fix for a plugin that people are using that is throwing SQL errors
|
//Fix for a plugin that people are using that is throwing SQL errors
|
||||||
if(skill != null && SkillTools.isChildSkill(skill)) {
|
if (skill != null && SkillTools.isChildSkill(skill)) {
|
||||||
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
logger.severe("A plugin hooking into mcMMO is being naughty with our database commands, update all plugins that hook into mcMMO and contact their devs!");
|
||||||
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
throw new InvalidSkillException("A plugin hooking into mcMMO that you are using is attempting to read leaderboard skills for child skills, child skills do not have leaderboards! This is NOT an mcMMO error!");
|
||||||
}
|
}
|
||||||
@ -631,7 +631,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadPlayerFromDB(@Nullable UUID uuid, @Nullable String playerName) throws RuntimeException {
|
private PlayerProfile loadPlayerFromDB(@Nullable UUID uuid, @Nullable String playerName) throws RuntimeException {
|
||||||
if(uuid == null && playerName == null) {
|
if (uuid == null && playerName == null) {
|
||||||
throw new RuntimeException("Error looking up player, both UUID and playerName are null and one must not be.");
|
throw new RuntimeException("Error looking up player, both UUID and playerName are null and one must not be.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ public class FlatFileDataBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public @NotNull FlatFileDataContainer build() {
|
public @NotNull FlatFileDataContainer build() {
|
||||||
if(dataFlags.contains(FlatFileDataFlag.BAD_VALUES)) {
|
if (dataFlags.contains(FlatFileDataFlag.BAD_VALUES)) {
|
||||||
return new BadCategorizedFlatFileData(uniqueProcessingId, dataFlags, splitStringData, badDataValues);
|
return new BadCategorizedFlatFileData(uniqueProcessingId, dataFlags, splitStringData, badDataValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,14 +10,14 @@ import static com.gmail.nossr50.database.FlatFileDatabaseManager.*;
|
|||||||
public class FlatFileDataUtil {
|
public class FlatFileDataUtil {
|
||||||
|
|
||||||
public static @Nullable String[] getPreparedSaveDataLine(@NotNull FlatFileDataContainer dataContainer) {
|
public static @Nullable String[] getPreparedSaveDataLine(@NotNull FlatFileDataContainer dataContainer) {
|
||||||
if(dataContainer.getDataFlags() == null) {
|
if (dataContainer.getDataFlags() == null) {
|
||||||
return dataContainer.getSplitData();
|
return dataContainer.getSplitData();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Data of this type is not salvageable
|
//Data of this type is not salvageable
|
||||||
//TODO: Test that we ignore the things we are supposed to ignore
|
//TODO: Test that we ignore the things we are supposed to ignore
|
||||||
//TODO: Should we even keep track of the bad data or just not even build data containers for it? Making containers for it is only really useful for debugging.. well I suppose operations are typically async so it shouldn't matter
|
//TODO: Should we even keep track of the bad data or just not even build data containers for it? Making containers for it is only really useful for debugging.. well I suppose operations are typically async so it shouldn't matter
|
||||||
if(dataContainer.getDataFlags().contains(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE)
|
if (dataContainer.getDataFlags().contains(FlatFileDataFlag.CORRUPTED_OR_UNRECOGNIZABLE)
|
||||||
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.DUPLICATE_UUID) //For now we will not try to fix any issues with UUIDs
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.DUPLICATE_UUID) //For now we will not try to fix any issues with UUIDs
|
||||||
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.BAD_UUID_DATA) //For now we will not try to fix any issues with UUIDs
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.BAD_UUID_DATA) //For now we will not try to fix any issues with UUIDs
|
||||||
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.TOO_INCOMPLETE)) {
|
|| dataContainer.getDataFlags().contains(FlatFileDataFlag.TOO_INCOMPLETE)) {
|
||||||
@ -29,7 +29,7 @@ public class FlatFileDataUtil {
|
|||||||
/*
|
/*
|
||||||
* First fix the bad data values if they exist
|
* First fix the bad data values if they exist
|
||||||
*/
|
*/
|
||||||
if(dataContainer instanceof BadCategorizedFlatFileData badData) {
|
if (dataContainer instanceof BadCategorizedFlatFileData badData) {
|
||||||
splitData = repairBadData(dataContainer.getSplitData(), badData.getBadDataIndexes());
|
splitData = repairBadData(dataContainer.getSplitData(), badData.getBadDataIndexes());
|
||||||
} else {
|
} else {
|
||||||
splitData = dataContainer.getSplitData();
|
splitData = dataContainer.getSplitData();
|
||||||
@ -42,7 +42,7 @@ public class FlatFileDataUtil {
|
|||||||
|
|
||||||
public static @NotNull String[] repairBadData(@NotNull String[] splitData, boolean[] badDataValues) {
|
public static @NotNull String[] repairBadData(@NotNull String[] splitData, boolean[] badDataValues) {
|
||||||
for(int i = 0; i < FlatFileDatabaseManager.DATA_ENTRY_COUNT; i++) {
|
for(int i = 0; i < FlatFileDatabaseManager.DATA_ENTRY_COUNT; i++) {
|
||||||
if(badDataValues[i]) {
|
if (badDataValues[i]) {
|
||||||
//This data value was marked as bad so we zero initialize it
|
//This data value was marked as bad so we zero initialize it
|
||||||
splitData[i] = getZeroInitialisedData(i, 0);
|
splitData[i] = getZeroInitialisedData(i, 0);
|
||||||
}
|
}
|
||||||
|
@ -25,56 +25,56 @@ public class LevelUpBroadcastPredicate<T extends CommandSender> implements Predi
|
|||||||
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
|
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
|
||||||
|
|
||||||
//Broadcaster should be online
|
//Broadcaster should be online
|
||||||
if(!broadcastingPlayer.isOnline()) {
|
if (!broadcastingPlayer.isOnline()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
|
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
|
||||||
|
|
||||||
if(mmoBroadcastingPlayer == null) {
|
if (mmoBroadcastingPlayer == null) {
|
||||||
//This should never be null, but just in case...
|
//This should never be null, but just in case...
|
||||||
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
|
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t instanceof Player listeningPlayer) {
|
if (t instanceof Player listeningPlayer) {
|
||||||
|
|
||||||
//Party Member Check
|
//Party Member Check
|
||||||
if(mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
|
if (mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
|
||||||
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
||||||
|
|
||||||
if(mmoListeningPlayer == null) {
|
if (mmoListeningPlayer == null) {
|
||||||
return false; //No profile so therefor no party
|
return false; //No profile so therefor no party
|
||||||
}
|
}
|
||||||
|
|
||||||
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
|
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
|
||||||
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
|
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
|
||||||
|
|
||||||
if(playerWhoLeveledParty == null || broadcastRecipientParty == null) {
|
if (playerWhoLeveledParty == null || broadcastRecipientParty == null) {
|
||||||
return false; //No party on either player when being in the same party is required
|
return false; //No party on either player when being in the same party is required
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
|
if (!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
|
||||||
return false; //Not in the same party when it is required
|
return false; //Not in the same party when it is required
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Same world check
|
//Same world check
|
||||||
if(isLevelUpBroadcastsSameWorldOnly()) {
|
if (isLevelUpBroadcastsSameWorldOnly()) {
|
||||||
if(!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
|
if (!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
|
||||||
return false; //Not in the same world when its required
|
return false; //Not in the same world when its required
|
||||||
}
|
}
|
||||||
|
|
||||||
//Distance checks
|
//Distance checks
|
||||||
if(mcMMO.p.getGeneralConfig().shouldLevelUpBroadcastsRestrictDistance()) {
|
if (mcMMO.p.getGeneralConfig().shouldLevelUpBroadcastsRestrictDistance()) {
|
||||||
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getLevelUpBroadcastRadius())) {
|
if (!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getLevelUpBroadcastRadius())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Visibility checks
|
//Visibility checks
|
||||||
if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
|
if (!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
|
||||||
return false; //Player who leveled should be invisible to this player so don't send the message
|
return false; //Player who leveled should be invisible to this player so don't send the message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,56 +25,56 @@ public class PowerLevelUpBroadcastPredicate<T extends CommandSender> implements
|
|||||||
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
|
Player broadcastingPlayer = (Player) broadcaster; //Always a player no need to check cast
|
||||||
|
|
||||||
//Broadcaster should be online
|
//Broadcaster should be online
|
||||||
if(!broadcastingPlayer.isOnline()) {
|
if (!broadcastingPlayer.isOnline()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
|
McMMOPlayer mmoBroadcastingPlayer = UserManager.getPlayer(broadcastingPlayer);
|
||||||
|
|
||||||
if(mmoBroadcastingPlayer == null) {
|
if (mmoBroadcastingPlayer == null) {
|
||||||
//This should never be null, but just in case...
|
//This should never be null, but just in case...
|
||||||
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
|
mcMMO.p.getLogger().severe("McMMOPlayer was null for broadcaster in LevelUpBroadcastPredicate when it should never be null!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t instanceof Player listeningPlayer) {
|
if (t instanceof Player listeningPlayer) {
|
||||||
|
|
||||||
//Party Member Check
|
//Party Member Check
|
||||||
if(mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
|
if (mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
|
||||||
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
McMMOPlayer mmoListeningPlayer = UserManager.getPlayer(listeningPlayer);
|
||||||
|
|
||||||
if(mmoListeningPlayer == null) {
|
if (mmoListeningPlayer == null) {
|
||||||
return false; //No profile so therefor no party
|
return false; //No profile so therefor no party
|
||||||
}
|
}
|
||||||
|
|
||||||
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
|
Party playerWhoLeveledParty = mmoBroadcastingPlayer.getParty();
|
||||||
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
|
Party broadcastRecipientParty = mmoListeningPlayer.getParty();
|
||||||
|
|
||||||
if(playerWhoLeveledParty == null || broadcastRecipientParty == null) {
|
if (playerWhoLeveledParty == null || broadcastRecipientParty == null) {
|
||||||
return false; //No party on either player when being in the same party is required
|
return false; //No party on either player when being in the same party is required
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
|
if (!playerWhoLeveledParty.equals(broadcastRecipientParty)) {
|
||||||
return false; //Not in the same party when it is required
|
return false; //Not in the same party when it is required
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Same world check
|
//Same world check
|
||||||
if(isPowerLevelUpBroadcastsSameWorldOnly()) {
|
if (isPowerLevelUpBroadcastsSameWorldOnly()) {
|
||||||
if(!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
|
if (!mmoBroadcastingPlayer.getPlayer().getWorld().equals(listeningPlayer.getWorld())) {
|
||||||
return false; //Not in the same world when its required
|
return false; //Not in the same world when its required
|
||||||
}
|
}
|
||||||
|
|
||||||
//Distance checks
|
//Distance checks
|
||||||
if(mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcastsRestrictDistance()) {
|
if (mcMMO.p.getGeneralConfig().shouldPowerLevelUpBroadcastsRestrictDistance()) {
|
||||||
if(!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getPowerLevelUpBroadcastRadius())) {
|
if (!Misc.isNear(mmoBroadcastingPlayer.getPlayer().getLocation(), listeningPlayer.getLocation(), mcMMO.p.getGeneralConfig().getPowerLevelUpBroadcastRadius())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Visibility checks
|
//Visibility checks
|
||||||
if(!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
|
if (!listeningPlayer.canSee(mmoBroadcastingPlayer.getPlayer()) && listeningPlayer != mmoBroadcastingPlayer.getPlayer()) {
|
||||||
return false; //Player who leveled should be invisible to this player so don't send the message
|
return false; //Player who leveled should be invisible to this player so don't send the message
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class Party {
|
|||||||
|
|
||||||
for(Player p : onlineMembers)
|
for(Player p : onlineMembers)
|
||||||
{
|
{
|
||||||
if(player.canSee(p))
|
if (player.canSee(p))
|
||||||
visibleMembers.add(p);
|
visibleMembers.add(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ public class Party {
|
|||||||
for(UUID playerUUID : members.keySet()) {
|
for(UUID playerUUID : members.keySet()) {
|
||||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
|
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerUUID);
|
||||||
|
|
||||||
if(offlinePlayer.isOnline() && player.canSee((Player) offlinePlayer)) {
|
if (offlinePlayer.isOnline() && player.canSee((Player) offlinePlayer)) {
|
||||||
ChatColor onlineColor = leader.getUniqueId().equals(playerUUID) ? ChatColor.GOLD : ChatColor.GREEN;
|
ChatColor onlineColor = leader.getUniqueId().equals(playerUUID) ? ChatColor.GOLD : ChatColor.GREEN;
|
||||||
coloredNames.add(onlineColor + offlinePlayer.getName());
|
coloredNames.add(onlineColor + offlinePlayer.getName());
|
||||||
} else {
|
} else {
|
||||||
@ -361,7 +361,7 @@ public class Party {
|
|||||||
|
|
||||||
private void buildChatMessage(@NotNull StringBuilder stringBuilder, String @NotNull [] names) {
|
private void buildChatMessage(@NotNull StringBuilder stringBuilder, String @NotNull [] names) {
|
||||||
for(int i = 0; i < names.length; i++) {
|
for(int i = 0; i < names.length; i++) {
|
||||||
if(i + 1 >= names.length) {
|
if (i + 1 >= names.length) {
|
||||||
stringBuilder
|
stringBuilder
|
||||||
.append(names[i]);
|
.append(names[i]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -157,7 +157,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
this.chatChannel = ChatChannel.NONE;
|
this.chatChannel = ChatChannel.NONE;
|
||||||
|
|
||||||
if(ChatConfig.getInstance().isSpyingAutomatic() && Permissions.adminChatSpy(getPlayer())) {
|
if (ChatConfig.getInstance().isSpyingAutomatic() && Permissions.adminChatSpy(getPlayer())) {
|
||||||
chatSpy = true;
|
chatSpy = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,20 +253,20 @@ public class McMMOPlayer implements Identified {
|
|||||||
public void processPostXpEvent(PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource)
|
public void processPostXpEvent(PrimarySkillType primarySkillType, Plugin plugin, XPGainSource xpGainSource)
|
||||||
{
|
{
|
||||||
//Check if they've reached the power level cap just now
|
//Check if they've reached the power level cap just now
|
||||||
if(hasReachedPowerLevelCap()) {
|
if (hasReachedPowerLevelCap()) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
|
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.PowerLevel", String.valueOf(mcMMO.p.getGeneralConfig().getPowerLevelCap()));
|
||||||
} else if(hasReachedLevelCap(primarySkillType)) {
|
} else if (hasReachedLevelCap(primarySkillType)) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill",
|
NotificationManager.sendPlayerInformationChatOnly(player, "LevelCap.Skill",
|
||||||
String.valueOf(mcMMO.p.getSkillTools().getLevelCap(primarySkillType)),
|
String.valueOf(mcMMO.p.getSkillTools().getLevelCap(primarySkillType)),
|
||||||
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
|
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Updates from Party sources
|
//Updates from Party sources
|
||||||
if(xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
|
if (xpGainSource == XPGainSource.PARTY_MEMBERS && !ExperienceConfig.getInstance().isPartyExperienceBarsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Updates from passive sources (Alchemy, Smelting, etc...)
|
//Updates from passive sources (Alchemy, Smelting, etc...)
|
||||||
if(xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
|
if (xpGainSource == XPGainSource.PASSIVE && !ExperienceConfig.getInstance().isPassiveGainsExperienceBarsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateXPBar(primarySkillType, plugin);
|
updateXPBar(primarySkillType, plugin);
|
||||||
@ -285,7 +285,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType)
|
public double getProgressInCurrentSkillLevel(PrimarySkillType primarySkillType)
|
||||||
{
|
{
|
||||||
if(SkillTools.isChildSkill(primarySkillType)) {
|
if (SkillTools.isChildSkill(primarySkillType)) {
|
||||||
return 1.0D;
|
return 1.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,7 +602,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean hasReachedLevelCap(PrimarySkillType primarySkillType) {
|
public boolean hasReachedLevelCap(PrimarySkillType primarySkillType) {
|
||||||
if(hasReachedPowerLevelCap())
|
if (hasReachedPowerLevelCap())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return getSkillLevel(primarySkillType) >= mcMMO.p.getSkillTools().getLevelCap(primarySkillType);
|
return getSkillLevel(primarySkillType) >= mcMMO.p.getSkillTools().getLevelCap(primarySkillType);
|
||||||
@ -624,7 +624,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @param xp Experience amount to process
|
* @param xp Experience amount to process
|
||||||
*/
|
*/
|
||||||
public void beginXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
public void beginXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||||
if(xp <= 0) {
|
if (xp <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,7 +656,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @param xp Experience amount to process
|
* @param xp Experience amount to process
|
||||||
*/
|
*/
|
||||||
public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
public void beginUnsharedXpGain(PrimarySkillType skill, float xp, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||||
if(player.getGameMode() == GameMode.CREATIVE)
|
if (player.getGameMode() == GameMode.CREATIVE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason, xpGainSource);
|
applyXpGain(skill, modifyXpGain(skill, xp), xpGainReason, xpGainSource);
|
||||||
@ -709,7 +709,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* @param primarySkillType The skill to check
|
* @param primarySkillType The skill to check
|
||||||
*/
|
*/
|
||||||
private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
private void checkXp(PrimarySkillType primarySkillType, XPGainReason xpGainReason, XPGainSource xpGainSource) {
|
||||||
if(hasReachedLevelCap(primarySkillType))
|
if (hasReachedLevelCap(primarySkillType))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) {
|
if (getSkillXpLevelRaw(primarySkillType) < getXpToLevel(primarySkillType)) {
|
||||||
@ -906,7 +906,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
//TODO: This is hacky and temporary solution until skills are move to the new system
|
//TODO: This is hacky and temporary solution until skills are move to the new system
|
||||||
//Potential problems with this include skills with two super abilities (ie mining)
|
//Potential problems with this include skills with two super abilities (ie mining)
|
||||||
if(!RankUtils.hasUnlockedSubskill(player, subSkillType))
|
if (!RankUtils.hasUnlockedSubskill(player, subSkillType))
|
||||||
{
|
{
|
||||||
int diff = RankUtils.getSuperAbilityUnlockRequirement(superAbilityType) - getSkillLevel(primarySkillType);
|
int diff = RankUtils.getSuperAbilityUnlockRequirement(superAbilityType) - getSkillLevel(primarySkillType);
|
||||||
|
|
||||||
@ -941,7 +941,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
int ticks;
|
int ticks;
|
||||||
|
|
||||||
//Ability cap of 0 or below means no cap
|
//Ability cap of 0 or below means no cap
|
||||||
if(abilityLengthCap > 0)
|
if (abilityLengthCap > 0)
|
||||||
{
|
{
|
||||||
ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(primarySkillType)) / abilityLengthVar), superAbilityType.getMaxLength());
|
ticks = PerksUtils.handleActivationPerks(player, 2 + (Math.min(abilityLengthCap, getSkillLevel(primarySkillType)) / abilityLengthVar), superAbilityType.getMaxLength());
|
||||||
} else {
|
} else {
|
||||||
@ -1024,7 +1024,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
* IF THE TOOL IS AN AXE
|
* IF THE TOOL IS AN AXE
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(tool == ToolType.AXE) {
|
if (tool == ToolType.AXE) {
|
||||||
processAxeToolMessages();
|
processAxeToolMessages();
|
||||||
} else {
|
} else {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
|
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, tool.getRaiseTool());
|
||||||
@ -1045,20 +1045,20 @@ public class McMMOPlayer implements Identified {
|
|||||||
/*
|
/*
|
||||||
* IF BOTH TREE FELLER & SKULL SPLITTER ARE ON CD
|
* IF BOTH TREE FELLER & SKULL SPLITTER ARE ON CD
|
||||||
*/
|
*/
|
||||||
if(isAbilityOnCooldown(SuperAbilityType.TREE_FELLER) && isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
|
if (isAbilityOnCooldown(SuperAbilityType.TREE_FELLER) && isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
|
||||||
tooTiredMultiple(PrimarySkillType.WOODCUTTING, SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER, SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
|
tooTiredMultiple(PrimarySkillType.WOODCUTTING, SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER, SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
|
||||||
/*
|
/*
|
||||||
* IF TREE FELLER IS ON CD
|
* IF TREE FELLER IS ON CD
|
||||||
* AND PLAYER IS LOOKING AT TREE
|
* AND PLAYER IS LOOKING AT TREE
|
||||||
*/
|
*/
|
||||||
} else if(isAbilityOnCooldown(SuperAbilityType.TREE_FELLER)
|
} else if (isAbilityOnCooldown(SuperAbilityType.TREE_FELLER)
|
||||||
&& BlockUtils.isPartOfTree(rayCast)) {
|
&& BlockUtils.isPartOfTree(rayCast)) {
|
||||||
raiseToolWithCooldowns(SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER);
|
raiseToolWithCooldowns(SubSkillType.WOODCUTTING_TREE_FELLER, SuperAbilityType.TREE_FELLER);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IF SKULL SPLITTER IS ON CD
|
* IF SKULL SPLITTER IS ON CD
|
||||||
*/
|
*/
|
||||||
} else if(isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
|
} else if (isAbilityOnCooldown(SuperAbilityType.SKULL_SPLITTER)) {
|
||||||
raiseToolWithCooldowns(SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
|
raiseToolWithCooldowns(SubSkillType.AXES_SKULL_SPLITTER, SuperAbilityType.SKULL_SPLITTER);
|
||||||
} else {
|
} else {
|
||||||
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, ToolType.AXE.getRaiseTool());
|
NotificationManager.sendPlayerInformation(player, NotificationType.TOOL, ToolType.AXE.getRaiseTool());
|
||||||
@ -1156,7 +1156,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
*/
|
*/
|
||||||
public void logout(boolean syncSave) {
|
public void logout(boolean syncSave) {
|
||||||
Player thisPlayer = getPlayer();
|
Player thisPlayer = getPlayer();
|
||||||
if(getPlayer().hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
if (getPlayer().hasMetadata(MetadataConstants.METADATA_KEY_RUPTURE)) {
|
||||||
RuptureTaskMeta ruptureTaskMeta = (RuptureTaskMeta) getPlayer().getMetadata(MetadataConstants.METADATA_KEY_RUPTURE).get(0);
|
RuptureTaskMeta ruptureTaskMeta = (RuptureTaskMeta) getPlayer().getMetadata(MetadataConstants.METADATA_KEY_RUPTURE).get(0);
|
||||||
|
|
||||||
//Punish a logout
|
//Punish a logout
|
||||||
@ -1175,7 +1175,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
UserManager.remove(thisPlayer);
|
UserManager.remove(thisPlayer);
|
||||||
|
|
||||||
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.teardownPlayer(thisPlayer);
|
ScoreboardManager.teardownPlayer(thisPlayer);
|
||||||
|
|
||||||
if (inParty()) {
|
if (inParty()) {
|
||||||
|
@ -100,7 +100,7 @@ public class PlayerProfile {
|
|||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
|
||||||
if(lastLogin != null)
|
if (lastLogin != null)
|
||||||
this.lastLogin = lastLogin;
|
this.lastLogin = lastLogin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,17 +130,17 @@ public class PlayerProfile {
|
|||||||
if (changed) {
|
if (changed) {
|
||||||
mcMMO.p.getLogger().severe("PlayerProfile saving failed for player: " + playerName + " " + uuid);
|
mcMMO.p.getLogger().severe("PlayerProfile saving failed for player: " + playerName + " " + uuid);
|
||||||
|
|
||||||
if(saveAttempts > 0) {
|
if (saveAttempts > 0) {
|
||||||
mcMMO.p.getLogger().severe("Attempted to save profile for player "+getPlayerName()
|
mcMMO.p.getLogger().severe("Attempted to save profile for player "+getPlayerName()
|
||||||
+ " resulted in failure. "+saveAttempts+" have been made so far.");
|
+ " resulted in failure. "+saveAttempts+" have been made so far.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(saveAttempts < 10)
|
if (saveAttempts < 10)
|
||||||
{
|
{
|
||||||
saveAttempts++;
|
saveAttempts++;
|
||||||
|
|
||||||
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
|
//Back out of async saving if we detect a server shutdown, this is not always going to be caught
|
||||||
if(mcMMO.isServerShutdownExecuted() || useSync)
|
if (mcMMO.isServerShutdownExecuted() || useSync)
|
||||||
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
|
mcMMO.p.getFoliaLib().getImpl().runNextTick(new PlayerProfileSaveTask(this, true));
|
||||||
else
|
else
|
||||||
scheduleAsyncSave();
|
scheduleAsyncSave();
|
||||||
@ -271,7 +271,7 @@ public class PlayerProfile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getSkillXpLevel(PrimarySkillType skill) {
|
public int getSkillXpLevel(PrimarySkillType skill) {
|
||||||
if(SkillTools.isChildSkill(skill)) {
|
if (SkillTools.isChildSkill(skill)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +339,7 @@ public class PlayerProfile {
|
|||||||
markProfileDirty();
|
markProfileDirty();
|
||||||
|
|
||||||
//Don't allow levels to be negative
|
//Don't allow levels to be negative
|
||||||
if(level < 0)
|
if (level < 0)
|
||||||
level = 0;
|
level = 0;
|
||||||
|
|
||||||
skills.put(skill, level);
|
skills.put(skill, level);
|
||||||
@ -424,7 +424,7 @@ public class PlayerProfile {
|
|||||||
* @return the total amount of Xp until next level
|
* @return the total amount of Xp until next level
|
||||||
*/
|
*/
|
||||||
public int getXpToLevel(PrimarySkillType primarySkillType) {
|
public int getXpToLevel(PrimarySkillType primarySkillType) {
|
||||||
if(SkillTools.isChildSkill(primarySkillType)) {
|
if (SkillTools.isChildSkill(primarySkillType)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public enum MaterialType {
|
|||||||
return Material.DIAMOND;
|
return Material.DIAMOND;
|
||||||
|
|
||||||
case NETHERITE:
|
case NETHERITE:
|
||||||
if(Material.getMaterial("NETHERITE_SCRAP") != null)
|
if (Material.getMaterial("NETHERITE_SCRAP") != null)
|
||||||
return Material.getMaterial("NETHERITE_SCRAP");
|
return Material.getMaterial("NETHERITE_SCRAP");
|
||||||
else
|
else
|
||||||
return Material.DIAMOND;
|
return Material.DIAMOND;
|
||||||
|
@ -201,7 +201,7 @@ public enum SubSkillType {
|
|||||||
* Split the string up so we can capitalize each part
|
* Split the string up so we can capitalize each part
|
||||||
*/
|
*/
|
||||||
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
String subskillNameWithoutPrefix = subSkillName.substring(subStringIndex);
|
||||||
if(subskillNameWithoutPrefix.contains("_"))
|
if (subskillNameWithoutPrefix.contains("_"))
|
||||||
{
|
{
|
||||||
String[] splitStrings = subskillNameWithoutPrefix.split("_");
|
String[] splitStrings = subskillNameWithoutPrefix.split("_");
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public enum PotionStage {
|
|||||||
stage++;
|
stage++;
|
||||||
} else if (!potionMeta.getCustomEffects().isEmpty()) {
|
} else if (!potionMeta.getCustomEffects().isEmpty()) {
|
||||||
for (PotionEffect effect : potionMeta.getCustomEffects()){
|
for (PotionEffect effect : potionMeta.getCustomEffects()){
|
||||||
if(effect.getAmplifier() > 0){
|
if (effect.getAmplifier() > 0){
|
||||||
stage++;
|
stage++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
EntityDamageEvent entityDamageEvent = (EntityDamageEvent) event;
|
EntityDamageEvent entityDamageEvent = (EntityDamageEvent) event;
|
||||||
|
|
||||||
//Make sure a real player was damaged in this event
|
//Make sure a real player was damaged in this event
|
||||||
if(!EventUtils.isRealPlayerDamaged(entityDamageEvent))
|
if (!EventUtils.isRealPlayerDamaged(entityDamageEvent))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (entityDamageEvent.getCause() == EntityDamageEvent.DamageCause.FALL) {//Grab the player
|
if (entityDamageEvent.getCause() == EntityDamageEvent.DamageCause.FALL) {//Grab the player
|
||||||
@ -81,7 +81,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
entityDamageEvent.setCancelled(true);
|
entityDamageEvent.setCancelled(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if(mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(mmoPlayer.getPlayer(), PrimarySkillType.ACROBATICS)) {
|
} else if (mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(mmoPlayer.getPlayer(), PrimarySkillType.ACROBATICS)) {
|
||||||
//Give XP Anyways
|
//Give XP Anyways
|
||||||
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, ((EntityDamageEvent) event).getFinalDamage(), false), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, ((EntityDamageEvent) event).getFinalDamage(), false), XPGainReason.PVE);
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
//Advanced
|
//Advanced
|
||||||
|
|
||||||
//Lucky Notice
|
//Lucky Notice
|
||||||
if(isLucky)
|
if (isLucky)
|
||||||
{
|
{
|
||||||
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.JWrapper.Perks.Header")));
|
componentBuilder.append(Component.text(LocaleLoader.getString("JSON.JWrapper.Perks.Header")));
|
||||||
componentBuilder.append(Component.newline());
|
componentBuilder.append(Component.newline());
|
||||||
@ -213,7 +213,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
//mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
//mmoPlayer.getPlayer().sendMessage(LocaleLoader.getString("Acrobatics.Roll.Text"));
|
||||||
|
|
||||||
//if (!SkillUtils.cooldownExpired((long) mcMMOmmoPlayer.getPlayer().getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
//if (!SkillUtils.cooldownExpired((long) mcMMOmmoPlayer.getPlayer().getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
||||||
if(!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
||||||
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, true), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, true), XPGainReason.PVE);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
}
|
}
|
||||||
else if (!isFatal(mmoPlayer, damage)) {
|
else if (!isFatal(mmoPlayer, damage)) {
|
||||||
//if (!SkillUtils.cooldownExpired((long) mmoPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
//if (!SkillUtils.cooldownExpired((long) mmoPlayer.getTeleportATS(), Config.getInstance().getXPAfterTeleportCooldown())) {
|
||||||
if(!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
||||||
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
@ -252,14 +252,14 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
{
|
{
|
||||||
NotificationManager.sendPlayerInformation(mmoPlayer.getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Ability.Proc");
|
NotificationManager.sendPlayerInformation(mmoPlayer.getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Acrobatics.Ability.Proc");
|
||||||
SoundManager.sendCategorizedSound(mmoPlayer.getPlayer(), mmoPlayer.getPlayer().getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS,0.5F);
|
SoundManager.sendCategorizedSound(mmoPlayer.getPlayer(), mmoPlayer.getPlayer().getLocation(), SoundType.ROLL_ACTIVATED, SoundCategory.PLAYERS,0.5F);
|
||||||
if(!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
||||||
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, true), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, true), XPGainReason.PVE);
|
||||||
|
|
||||||
addFallLocation(mmoPlayer);
|
addFallLocation(mmoPlayer);
|
||||||
return modifiedDamage;
|
return modifiedDamage;
|
||||||
}
|
}
|
||||||
else if (!isFatal(mmoPlayer, damage)) {
|
else if (!isFatal(mmoPlayer, damage)) {
|
||||||
if(!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
if (!isExploiting(mmoPlayer) && mmoPlayer.getAcrobaticsManager().canGainRollXP())
|
||||||
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
|
SkillUtils.applyXpGain(mmoPlayer, getPrimarySkill(), calculateRollXP(mmoPlayer, damage, false), XPGainReason.PVE);
|
||||||
|
|
||||||
addFallLocation(mmoPlayer);
|
addFallLocation(mmoPlayer);
|
||||||
@ -286,15 +286,15 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ItemUtils.hasItemInEitherHand(mmoPlayer.getPlayer(), Material.ENDER_PEARL) || mmoPlayer.getPlayer().isInsideVehicle()) {
|
if (ItemUtils.hasItemInEitherHand(mmoPlayer.getPlayer(), Material.ENDER_PEARL) || mmoPlayer.getPlayer().isInsideVehicle()) {
|
||||||
if(mmoPlayer.isDebugMode()) {
|
if (mmoPlayer.isDebugMode()) {
|
||||||
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Ender Pearl or Inside Vehicle");
|
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Ender Pearl or Inside Vehicle");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mmoPlayer.getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(mmoPlayer)))
|
if (mmoPlayer.getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(mmoPlayer)))
|
||||||
{
|
{
|
||||||
if(mmoPlayer.isDebugMode()) {
|
if (mmoPlayer.isDebugMode()) {
|
||||||
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
|
mmoPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class TamingSummon {
|
|||||||
entityType = EntityType.HORSE;
|
entityType = EntityType.HORSE;
|
||||||
break;
|
break;
|
||||||
case CAT:
|
case CAT:
|
||||||
if(shouldSpawnCatInsteadOfOcelot()) {
|
if (shouldSpawnCatInsteadOfOcelot()) {
|
||||||
//Server is on 1.14 or above
|
//Server is on 1.14 or above
|
||||||
entityType = EntityType.CAT;
|
entityType = EntityType.CAT;
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,7 +30,7 @@ public class FishingTreasureBook extends FishingTreasure {
|
|||||||
LogUtils.debug(mcMMO.p.getLogger(), "Registering enchantments for Fishing Book...");
|
LogUtils.debug(mcMMO.p.getLogger(), "Registering enchantments for Fishing Book...");
|
||||||
|
|
||||||
for(Enchantment enchantment : Enchantment.values()) {
|
for(Enchantment enchantment : Enchantment.values()) {
|
||||||
if(isEnchantAllowed(enchantment)) {
|
if (isEnchantAllowed(enchantment)) {
|
||||||
addAllLegalEnchants(enchantment);
|
addAllLegalEnchants(enchantment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,9 +66,9 @@ public class FishingTreasureBook extends FishingTreasure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEnchantAllowed(@NotNull Enchantment enchantment) {
|
private boolean isEnchantAllowed(@NotNull Enchantment enchantment) {
|
||||||
if(whiteListedEnchantments != null && !whiteListedEnchantments.isEmpty()) {
|
if (whiteListedEnchantments != null && !whiteListedEnchantments.isEmpty()) {
|
||||||
return whiteListedEnchantments.contains(enchantment);
|
return whiteListedEnchantments.contains(enchantment);
|
||||||
} else if(blackListedEnchantments != null && !blackListedEnchantments.isEmpty()) {
|
} else if (blackListedEnchantments != null && !blackListedEnchantments.isEmpty()) {
|
||||||
return !blackListedEnchantments.contains(enchantment);
|
return !blackListedEnchantments.contains(enchantment);
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
|
@ -12,7 +12,7 @@ public enum Rarity {
|
|||||||
COMMON;
|
COMMON;
|
||||||
|
|
||||||
public static @NotNull Rarity getRarity(@NotNull String string) {
|
public static @NotNull Rarity getRarity(@NotNull String string) {
|
||||||
if(string.equalsIgnoreCase("Records")) {
|
if (string.equalsIgnoreCase("Records")) {
|
||||||
mcMMO.p.getLogger().severe("Entries in fishing treasures have Records set as rarity, however Records was renamed to Mythic. Please update your treasures to read MYTHIC instead of RECORDS for rarity, or delete the config file to regenerate a new one.");
|
mcMMO.p.getLogger().severe("Entries in fishing treasures have Records set as rarity, however Records was renamed to Mythic. Please update your treasures to read MYTHIC instead of RECORDS for rarity, or delete the config file to regenerate a new one.");
|
||||||
return Rarity.MYTHIC; //People that copy paste their configs will have Records interpretted as Mythic
|
return Rarity.MYTHIC; //People that copy paste their configs will have Records interpretted as Mythic
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public abstract class McMMOPlayerExperienceEvent extends PlayerEvent implements
|
|||||||
super(player);
|
super(player);
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
|
|
||||||
if(UserManager.getPlayer(player) != null) {
|
if (UserManager.getPlayer(player) != null) {
|
||||||
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
this.skillLevel = UserManager.getPlayer(player).getSkillLevel(skill);
|
||||||
} else {
|
} else {
|
||||||
this.skillLevel = 0;
|
this.skillLevel = 0;
|
||||||
|
@ -50,8 +50,8 @@ public class BlockListener implements Listener {
|
|||||||
public void onBlockDropItemEvent(BlockDropItemEvent event)
|
public void onBlockDropItemEvent(BlockDropItemEvent event)
|
||||||
{
|
{
|
||||||
//Make sure we clean up metadata on these blocks
|
//Make sure we clean up metadata on these blocks
|
||||||
if(event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
if(event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
|
if (event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
|
||||||
event.getBlock().removeMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, plugin);
|
event.getBlock().removeMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, plugin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ public class BlockListener implements Listener {
|
|||||||
int tileEntityTolerance = 1;
|
int tileEntityTolerance = 1;
|
||||||
|
|
||||||
// beetroot hotfix, potentially other plants may need this fix
|
// beetroot hotfix, potentially other plants may need this fix
|
||||||
if(event.getBlockState().getType() == Material.BEETROOTS)
|
if (event.getBlockState().getType() == Material.BEETROOTS)
|
||||||
tileEntityTolerance = 2;
|
tileEntityTolerance = 2;
|
||||||
|
|
||||||
//Track how many "things" are being dropped
|
//Track how many "things" are being dropped
|
||||||
@ -72,34 +72,34 @@ public class BlockListener implements Listener {
|
|||||||
uniqueMaterials.add(item.getItemStack().getType());
|
uniqueMaterials.add(item.getItemStack().getType());
|
||||||
|
|
||||||
//Count blocks as a second failsafe
|
//Count blocks as a second failsafe
|
||||||
if(item.getItemStack().getType().isBlock())
|
if (item.getItemStack().getType().isBlock())
|
||||||
blockCount++;
|
blockCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uniqueMaterials.size() > tileEntityTolerance) {
|
if (uniqueMaterials.size() > tileEntityTolerance) {
|
||||||
//Too many things are dropping, assume tile entities might be duped
|
//Too many things are dropping, assume tile entities might be duped
|
||||||
//Technically this would also prevent something like coal from being bonus dropped if you placed a TE above a coal ore when mining it but that's pretty edge case and this is a good solution for now
|
//Technically this would also prevent something like coal from being bonus dropped if you placed a TE above a coal ore when mining it but that's pretty edge case and this is a good solution for now
|
||||||
dontRewardTE = true;
|
dontRewardTE = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//If there are more than one block in the item list we can't really trust it and will back out of rewarding bonus drops
|
//If there are more than one block in the item list we can't really trust it and will back out of rewarding bonus drops
|
||||||
if(blockCount <= 1) {
|
if (blockCount <= 1) {
|
||||||
for(Item item : event.getItems())
|
for(Item item : event.getItems())
|
||||||
{
|
{
|
||||||
ItemStack is = new ItemStack(item.getItemStack());
|
ItemStack is = new ItemStack(item.getItemStack());
|
||||||
|
|
||||||
if(is.getAmount() <= 0)
|
if (is.getAmount() <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//TODO: Ignore this abomination its rewritten in 2.2
|
//TODO: Ignore this abomination its rewritten in 2.2
|
||||||
if(!mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
|
if (!mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.MINING, is.getType())
|
||||||
&& !mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
|
&& !mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.HERBALISM, is.getType())
|
||||||
&& !mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
|
&& !mcMMO.p.getGeneralConfig().getDoubleDropsEnabled(PrimarySkillType.WOODCUTTING, is.getType()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//If we suspect TEs might be duped only reward block
|
//If we suspect TEs might be duped only reward block
|
||||||
if(dontRewardTE) {
|
if (dontRewardTE) {
|
||||||
if(!is.getType().isBlock()) {
|
if (!is.getType().isBlock()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
|
if (event.getBlock().hasMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS))
|
||||||
event.getBlock().removeMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, plugin);
|
event.getBlock().removeMetadata(MetadataConstants.METADATA_KEY_BONUS_DROPS, plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,10 +127,10 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!ExperienceConfig.getInstance().isPistonCheatingPrevented()) {
|
if (!ExperienceConfig.getInstance().isPistonCheatingPrevented()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,10 +155,10 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
public void onBlockPistonRetract(BlockPistonRetractEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(!ExperienceConfig.getInstance().isPistonCheatingPrevented()) {
|
if (!ExperienceConfig.getInstance().isPistonCheatingPrevented()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,12 +167,12 @@ public class BlockListener implements Listener {
|
|||||||
Block movedBlock = event.getBlock().getRelative(direction);
|
Block movedBlock = event.getBlock().getRelative(direction);
|
||||||
|
|
||||||
//Spigot makes bad things happen in its API
|
//Spigot makes bad things happen in its API
|
||||||
if(BlockUtils.isWithinWorldBounds(movedBlock)) {
|
if (BlockUtils.isWithinWorldBounds(movedBlock)) {
|
||||||
BlockUtils.setUnnaturalBlock(movedBlock);
|
BlockUtils.setUnnaturalBlock(movedBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Block block : event.getBlocks()) {
|
for (Block block : event.getBlocks()) {
|
||||||
if(BlockUtils.isWithinWorldBounds(block) && BlockUtils.isWithinWorldBounds(block.getRelative(direction))) {
|
if (BlockUtils.isWithinWorldBounds(block) && BlockUtils.isWithinWorldBounds(block.getRelative(direction))) {
|
||||||
Block relativeBlock = block.getRelative(direction);
|
Block relativeBlock = block.getRelative(direction);
|
||||||
BlockUtils.setUnnaturalBlock(relativeBlock);
|
BlockUtils.setUnnaturalBlock(relativeBlock);
|
||||||
}
|
}
|
||||||
@ -189,15 +189,15 @@ public class BlockListener implements Listener {
|
|||||||
public void onEntityBlockFormEvent(EntityBlockFormEvent event)
|
public void onEntityBlockFormEvent(EntityBlockFormEvent event)
|
||||||
{
|
{
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockState blockState = event.getNewState();
|
BlockState blockState = event.getNewState();
|
||||||
|
|
||||||
if(ExperienceConfig.getInstance().isSnowExploitPrevented() && BlockUtils.shouldBeWatched(blockState)) {
|
if (ExperienceConfig.getInstance().isSnowExploitPrevented() && BlockUtils.shouldBeWatched(blockState)) {
|
||||||
Block block = blockState.getBlock();
|
Block block = blockState.getBlock();
|
||||||
|
|
||||||
if(BlockUtils.isWithinWorldBounds(block)) {
|
if (BlockUtils.isWithinWorldBounds(block)) {
|
||||||
BlockUtils.setUnnaturalBlock(block);
|
BlockUtils.setUnnaturalBlock(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,15 +212,15 @@ public class BlockListener implements Listener {
|
|||||||
World world = event.getBlock().getWorld();
|
World world = event.getBlock().getWorld();
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(world))
|
if (WorldBlacklist.isWorldBlacklisted(world))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(ExperienceConfig.getInstance().preventStoneLavaFarming()) {
|
if (ExperienceConfig.getInstance().preventStoneLavaFarming()) {
|
||||||
BlockState newState = event.getNewState();
|
BlockState newState = event.getNewState();
|
||||||
|
|
||||||
if(newState.getType() != Material.OBSIDIAN && ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, newState.getBlockData())) {
|
if (newState.getType() != Material.OBSIDIAN && ExperienceConfig.getInstance().doesBlockGiveSkillXP(PrimarySkillType.MINING, newState.getBlockData())) {
|
||||||
Block block = newState.getBlock();
|
Block block = newState.getBlock();
|
||||||
if(BlockUtils.isWithinWorldBounds(block)) {
|
if (BlockUtils.isWithinWorldBounds(block)) {
|
||||||
BlockUtils.setUnnaturalBlock(block);
|
BlockUtils.setUnnaturalBlock(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,11 +241,11 @@ public class BlockListener implements Listener {
|
|||||||
// if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
|
// if (!Tag.LOGS.isTagged(event.getBlockReplacedState().getType()) || !Tag.LOGS.isTagged(event.getBlockPlaced().getType()))
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(block.getWorld())) {
|
if (WorldBlacklist.isWorldBlacklisted(block.getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(BlockUtils.isWithinWorldBounds(block)) {
|
if (BlockUtils.isWithinWorldBounds(block)) {
|
||||||
//NOTE: BlockMultiPlace has its own logic so don't handle anything that would overlap
|
//NOTE: BlockMultiPlace has its own logic so don't handle anything that would overlap
|
||||||
if (!(event instanceof BlockMultiPlaceEvent)) {
|
if (!(event instanceof BlockMultiPlaceEvent)) {
|
||||||
BlockUtils.setUnnaturalBlock(block);
|
BlockUtils.setUnnaturalBlock(block);
|
||||||
@ -261,7 +261,7 @@ public class BlockListener implements Listener {
|
|||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (blockState.getType() == Repair.anvilMaterial && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.REPAIR)) {
|
if (blockState.getType() == Repair.anvilMaterial && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.REPAIR)) {
|
||||||
@ -284,10 +284,10 @@ public class BlockListener implements Listener {
|
|||||||
Block block = blockState.getBlock();
|
Block block = blockState.getBlock();
|
||||||
|
|
||||||
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
/* Check if the blocks placed should be monitored so they do not give out XP in the future */
|
||||||
if(BlockUtils.isWithinWorldBounds(block)) {
|
if (BlockUtils.isWithinWorldBounds(block)) {
|
||||||
//Updated: 10/5/2021
|
//Updated: 10/5/2021
|
||||||
//Note: For some reason Azalea trees trigger this event but no other tree does (as of 10/5/2021) but if this changes in the future we may need to update this
|
//Note: For some reason Azalea trees trigger this event but no other tree does (as of 10/5/2021) but if this changes in the future we may need to update this
|
||||||
if(BlockUtils.isPartOfTree(event.getBlockPlaced())) {
|
if (BlockUtils.isPartOfTree(event.getBlockPlaced())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -305,11 +305,11 @@ public class BlockListener implements Listener {
|
|||||||
World world = block.getWorld();
|
World world = block.getWorld();
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(world))
|
if (WorldBlacklist.isWorldBlacklisted(world))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Minecraft is dumb, the events still throw when a plant "grows" higher than the max block height. Even though no new block is created
|
// Minecraft is dumb, the events still throw when a plant "grows" higher than the max block height. Even though no new block is created
|
||||||
if(BlockUtils.isWithinWorldBounds(block)) {
|
if (BlockUtils.isWithinWorldBounds(block)) {
|
||||||
mcMMO.getPlaceStore().setFalse(block);
|
mcMMO.getPlaceStore().setFalse(block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,15 +328,15 @@ public class BlockListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WorldBlacklist.isWorldBlacklisted(block.getWorld())) {
|
if (WorldBlacklist.isWorldBlacklisted(block.getWorld())) {
|
||||||
BlockUtils.cleanupBlockMetadata(block);
|
BlockUtils.cleanupBlockMetadata(block);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer())) {
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer())) {
|
||||||
BlockUtils.cleanupBlockMetadata(block);
|
BlockUtils.cleanupBlockMetadata(block);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -364,7 +364,7 @@ public class BlockListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Check if profile is loaded
|
//Check if profile is loaded
|
||||||
if(mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
/* Remove metadata from placed watched blocks */
|
/* Remove metadata from placed watched blocks */
|
||||||
|
|
||||||
BlockUtils.cleanupBlockMetadata(block);
|
BlockUtils.cleanupBlockMetadata(block);
|
||||||
@ -442,17 +442,17 @@ public class BlockListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockBreakHigher(BlockBreakEvent event) {
|
public void onBlockBreakHigher(BlockBreakEvent event) {
|
||||||
if(event instanceof FakeEvent)
|
if (event instanceof FakeEvent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ public class BlockListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -509,13 +509,13 @@ public class BlockListener implements Listener {
|
|||||||
BlockState blockState = event.getBlock().getState();
|
BlockState blockState = event.getBlock().getState();
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -529,7 +529,7 @@ public class BlockListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -560,11 +560,11 @@ public class BlockListener implements Listener {
|
|||||||
|| BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
|| BlockUtils.affectedByBlockCracker(blockState) && Permissions.berserk(player))) {
|
||||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.UNARMED);
|
||||||
|
|
||||||
if(mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK)) {
|
if (mcMMOPlayer.getAbilityMode(SuperAbilityType.BERSERK)) {
|
||||||
if (SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(blockState.getBlock(), player)) {
|
if (SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(blockState.getBlock(), player)) {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
|
|
||||||
if(blockState.getType().getKey().getKey().contains("glass")) {
|
if (blockState.getType().getKey().getKey().contains("glass")) {
|
||||||
SoundManager.worldSendSound(player.getWorld(), blockState.getLocation(), SoundType.GLASS);
|
SoundManager.worldSendSound(player.getWorld(), blockState.getLocation(), SoundType.GLASS);
|
||||||
} else {
|
} else {
|
||||||
SoundManager.sendSound(player, blockState.getLocation(), SoundType.POP);
|
SoundManager.sendSound(player, blockState.getLocation(), SoundType.POP);
|
||||||
@ -592,13 +592,13 @@ public class BlockListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onBlockDamageHigher(BlockDamageEvent event) {
|
public void onBlockDamageHigher(BlockDamageEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +615,7 @@ public class BlockListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ public class BlockListener implements Listener {
|
|||||||
else if (!event.getInstaBreak() && SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
else if (!event.getInstaBreak() && SuperAbilityType.BERSERK.blockCheck(blockState) && EventUtils.simulateBlockBreak(block, player)) {
|
||||||
event.setInstaBreak(true);
|
event.setInstaBreak(true);
|
||||||
|
|
||||||
if(blockState.getType().getKey().getKey().contains("glass")) {
|
if (blockState.getType().getKey().getKey().contains("glass")) {
|
||||||
SoundManager.worldSendSound(player.getWorld(), block.getLocation(), SoundType.GLASS);
|
SoundManager.worldSendSound(player.getWorld(), block.getLocation(), SoundType.GLASS);
|
||||||
} else {
|
} else {
|
||||||
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
SoundManager.sendSound(player, block.getLocation(), SoundType.POP);
|
||||||
@ -662,7 +662,7 @@ public class BlockListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -680,14 +680,14 @@ public class BlockListener implements Listener {
|
|||||||
//TODO: Convert into locale strings
|
//TODO: Convert into locale strings
|
||||||
private void debugStickDump(Player player, BlockState blockState) {
|
private void debugStickDump(Player player, BlockState blockState) {
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UserManager.getPlayer(player).isDebugMode())
|
if (UserManager.getPlayer(player).isDebugMode())
|
||||||
{
|
{
|
||||||
if(mcMMO.getPlaceStore().isTrue(blockState))
|
if (mcMMO.getPlaceStore().isTrue(blockState))
|
||||||
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
|
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -695,24 +695,24 @@ public class BlockListener implements Listener {
|
|||||||
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
UserManager.getPlayer(player).getExcavationManager().printExcavationDebug(player, blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(WorldGuardManager.getInstance().hasMainFlag(player))
|
if (WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
|
player.sendMessage("[mcMMO DEBUG] World Guard main flag is permitted for this player in this region");
|
||||||
else
|
else
|
||||||
player.sendMessage("[mcMMO DEBUG] World Guard main flag is DENIED for this player in this region");
|
player.sendMessage("[mcMMO DEBUG] World Guard main flag is DENIED for this player in this region");
|
||||||
|
|
||||||
if(WorldGuardManager.getInstance().hasXPFlag(player))
|
if (WorldGuardManager.getInstance().hasXPFlag(player))
|
||||||
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is permitted for this player in this region");
|
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is permitted for this player in this region");
|
||||||
else
|
else
|
||||||
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is not permitted for this player in this region");
|
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is not permitted for this player in this region");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blockState instanceof Furnace || blockState instanceof BrewingStand) {
|
if (blockState instanceof Furnace || blockState instanceof BrewingStand) {
|
||||||
if(ContainerMetadataUtils.isContainerOwned(blockState)) {
|
if (ContainerMetadataUtils.isContainerOwned(blockState)) {
|
||||||
player.sendMessage("[mcMMO DEBUG] This container has a registered owner");
|
player.sendMessage("[mcMMO DEBUG] This container has a registered owner");
|
||||||
final OfflinePlayer furnacePlayer = ContainerMetadataUtils.getContainerOwner(blockState);
|
final OfflinePlayer furnacePlayer = ContainerMetadataUtils.getContainerOwner(blockState);
|
||||||
if(furnacePlayer != null) {
|
if (furnacePlayer != null) {
|
||||||
player.sendMessage("[mcMMO DEBUG] This container is owned by player "+furnacePlayer.getName());
|
player.sendMessage("[mcMMO DEBUG] This container is owned by player "+furnacePlayer.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -720,7 +720,7 @@ public class BlockListener implements Listener {
|
|||||||
player.sendMessage("[mcMMO DEBUG] This container does not have a registered owner");
|
player.sendMessage("[mcMMO DEBUG] This container does not have a registered owner");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ExperienceConfig.getInstance().isExperienceBarsEnabled())
|
if (ExperienceConfig.getInstance().isExperienceBarsEnabled())
|
||||||
player.sendMessage("[mcMMO DEBUG] XP bars are enabled, however you should check per-skill settings to make sure those are enabled.");
|
player.sendMessage("[mcMMO DEBUG] XP bars are enabled, however you should check per-skill settings to make sure those are enabled.");
|
||||||
|
|
||||||
player.sendMessage(ChatColor.RED+"You can turn this debug info off by typing "+ChatColor.GOLD+"/mmodebug");
|
player.sendMessage(ChatColor.RED+"You can turn this debug info off by typing "+ChatColor.GOLD+"/mmodebug");
|
||||||
|
@ -63,12 +63,12 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onEntityTransform(EntityTransformEvent event) {
|
public void onEntityTransform(EntityTransformEvent event) {
|
||||||
if(event.getEntity() instanceof LivingEntity livingEntity) {
|
if (event.getEntity() instanceof LivingEntity livingEntity) {
|
||||||
|
|
||||||
//Transfer metadata keys from mob-spawned mobs to new mobs
|
//Transfer metadata keys from mob-spawned mobs to new mobs
|
||||||
if(hasMobFlags(livingEntity)) {
|
if (hasMobFlags(livingEntity)) {
|
||||||
for(Entity entity : event.getTransformedEntities()) {
|
for(Entity entity : event.getTransformedEntities()) {
|
||||||
if(entity instanceof LivingEntity transformedEntity) {
|
if (entity instanceof LivingEntity transformedEntity) {
|
||||||
addMobFlags(livingEntity, transformedEntity);
|
addMobFlags(livingEntity, transformedEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,21 +78,21 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityTargetEntity(EntityTargetLivingEntityEvent event) {
|
public void onEntityTargetEntity(EntityTargetLivingEntityEvent event) {
|
||||||
if(!ExperienceConfig.getInstance().isEndermanEndermiteFarmingPrevented())
|
if (!ExperienceConfig.getInstance().isEndermanEndermiteFarmingPrevented())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//It's rare but targets can be null sometimes
|
//It's rare but targets can be null sometimes
|
||||||
if(event.getTarget() == null)
|
if (event.getTarget() == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Prevent entities from giving XP if they target endermite
|
//Prevent entities from giving XP if they target endermite
|
||||||
if(event.getTarget() instanceof Endermite)
|
if (event.getTarget() instanceof Endermite)
|
||||||
{
|
{
|
||||||
if(event.getEntity() instanceof Enderman enderman) {
|
if (event.getEntity() instanceof Enderman enderman) {
|
||||||
|
|
||||||
if(!hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
|
if (!hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
|
||||||
flagMetadata(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman);
|
flagMetadata(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,10 +102,10 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
|
||||||
public void onEntityShootBow(EntityShootBowEvent event) {
|
public void onEntityShootBow(EntityShootBowEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event.getEntity() instanceof Player player)
|
if (event.getEntity() instanceof Player player)
|
||||||
{
|
{
|
||||||
Entity projectile = event.getProjectile();
|
Entity projectile = event.getProjectile();
|
||||||
|
|
||||||
@ -135,35 +135,35 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
public void onProjectileLaunch(ProjectileLaunchEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event.getEntity().getShooter() instanceof Player player)
|
if (event.getEntity().getShooter() instanceof Player player)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
if (WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getEntity() instanceof Arrow arrow) {
|
if (event.getEntity() instanceof Arrow arrow) {
|
||||||
// Delayed metadata cleanup in case other cleanup hooks fail
|
// Delayed metadata cleanup in case other cleanup hooks fail
|
||||||
CombatUtils.delayArrowMetaCleanup(arrow);
|
CombatUtils.delayArrowMetaCleanup(arrow);
|
||||||
|
|
||||||
// If fired from an item with multi-shot, we need to track
|
// If fired from an item with multi-shot, we need to track
|
||||||
if(ItemUtils.doesPlayerHaveEnchantmentInHands(player, "multishot")) {
|
if (ItemUtils.doesPlayerHaveEnchantmentInHands(player, "multishot")) {
|
||||||
arrow.setMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW, MetadataConstants.MCMMO_METADATA_VALUE);
|
arrow.setMetadata(MetadataConstants.METADATA_KEY_MULTI_SHOT_ARROW, MetadataConstants.MCMMO_METADATA_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
|
if (!arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
|
||||||
arrow.setMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE, new FixedMetadataValue(pluginRef, 1.0));
|
arrow.setMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE, new FixedMetadataValue(pluginRef, 1.0));
|
||||||
|
|
||||||
if(!arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE))
|
if (!arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE))
|
||||||
arrow.setMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE, new FixedMetadataValue(pluginRef, arrow.getLocation()));
|
arrow.setMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE, new FixedMetadataValue(pluginRef, arrow.getLocation()));
|
||||||
|
|
||||||
//Check both hands
|
//Check both hands
|
||||||
if(ItemUtils.doesPlayerHaveEnchantmentInHands(player, "piercing")) {
|
if (ItemUtils.doesPlayerHaveEnchantmentInHands(player, "piercing")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
@ -232,16 +232,16 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) {
|
public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) {
|
||||||
//Prevent players from setting fire to each other if they are in the same party
|
//Prevent players from setting fire to each other if they are in the same party
|
||||||
if(event.getEntity() instanceof Player defender) {
|
if (event.getEntity() instanceof Player defender) {
|
||||||
|
|
||||||
if(event.getCombuster() instanceof Projectile projectile) {
|
if (event.getCombuster() instanceof Projectile projectile) {
|
||||||
if(projectile.getShooter() instanceof Player attacker) {
|
if (projectile.getShooter() instanceof Player attacker) {
|
||||||
if(checkIfInPartyOrSamePlayer(event, defender, attacker)) {
|
if (checkIfInPartyOrSamePlayer(event, defender, attacker)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(event.getCombuster() instanceof Player attacker) {
|
} else if (event.getCombuster() instanceof Player attacker) {
|
||||||
if(checkIfInPartyOrSamePlayer(event, defender, attacker)) {
|
if (checkIfInPartyOrSamePlayer(event, defender, attacker)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -266,18 +266,18 @@ public class EntityListener implements Listener {
|
|||||||
Entity defender = event.getEntity();
|
Entity defender = event.getEntity();
|
||||||
Entity attacker = event.getDamager();
|
Entity attacker = event.getDamager();
|
||||||
|
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(attacker instanceof Player) {
|
if (attacker instanceof Player) {
|
||||||
|
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag((Player) attacker)) {
|
if (!WorldGuardManager.getInstance().hasMainFlag((Player) attacker)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(attacker instanceof Projectile projectile) {
|
} else if (attacker instanceof Projectile projectile) {
|
||||||
|
|
||||||
if(projectile.getShooter() instanceof Player) {
|
if (projectile.getShooter() instanceof Player) {
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag((Player) projectile.getShooter())) {
|
if (!WorldGuardManager.getInstance().hasMainFlag((Player) projectile.getShooter())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,8 +335,8 @@ public class EntityListener implements Listener {
|
|||||||
//Friendly fire checks
|
//Friendly fire checks
|
||||||
if (defender instanceof Player defendingPlayer) {
|
if (defender instanceof Player defendingPlayer) {
|
||||||
//If the attacker is a Player or a projectile belonging to a player
|
//If the attacker is a Player or a projectile belonging to a player
|
||||||
if(attacker instanceof Projectile projectile) {
|
if (attacker instanceof Projectile projectile) {
|
||||||
if(projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
|
if (projectile.getShooter() instanceof Player attackingPlayer && !attackingPlayer.equals(defendingPlayer)) {
|
||||||
//Check for friendly fire and cancel the event
|
//Check for friendly fire and cancel the event
|
||||||
if (checkIfInPartyOrSamePlayer(event, defendingPlayer, attackingPlayer)) {
|
if (checkIfInPartyOrSamePlayer(event, defendingPlayer, attackingPlayer)) {
|
||||||
return;
|
return;
|
||||||
@ -362,9 +362,9 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Required setup for processCombatAttack
|
//Required setup for processCombatAttack
|
||||||
if(attacker instanceof Projectile) {
|
if (attacker instanceof Projectile) {
|
||||||
ProjectileSource shooter = ((Projectile) attacker).getShooter();
|
ProjectileSource shooter = ((Projectile) attacker).getShooter();
|
||||||
if(shooter instanceof LivingEntity) {
|
if (shooter instanceof LivingEntity) {
|
||||||
attacker = (LivingEntity) shooter;
|
attacker = (LivingEntity) shooter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,8 +378,8 @@ public class EntityListener implements Listener {
|
|||||||
* Surprising this kind of thing
|
* Surprising this kind of thing
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if(mcMMO.isProjectKorraEnabled()) {
|
if (mcMMO.isProjectKorraEnabled()) {
|
||||||
if(event.getFinalDamage() == 0) {
|
if (event.getFinalDamage() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,22 +390,22 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
|
||||||
public void onEntityDamageMonitor(EntityDamageByEntityEvent entityDamageEvent) {
|
public void onEntityDamageMonitor(EntityDamageByEntityEvent entityDamageEvent) {
|
||||||
if(entityDamageEvent.getEntity() instanceof LivingEntity livingEntity) {
|
if (entityDamageEvent.getEntity() instanceof LivingEntity livingEntity) {
|
||||||
|
|
||||||
if(entityDamageEvent.getFinalDamage() >= livingEntity.getHealth()) {
|
if (entityDamageEvent.getFinalDamage() >= livingEntity.getHealth()) {
|
||||||
//This sets entity names back to whatever they are supposed to be
|
//This sets entity names back to whatever they are supposed to be
|
||||||
CombatUtils.fixNames(livingEntity);
|
CombatUtils.fixNames(livingEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entityDamageEvent.getDamager() instanceof Arrow arrow) {
|
if (entityDamageEvent.getDamager() instanceof Arrow arrow) {
|
||||||
CombatUtils.delayArrowMetaCleanup(arrow);
|
CombatUtils.delayArrowMetaCleanup(arrow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entityDamageEvent.getEntity() instanceof Player player && entityDamageEvent.getDamager() instanceof Player) {
|
if (entityDamageEvent.getEntity() instanceof Player player && entityDamageEvent.getDamager() instanceof Player) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
if(mmoPlayer != null) {
|
if (mmoPlayer != null) {
|
||||||
if(mmoPlayer.isDebugMode()) {
|
if (mmoPlayer.isDebugMode()) {
|
||||||
player.sendMessage(ChatColor.GOLD + "(mmodebug start of combat report) EntityDamageByEntityEvent DEBUG Info:");
|
player.sendMessage(ChatColor.GOLD + "(mmodebug start of combat report) EntityDamageByEntityEvent DEBUG Info:");
|
||||||
player.sendMessage("You are being damaged by another player in this event");
|
player.sendMessage("You are being damaged by another player in this event");
|
||||||
player.sendMessage("Raw Damage: " + entityDamageEvent.getDamage());
|
player.sendMessage("Raw Damage: " + entityDamageEvent.getDamage());
|
||||||
@ -419,7 +419,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
player.sendMessage("Final damage: " + entityDamageEvent.getFinalDamage());
|
player.sendMessage("Final damage: " + entityDamageEvent.getFinalDamage());
|
||||||
|
|
||||||
if(entityDamageEvent.isCancelled()) {
|
if (entityDamageEvent.isCancelled()) {
|
||||||
player.sendMessage("Event was cancelled, which means no damage should be done.");
|
player.sendMessage("Event was cancelled, which means no damage should be done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -428,10 +428,10 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entityDamageEvent.getDamager() instanceof Player player && entityDamageEvent.getEntity() instanceof Player otherPlayer) {
|
if (entityDamageEvent.getDamager() instanceof Player player && entityDamageEvent.getEntity() instanceof Player otherPlayer) {
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
if(mmoPlayer != null) {
|
if (mmoPlayer != null) {
|
||||||
if(mmoPlayer.isDebugMode()) {
|
if (mmoPlayer.isDebugMode()) {
|
||||||
player.sendMessage(ChatColor.GOLD + "(mmodebug start of combat report) EntityDamageByEntityEvent DEBUG Info:");
|
player.sendMessage(ChatColor.GOLD + "(mmodebug start of combat report) EntityDamageByEntityEvent DEBUG Info:");
|
||||||
player.sendMessage("You are dealing damage to another player in this event");
|
player.sendMessage("You are dealing damage to another player in this event");
|
||||||
player.sendMessage("Raw Damage: " + entityDamageEvent.getDamage());
|
player.sendMessage("Raw Damage: " + entityDamageEvent.getDamage());
|
||||||
@ -445,7 +445,7 @@ public class EntityListener implements Listener {
|
|||||||
player.sendMessage("Target players max health: "+otherPlayer.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
player.sendMessage("Target players max health: "+otherPlayer.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
|
||||||
player.sendMessage("Target players current health: "+otherPlayer.getHealth());
|
player.sendMessage("Target players current health: "+otherPlayer.getHealth());
|
||||||
|
|
||||||
if(entityDamageEvent.isCancelled()) {
|
if (entityDamageEvent.isCancelled()) {
|
||||||
player.sendMessage("Event was cancelled, which means no damage should be done.");
|
player.sendMessage("Event was cancelled, which means no damage should be done.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ public class EntityListener implements Listener {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!pluginRef.isPartySystemEnabled()) {
|
if (!pluginRef.isPartySystemEnabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,7 +470,7 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Party Friendly Fire
|
//Party Friendly Fire
|
||||||
if(!mcMMO.p.getGeneralConfig().getPartyFriendlyFire())
|
if (!mcMMO.p.getGeneralConfig().getPartyFriendlyFire())
|
||||||
if ((mcMMO.p.getPartyManager().inSameParty(defendingPlayer, attackingPlayer)
|
if ((mcMMO.p.getPartyManager().inSameParty(defendingPlayer, attackingPlayer)
|
||||||
|| mcMMO.p.getPartyManager().areAllies(defendingPlayer, attackingPlayer))
|
|| mcMMO.p.getPartyManager().areAllies(defendingPlayer, attackingPlayer))
|
||||||
&& !(Permissions.friendlyFire(attackingPlayer)
|
&& !(Permissions.friendlyFire(attackingPlayer)
|
||||||
@ -490,19 +490,19 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event.getEntity().hasMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE)) {
|
if (event.getEntity().hasMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE)) {
|
||||||
event.getEntity().removeMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE, mcMMO.p);
|
event.getEntity().removeMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE, mcMMO.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getEntity() instanceof Player player)
|
if (event.getEntity() instanceof Player player)
|
||||||
{
|
{
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -559,7 +559,7 @@ public class EntityListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMOPlayer == null)
|
if (mcMMOPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Check for invincibility */
|
/* Check for invincibility */
|
||||||
@ -577,12 +577,12 @@ public class EntityListener implements Listener {
|
|||||||
else if (livingEntity instanceof Tameable pet) {
|
else if (livingEntity instanceof Tameable pet) {
|
||||||
AnimalTamer owner = pet.getOwner();
|
AnimalTamer owner = pet.getOwner();
|
||||||
|
|
||||||
if(owner instanceof Player player)
|
if (owner instanceof Player player)
|
||||||
{
|
{
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -592,7 +592,7 @@ public class EntityListener implements Listener {
|
|||||||
Wolf wolf = (Wolf) pet;
|
Wolf wolf = (Wolf) pet;
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -679,12 +679,12 @@ public class EntityListener implements Listener {
|
|||||||
public void onEntityDeath(EntityDeathEvent event) {
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
LivingEntity entity = event.getEntity();
|
LivingEntity entity = event.getEntity();
|
||||||
|
|
||||||
if(mcMMO.getTransientEntityTracker().isTransientSummon(entity)) {
|
if (mcMMO.getTransientEntityTracker().isTransientSummon(entity)) {
|
||||||
mcMMO.getTransientEntityTracker().removeSummon(entity, null, false);
|
mcMMO.getTransientEntityTracker().removeSummon(entity, null, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -704,7 +704,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
public void onCreatureSpawn(CreatureSpawnEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LivingEntity livingEntity = event.getEntity();
|
LivingEntity livingEntity = event.getEntity();
|
||||||
@ -732,7 +732,7 @@ public class EntityListener implements Listener {
|
|||||||
flagMetadata(mobMetaFlagType, livingEntity);
|
flagMetadata(mobMetaFlagType, livingEntity);
|
||||||
|
|
||||||
for(Entity passenger : livingEntity.getPassengers()) {
|
for(Entity passenger : livingEntity.getPassengers()) {
|
||||||
if(passenger != null) {
|
if (passenger != null) {
|
||||||
flagMetadata(mobMetaFlagType, livingEntity);
|
flagMetadata(mobMetaFlagType, livingEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -740,8 +740,8 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||||
public void onEntityBreed(EntityBreedEvent event) {
|
public void onEntityBreed(EntityBreedEvent event) {
|
||||||
if(ExperienceConfig.getInstance().isCOTWBreedingPrevented()) {
|
if (ExperienceConfig.getInstance().isCOTWBreedingPrevented()) {
|
||||||
if(hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getFather()) || hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getMother())) {
|
if (hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getFather()) || hasMobFlag(MobMetaFlagType.COTW_SUMMONED_MOB, event.getMother())) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Animals mom = (Animals) event.getMother();
|
Animals mom = (Animals) event.getMother();
|
||||||
Animals father = (Animals) event.getFather();
|
Animals father = (Animals) event.getFather();
|
||||||
@ -751,7 +751,7 @@ public class EntityListener implements Listener {
|
|||||||
father.setLoveModeTicks(0);
|
father.setLoveModeTicks(0);
|
||||||
|
|
||||||
//Inform the player
|
//Inform the player
|
||||||
if(event.getBreeder() instanceof Player player) {
|
if (event.getBreeder() instanceof Player player) {
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "Taming.Summon.COTW.BreedingDisallowed");
|
NotificationManager.sendPlayerInformationChatOnly(player, "Taming.Summon.COTW.BreedingDisallowed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -767,7 +767,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
public void onExplosionPrime(ExplosionPrimeEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -785,15 +785,15 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -813,7 +813,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEnitityExplode(EntityExplodeEvent event) {
|
public void onEnitityExplode(EntityExplodeEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -831,14 +831,14 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -860,7 +860,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
public void onFoodLevelChange(FoodLevelChangeEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -870,15 +870,15 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -898,9 +898,9 @@ public class EntityListener implements Listener {
|
|||||||
//The main hand is used over the off hand if they both have food, so check the main hand first
|
//The main hand is used over the off hand if they both have food, so check the main hand first
|
||||||
Material foodInHand;
|
Material foodInHand;
|
||||||
|
|
||||||
if(mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInMainHand().getType())) {
|
if (mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInMainHand().getType())) {
|
||||||
foodInHand = player.getInventory().getItemInMainHand().getType();
|
foodInHand = player.getInventory().getItemInMainHand().getType();
|
||||||
} else if(mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInOffHand().getType())) {
|
} else if (mcMMO.getMaterialMapStore().isFood(player.getInventory().getItemInOffHand().getType())) {
|
||||||
foodInHand = player.getInventory().getItemInOffHand().getType();
|
foodInHand = player.getInventory().getItemInOffHand().getType();
|
||||||
} else {
|
} else {
|
||||||
return; //Not Food
|
return; //Not Food
|
||||||
@ -913,7 +913,7 @@ public class EntityListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Hacky 1.17 support
|
//Hacky 1.17 support
|
||||||
if(foodInHand.getKey().getKey().equalsIgnoreCase("glow_berries")) {
|
if (foodInHand.getKey().getKey().equalsIgnoreCase("glow_berries")) {
|
||||||
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
|
if (Permissions.isSubSkillEnabled(player, SubSkillType.HERBALISM_FARMERS_DIET)) {
|
||||||
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
|
event.setFoodLevel(UserManager.getPlayer(player).getHerbalismManager().farmersDiet(newFoodLevel));
|
||||||
}
|
}
|
||||||
@ -984,7 +984,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityTame(EntityTameEvent event) {
|
public void onEntityTame(EntityTameEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event instanceof FakeEntityTameEvent) {
|
if (event instanceof FakeEntityTameEvent) {
|
||||||
@ -994,9 +994,9 @@ public class EntityListener implements Listener {
|
|||||||
Player player = (Player) event.getOwner();
|
Player player = (Player) event.getOwner();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,7 +1012,7 @@ public class EntityListener implements Listener {
|
|||||||
flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
|
flagMetadata(MobMetaFlagType.PLAYER_TAMED_MOB, livingEntity);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1029,7 +1029,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityTarget(EntityTargetEvent event) {
|
public void onEntityTarget(EntityTargetEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
@ -1040,9 +1040,9 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1068,7 +1068,7 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPotionSplash(PotionSplashEvent event) {
|
public void onPotionSplash(PotionSplashEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemMeta meta = event.getPotion().getItem().getItemMeta();
|
ItemMeta meta = event.getPotion().getItem().getItemMeta();
|
||||||
@ -1095,8 +1095,8 @@ public class EntityListener implements Listener {
|
|||||||
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event.getEntity() instanceof Arrow arrow) {
|
if (event.getEntity() instanceof Arrow arrow) {
|
||||||
if(arrow.isShotFromCrossbow()) {
|
if (arrow.isShotFromCrossbow()) {
|
||||||
Crossbows.processCrossbows(event, pluginRef, arrow);
|
Crossbows.processCrossbows(event, pluginRef, arrow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,13 +19,13 @@ public class InteractionManager {
|
|||||||
|
|
||||||
public static void initMaps() {
|
public static void initMaps() {
|
||||||
/* INIT MAPS */
|
/* INIT MAPS */
|
||||||
if(interactRegister == null)
|
if (interactRegister == null)
|
||||||
interactRegister = new HashMap<>();
|
interactRegister = new HashMap<>();
|
||||||
|
|
||||||
if(subSkillList == null)
|
if (subSkillList == null)
|
||||||
subSkillList = new ArrayList<>();
|
subSkillList = new ArrayList<>();
|
||||||
|
|
||||||
if(subSkillNameMap == null)
|
if (subSkillNameMap == null)
|
||||||
subSkillNameMap = new HashMap<>();
|
subSkillNameMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ public class InteractionManager {
|
|||||||
public static void registerSubSkill(AbstractSubSkill abstractSubSkill)
|
public static void registerSubSkill(AbstractSubSkill abstractSubSkill)
|
||||||
{
|
{
|
||||||
//Store a unique copy of each subskill
|
//Store a unique copy of each subskill
|
||||||
if(!subSkillList.contains(abstractSubSkill))
|
if (!subSkillList.contains(abstractSubSkill))
|
||||||
subSkillList.add(abstractSubSkill);
|
subSkillList.add(abstractSubSkill);
|
||||||
|
|
||||||
//Init ArrayList
|
//Init ArrayList
|
||||||
@ -75,7 +75,7 @@ public class InteractionManager {
|
|||||||
*/
|
*/
|
||||||
public static void processEvent(Event event, mcMMO plugin, InteractType curInteractType)
|
public static void processEvent(Event event, mcMMO plugin, InteractType curInteractType)
|
||||||
{
|
{
|
||||||
if(interactRegister.get(curInteractType) == null)
|
if (interactRegister.get(curInteractType) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(Interaction interaction : interactRegister.get(curInteractType))
|
for(Interaction interaction : interactRegister.get(curInteractType))
|
||||||
|
@ -42,7 +42,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onFurnaceBurnEvent(FurnaceBurnEvent event) {
|
public void onFurnaceBurnEvent(FurnaceBurnEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block furnaceBlock = event.getBlock();
|
Block furnaceBlock = event.getBlock();
|
||||||
@ -57,7 +57,7 @@ public class InventoryListener implements Listener {
|
|||||||
OfflinePlayer offlinePlayer = ContainerMetadataUtils.getContainerOwner(furnace);
|
OfflinePlayer offlinePlayer = ContainerMetadataUtils.getContainerOwner(furnace);
|
||||||
Player player;
|
Player player;
|
||||||
|
|
||||||
if(offlinePlayer != null && offlinePlayer.isOnline() && offlinePlayer instanceof Player) {
|
if (offlinePlayer != null && offlinePlayer.isOnline() && offlinePlayer instanceof Player) {
|
||||||
player = (Player) offlinePlayer;
|
player = (Player) offlinePlayer;
|
||||||
|
|
||||||
if (!Permissions.isSubSkillEnabled(player, SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
|
if (!Permissions.isSubSkillEnabled(player, SubSkillType.SMELTING_FUEL_EFFICIENCY)) {
|
||||||
@ -66,10 +66,10 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(mmoPlayer != null) {
|
if (mmoPlayer != null) {
|
||||||
boolean debugMode = mmoPlayer.isDebugMode();
|
boolean debugMode = mmoPlayer.isDebugMode();
|
||||||
|
|
||||||
if(debugMode) {
|
if (debugMode) {
|
||||||
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
|
player.sendMessage("FURNACE FUEL EFFICIENCY DEBUG REPORT");
|
||||||
player.sendMessage("Furnace - "+furnace.hashCode());
|
player.sendMessage("Furnace - "+furnace.hashCode());
|
||||||
player.sendMessage("Furnace Type: "+furnaceBlock.getType());
|
player.sendMessage("Furnace Type: "+furnaceBlock.getType());
|
||||||
@ -78,7 +78,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
event.setBurnTime(mmoPlayer.getSmeltingManager().fuelEfficiency(event.getBurnTime()));
|
event.setBurnTime(mmoPlayer.getSmeltingManager().fuelEfficiency(event.getBurnTime()));
|
||||||
|
|
||||||
if(debugMode) {
|
if (debugMode) {
|
||||||
player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
|
player.sendMessage("New Furnace Burn Length (after applying fuel efficiency) "+event.getBurnTime());
|
||||||
player.sendMessage("");
|
player.sendMessage("");
|
||||||
}
|
}
|
||||||
@ -89,7 +89,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
|
public void onFurnaceSmeltEvent(FurnaceSmeltEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockState blockState = event.getBlock().getState(); //Furnaces can only be cast from a BlockState not a Block
|
BlockState blockState = event.getBlock().getState(); //Furnaces can only be cast from a BlockState not a Block
|
||||||
@ -99,15 +99,15 @@ public class InventoryListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blockState instanceof Furnace furnace) {
|
if (blockState instanceof Furnace furnace) {
|
||||||
OfflinePlayer offlinePlayer = ContainerMetadataUtils.getContainerOwner(furnace);
|
OfflinePlayer offlinePlayer = ContainerMetadataUtils.getContainerOwner(furnace);
|
||||||
|
|
||||||
if(offlinePlayer != null) {
|
if (offlinePlayer != null) {
|
||||||
|
|
||||||
McMMOPlayer offlineProfile = UserManager.getOfflinePlayer(offlinePlayer);
|
McMMOPlayer offlineProfile = UserManager.getOfflinePlayer(offlinePlayer);
|
||||||
|
|
||||||
//Profile doesn't exist
|
//Profile doesn't exist
|
||||||
if(offlineProfile != null) {
|
if (offlineProfile != null) {
|
||||||
//Process smelting
|
//Process smelting
|
||||||
offlineProfile.getSmeltingManager().smeltProcessing(event, furnace);
|
offlineProfile.getSmeltingManager().smeltProcessing(event, furnace);
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockState furnaceBlock = event.getBlock().getState();
|
BlockState furnaceBlock = event.getBlock().getState();
|
||||||
@ -129,11 +129,11 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if(furnaceBlock instanceof Furnace) {
|
if (furnaceBlock instanceof Furnace) {
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ public class InventoryListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -156,11 +156,11 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryClickEventNormal(InventoryClickEvent event) {
|
public void onInventoryClickEventNormal(InventoryClickEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//We should never care to do processing if the player clicks outside the window
|
//We should never care to do processing if the player clicks outside the window
|
||||||
// if(isOutsideWindowClick(event))
|
// if (isOutsideWindowClick(event))
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
Inventory inventory = event.getInventory();
|
Inventory inventory = event.getInventory();
|
||||||
@ -168,12 +168,12 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = ((Player) event.getWhoClicked()).getPlayer();
|
Player player = ((Player) event.getWhoClicked()).getPlayer();
|
||||||
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
if(event.getInventory() instanceof FurnaceInventory furnaceInventory) {
|
if (event.getInventory() instanceof FurnaceInventory furnaceInventory) {
|
||||||
//Switch owners
|
//Switch owners
|
||||||
ContainerMetadataUtils.processContainerOwnership(furnaceInventory.getHolder(), player);
|
ContainerMetadataUtils.processContainerOwnership(furnaceInventory.getHolder(), player);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getInventory() instanceof BrewerInventory brewerInventory) {
|
if (event.getInventory() instanceof BrewerInventory brewerInventory) {
|
||||||
// switch owners
|
// switch owners
|
||||||
ContainerMetadataUtils.processContainerOwnership(brewerInventory.getHolder(), player);
|
ContainerMetadataUtils.processContainerOwnership(brewerInventory.getHolder(), player);
|
||||||
}
|
}
|
||||||
@ -196,9 +196,9 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
// TODO: Investigate why this WG check is all the way down here?
|
// TODO: Investigate why this WG check is all the way down here?
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -291,7 +291,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
|
||||||
public void onInventoryDragEvent(InventoryDragEvent event) {
|
public void onInventoryDragEvent(InventoryDragEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Inventory inventory = event.getInventory();
|
Inventory inventory = event.getInventory();
|
||||||
@ -323,9 +323,9 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = (Player) whoClicked;
|
Player player = (Player) whoClicked;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,7 +345,7 @@ public class InventoryListener implements Listener {
|
|||||||
public void onBrew(BrewEvent event)
|
public void onBrew(BrewEvent event)
|
||||||
{
|
{
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (event instanceof FakeBrewEvent)
|
if (event instanceof FakeBrewEvent)
|
||||||
@ -361,7 +361,7 @@ public class InventoryListener implements Listener {
|
|||||||
// @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
// @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
// public void onBrewStart(BrewingStartEvent event) {
|
// public void onBrewStart(BrewingStartEvent event) {
|
||||||
// /* WORLD BLACKLIST CHECK */
|
// /* WORLD BLACKLIST CHECK */
|
||||||
// if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
// if (WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld()))
|
||||||
// return;
|
// return;
|
||||||
//
|
//
|
||||||
// if (event instanceof FakeEvent)
|
// if (event instanceof FakeEvent)
|
||||||
@ -372,8 +372,8 @@ public class InventoryListener implements Listener {
|
|||||||
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
|
public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
|
|
||||||
if(event.getSource().getLocation() != null)
|
if (event.getSource().getLocation() != null)
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Inventory inventory = event.getDestination();
|
final Inventory inventory = event.getDestination();
|
||||||
@ -416,19 +416,19 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onInventoryClickEvent(InventoryClickEvent event) {
|
public void onInventoryClickEvent(InventoryClickEvent event) {
|
||||||
if(event.getCurrentItem() == null) {
|
if (event.getCurrentItem() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillUtils.removeAbilityBuff(event.getCurrentItem());
|
SkillUtils.removeAbilityBuff(event.getCurrentItem());
|
||||||
|
|
||||||
if (event.getAction() == InventoryAction.HOTBAR_SWAP) {
|
if (event.getAction() == InventoryAction.HOTBAR_SWAP) {
|
||||||
if(isOutsideWindowClick(event))
|
if (isOutsideWindowClick(event))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PlayerInventory playerInventory = event.getWhoClicked().getInventory();
|
PlayerInventory playerInventory = event.getWhoClicked().getInventory();
|
||||||
|
|
||||||
if(playerInventory.getItem(event.getHotbarButton()) != null)
|
if (playerInventory.getItem(event.getHotbarButton()) != null)
|
||||||
SkillUtils.removeAbilityBuff(playerInventory.getItem(event.getHotbarButton()));
|
SkillUtils.removeAbilityBuff(playerInventory.getItem(event.getHotbarButton()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -441,7 +441,7 @@ public class InventoryListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onCraftItem(CraftItemEvent event) {
|
public void onCraftItem(CraftItemEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getWhoClicked().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final HumanEntity whoClicked = event.getWhoClicked();
|
final HumanEntity whoClicked = event.getWhoClicked();
|
||||||
@ -460,9 +460,9 @@ public class InventoryListener implements Listener {
|
|||||||
Player player = (Player) whoClicked;
|
Player player = (Player) whoClicked;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,13 +71,13 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
|
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld())) {
|
||||||
//Remove scoreboards
|
//Remove scoreboards
|
||||||
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
ScoreboardManager.teardownPlayer(event.getPlayer());
|
ScoreboardManager.teardownPlayer(event.getPlayer());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if(WorldBlacklist.isWorldBlacklisted(event.getFrom().getWorld()) && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
} else if (WorldBlacklist.isWorldBlacklisted(event.getFrom().getWorld()) && mcMMO.p.getGeneralConfig().getScoreboardsEnabled()) {
|
||||||
//This only fires if they are travelling to a non-blacklisted world from a blacklisted world
|
//This only fires if they are travelling to a non-blacklisted world from a blacklisted world
|
||||||
|
|
||||||
//Setup scoreboards
|
//Setup scoreboards
|
||||||
@ -87,9 +87,9 @@ public class PlayerListener implements Listener {
|
|||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerDeathMonitor(PlayerDeathEvent event) {
|
public void onPlayerDeathMonitor(PlayerDeathEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
boolean statLossEnabled = HardcoreManager.isStatLossEnabled();
|
boolean statLossEnabled = HardcoreManager.isStatLossEnabled();
|
||||||
@ -183,9 +183,9 @@ public class PlayerListener implements Listener {
|
|||||||
Player killer = killedPlayer.getKiller();
|
Player killer = killedPlayer.getKiller();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(killedPlayer))
|
if (!WorldGuardManager.getInstance().hasMainFlag(killedPlayer))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -250,13 +250,13 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
public void onPlayerDropItem(PlayerDropItemEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
if (!WorldGuardManager.getInstance().hasMainFlag(event.getPlayer()))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,15 +281,15 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||||
public void onPlayerFishHighest(PlayerFishEvent event) {
|
public void onPlayerFishHighest(PlayerFishEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ public class PlayerListener implements Listener {
|
|||||||
switch (event.getState()) {
|
switch (event.getState()) {
|
||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE
|
//TODO Update to new API once available! Waiting for case CAUGHT_TREASURE
|
||||||
if(event.getCaught() != null) {
|
if (event.getCaught() != null) {
|
||||||
Item fishingCatch = (Item) event.getCaught();
|
Item fishingCatch = (Item) event.getCaught();
|
||||||
|
|
||||||
if (mcMMO.p.getGeneralConfig().getFishingOverrideTreasures() &&
|
if (mcMMO.p.getGeneralConfig().getFishingOverrideTreasures() &&
|
||||||
@ -329,7 +329,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (Permissions.vanillaXpBoost(player, PrimarySkillType.FISHING)) {
|
if (Permissions.vanillaXpBoost(player, PrimarySkillType.FISHING)) {
|
||||||
//Don't modify XP below vanilla values
|
//Don't modify XP below vanilla values
|
||||||
if(fishingManager.handleVanillaXpBoost(event.getExpToDrop()) > 1)
|
if (fishingManager.handleVanillaXpBoost(event.getExpToDrop()) > 1)
|
||||||
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
|
event.setExpToDrop(fishingManager.handleVanillaXpBoost(event.getExpToDrop()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -367,15 +367,15 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
public void onPlayerFishMonitor(PlayerFishEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +384,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -393,19 +393,19 @@ public class PlayerListener implements Listener {
|
|||||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||||
|
|
||||||
//Track the hook
|
//Track the hook
|
||||||
if(ExperienceConfig.getInstance().isFishingExploitingPrevented())
|
if (ExperienceConfig.getInstance().isFishingExploitingPrevented())
|
||||||
{
|
{
|
||||||
if(event.getHook().getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() == 0)
|
if (event.getHook().getMetadata(MetadataConstants.METADATA_KEY_FISH_HOOK_REF).size() == 0)
|
||||||
{
|
{
|
||||||
fishingManager.setFishHookReference(event.getHook());
|
fishingManager.setFishHookReference(event.getHook());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Spam Fishing
|
//Spam Fishing
|
||||||
if(event.getState() == PlayerFishEvent.State.CAUGHT_FISH && fishingManager.isFishingTooOften())
|
if (event.getState() == PlayerFishEvent.State.CAUGHT_FISH && fishingManager.isFishingTooOften())
|
||||||
{
|
{
|
||||||
event.setExpToDrop(0);
|
event.setExpToDrop(0);
|
||||||
|
|
||||||
if(caught instanceof Item caughtItem)
|
if (caught instanceof Item caughtItem)
|
||||||
{
|
{
|
||||||
caughtItem.remove();
|
caughtItem.remove();
|
||||||
}
|
}
|
||||||
@ -421,19 +421,19 @@ public class PlayerListener implements Listener {
|
|||||||
ItemStack inHand = player.getInventory().getItemInMainHand();
|
ItemStack inHand = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
//Grab lure level
|
//Grab lure level
|
||||||
if(inHand != null
|
if (inHand != null
|
||||||
&& inHand.getItemMeta() != null
|
&& inHand.getItemMeta() != null
|
||||||
&& inHand.getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
|
&& inHand.getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
|
||||||
if(inHand.getItemMeta().hasEnchants()) {
|
if (inHand.getItemMeta().hasEnchants()) {
|
||||||
for(Enchantment enchantment : inHand.getItemMeta().getEnchants().keySet()) {
|
for(Enchantment enchantment : inHand.getItemMeta().getEnchants().keySet()) {
|
||||||
if(enchantment.toString().toLowerCase().contains("lure")) {
|
if (enchantment.toString().toLowerCase().contains("lure")) {
|
||||||
lureLevel = inHand.getEnchantmentLevel(enchantment);
|
lureLevel = inHand.getEnchantmentLevel(enchantment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent any potential odd behavior by only processing if no offhand fishing rod is present
|
// Prevent any potential odd behavior by only processing if no offhand fishing rod is present
|
||||||
if(!player.getInventory().getItemInOffHand().getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
|
if (!player.getInventory().getItemInOffHand().getType().getKey().getKey().equalsIgnoreCase("fishing_rod")) {
|
||||||
// In case of offhand fishing rod, don't process anything
|
// In case of offhand fishing rod, don't process anything
|
||||||
fishingManager.masterAngler(event.getHook(), lureLevel);
|
fishingManager.masterAngler(event.getHook(), lureLevel);
|
||||||
fishingManager.setFishingTarget();
|
fishingManager.setFishingTarget();
|
||||||
@ -442,8 +442,8 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
if(caught instanceof Item) {
|
if (caught instanceof Item) {
|
||||||
if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
|
if (ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
|
||||||
|
|
||||||
fishingManager.processExploiting(event.getHook().getLocation().toVector());
|
fishingManager.processExploiting(event.getHook().getLocation().toVector());
|
||||||
|
|
||||||
@ -482,20 +482,20 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
public void onPlayerPickupItem(EntityPickupItemEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(Misc.isNPCEntityExcludingVillagers(event.getEntity())) {
|
if (Misc.isNPCEntityExcludingVillagers(event.getEntity())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getEntity() instanceof Player player)
|
if (event.getEntity() instanceof Player player)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,7 +505,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
if(mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ public class PlayerListener implements Listener {
|
|||||||
ItemStack dropStack = drop.getItemStack();
|
ItemStack dropStack = drop.getItemStack();
|
||||||
|
|
||||||
//Remove tracking
|
//Remove tracking
|
||||||
if(drop.hasMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW)) {
|
if (drop.hasMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW)) {
|
||||||
drop.removeMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW, mcMMO.p);
|
drop.removeMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW, mcMMO.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,7 +566,7 @@ public class PlayerListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(mcMMOPlayer == null) {
|
if (mcMMOPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -634,28 +634,28 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
public void onPlayerInteractLowest(PlayerInteractEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getClickedBlock() == null)
|
if (event.getClickedBlock() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block clickedBlock = event.getClickedBlock();
|
Block clickedBlock = event.getClickedBlock();
|
||||||
Material clickedBlockType = clickedBlock.getType();
|
Material clickedBlockType = clickedBlock.getType();
|
||||||
//The blacklist contains interactable blocks so its a convenient filter
|
//The blacklist contains interactable blocks so its a convenient filter
|
||||||
if(clickedBlockType == Repair.anvilMaterial || clickedBlockType == Salvage.anvilMaterial) {
|
if (clickedBlockType == Repair.anvilMaterial || clickedBlockType == Salvage.anvilMaterial) {
|
||||||
event.setUseItemInHand(Event.Result.ALLOW);
|
event.setUseItemInHand(Event.Result.ALLOW);
|
||||||
|
|
||||||
if(!event.getPlayer().isSneaking() && mcMMO.getMaterialMapStore().isToolActivationBlackListed(clickedBlockType)) {
|
if (!event.getPlayer().isSneaking() && mcMMO.getMaterialMapStore().isToolActivationBlackListed(clickedBlockType)) {
|
||||||
event.setUseInteractedBlock(Event.Result.DENY);
|
event.setUseInteractedBlock(Event.Result.DENY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -665,7 +665,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -764,15 +764,15 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
|
public void onPlayerInteractMonitor(PlayerInteractEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getPlayer().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag(player))
|
if (!WorldGuardManager.getInstance().hasMainFlag(player))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,7 +781,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if (UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -793,12 +793,12 @@ public class PlayerListener implements Listener {
|
|||||||
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
ItemStack heldItem = player.getInventory().getItemInMainHand();
|
||||||
|
|
||||||
//Spam Fishing Detection
|
//Spam Fishing Detection
|
||||||
if(event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR)
|
if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR)
|
||||||
{
|
{
|
||||||
if(ExperienceConfig.getInstance().isFishingExploitingPrevented()
|
if (ExperienceConfig.getInstance().isFishingExploitingPrevented()
|
||||||
&& (heldItem.getType() == Material.FISHING_ROD || player.getInventory().getItemInOffHand().getType() == Material.FISHING_ROD))
|
&& (heldItem.getType() == Material.FISHING_ROD || player.getInventory().getItemInOffHand().getType() == Material.FISHING_ROD))
|
||||||
{
|
{
|
||||||
if(player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart))
|
if (player.isInsideVehicle() && (player.getVehicle() instanceof Minecart || player.getVehicle() instanceof PoweredMinecart))
|
||||||
{
|
{
|
||||||
player.getVehicle().eject();
|
player.getVehicle().eject();
|
||||||
}
|
}
|
||||||
@ -809,12 +809,12 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case RIGHT_CLICK_BLOCK:
|
case RIGHT_CLICK_BLOCK:
|
||||||
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
|
if (player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Hmm
|
//Hmm
|
||||||
if(event.getClickedBlock() == null)
|
if (event.getClickedBlock() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Block block = event.getClickedBlock();
|
Block block = event.getClickedBlock();
|
||||||
@ -841,7 +841,7 @@ public class PlayerListener implements Listener {
|
|||||||
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
HerbalismManager herbalismManager = mcMMOPlayer.getHerbalismManager();
|
||||||
|
|
||||||
// FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer(), PlayerAnimationType.ARM_SWING); //PlayerAnimationEvent compat
|
// FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer(), PlayerAnimationType.ARM_SWING); //PlayerAnimationEvent compat
|
||||||
if(!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) {
|
if (!event.isCancelled() || event.useInteractedBlock() != Event.Result.DENY) {
|
||||||
//TODO: Is this code to set false from bone meal even needed? I'll have to double check later.
|
//TODO: Is this code to set false from bone meal even needed? I'll have to double check later.
|
||||||
if (heldItem.getType() == Material.BONE_MEAL) {
|
if (heldItem.getType() == Material.BONE_MEAL) {
|
||||||
switch (blockState.getType().toString()) {
|
switch (blockState.getType().toString()) {
|
||||||
@ -859,7 +859,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
if (herbalismManager.canGreenThumbBlock(blockState)) {
|
||||||
//call event for Green Thumb Block
|
//call event for Green Thumb Block
|
||||||
if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) {
|
if (!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_GREEN_THUMB, block).isCancelled()) {
|
||||||
// Bukkit.getPluginManager().callEvent(fakeSwing);
|
// Bukkit.getPluginManager().callEvent(fakeSwing);
|
||||||
player.getInventory().getItemInMainHand().setAmount(heldItem.getAmount() - 1);
|
player.getInventory().getItemInMainHand().setAmount(heldItem.getAmount() - 1);
|
||||||
player.updateInventory();
|
player.updateInventory();
|
||||||
@ -870,7 +870,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
/* SHROOM THUMB CHECK */
|
/* SHROOM THUMB CHECK */
|
||||||
else if (herbalismManager.canUseShroomThumb(blockState)) {
|
else if (herbalismManager.canUseShroomThumb(blockState)) {
|
||||||
if(!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_SHROOM_THUMB, block).isCancelled()) {
|
if (!EventUtils.callSubSkillBlockEvent(player, SubSkillType.HERBALISM_SHROOM_THUMB, block).isCancelled()) {
|
||||||
// Bukkit.getPluginManager().callEvent(fakeSwing);
|
// Bukkit.getPluginManager().callEvent(fakeSwing);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
if (herbalismManager.processShroomThumb(blockState)
|
if (herbalismManager.processShroomThumb(blockState)
|
||||||
@ -885,7 +885,7 @@ public class PlayerListener implements Listener {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RIGHT_CLICK_AIR:
|
case RIGHT_CLICK_AIR:
|
||||||
if(player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
|
if (player.getInventory().getItemInOffHand().getType() != Material.AIR && !player.isInsideVehicle() && !player.isSneaking()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -960,9 +960,9 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(plugin.getChatManager().isChatChannelEnabled(mcMMOPlayer.getChatChannel())) {
|
if (plugin.getChatManager().isChatChannelEnabled(mcMMOPlayer.getChatChannel())) {
|
||||||
if(mcMMOPlayer.getChatChannel() != ChatChannel.NONE) {
|
if (mcMMOPlayer.getChatChannel() != ChatChannel.NONE) {
|
||||||
if(plugin.getChatManager().isMessageAllowed(mcMMOPlayer)) {
|
if (plugin.getChatManager().isMessageAllowed(mcMMOPlayer)) {
|
||||||
//If the message is allowed we cancel this event to avoid double sending messages
|
//If the message is allowed we cancel this event to avoid double sending messages
|
||||||
plugin.getChatManager().processPlayerMessage(mcMMOPlayer, event.getMessage(), event.isAsynchronous());
|
plugin.getChatManager().processPlayerMessage(mcMMOPlayer, event.getMessage(), event.isAsynchronous());
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -37,10 +37,10 @@ public class SelfListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//TODO: Handle proper validation at the event level
|
//TODO: Handle proper validation at the event level
|
||||||
if(mcMMOPlayer == null || !mcMMOPlayer.getProfile().isLoaded())
|
if (mcMMOPlayer == null || !mcMMOPlayer.getProfile().isLoaded())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
//Players can gain multiple levels especially during xprate events
|
//Players can gain multiple levels especially during xprate events
|
||||||
for(int i = 0; i < event.getLevelsGained(); i++)
|
for(int i = 0; i < event.getLevelsGained(); i++)
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ public class SelfListener implements Listener {
|
|||||||
//Reset the delay timer
|
//Reset the delay timer
|
||||||
RankUtils.resetUnlockDelayTimer();
|
RankUtils.resetUnlockDelayTimer();
|
||||||
|
|
||||||
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.handleLevelUp(player, skill);
|
ScoreboardManager.handleLevelUp(player, skill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,8 +61,8 @@ public class SelfListener implements Listener {
|
|||||||
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
|
public void onPlayerXp(McMMOPlayerXpGainEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if(player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.handleXp(player, event.getSkill());
|
ScoreboardManager.handleXp(player, event.getSkill());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,8 +70,8 @@ public class SelfListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
public void onAbility(McMMOPlayerAbilityActivateEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
if(player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
if(mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
if (mcMMO.p.getGeneralConfig().getScoreboardsEnabled())
|
||||||
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
ScoreboardManager.cooldownUpdate(event.getPlayer(), event.getSkill());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,30 +82,30 @@ public class SelfListener implements Listener {
|
|||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//TODO: Handle proper validation at the event level
|
//TODO: Handle proper validation at the event level
|
||||||
if(mcMMOPlayer == null || !mcMMOPlayer.getProfile().isLoaded())
|
if (mcMMOPlayer == null || !mcMMOPlayer.getProfile().isLoaded())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PrimarySkillType primarySkillType = event.getSkill();
|
PrimarySkillType primarySkillType = event.getSkill();
|
||||||
|
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if (mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage(event.getSkill().toString() + " XP Gained");
|
mcMMOPlayer.getPlayer().sendMessage(event.getSkill().toString() + " XP Gained");
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Incoming Raw XP: "+event.getRawXpGained());
|
mcMMOPlayer.getPlayer().sendMessage("Incoming Raw XP: "+event.getRawXpGained());
|
||||||
}
|
}
|
||||||
|
|
||||||
//WorldGuard XP Check
|
//WorldGuard XP Check
|
||||||
if(event.getXpGainReason() == XPGainReason.PVE ||
|
if (event.getXpGainReason() == XPGainReason.PVE ||
|
||||||
event.getXpGainReason() == XPGainReason.PVP ||
|
event.getXpGainReason() == XPGainReason.PVP ||
|
||||||
event.getXpGainReason() == XPGainReason.SHARED_PVE ||
|
event.getXpGainReason() == XPGainReason.SHARED_PVE ||
|
||||||
event.getXpGainReason() == XPGainReason.SHARED_PVP)
|
event.getXpGainReason() == XPGainReason.SHARED_PVP)
|
||||||
{
|
{
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if (WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
if(!WorldGuardManager.getInstance().hasXPFlag(player))
|
if (!WorldGuardManager.getInstance().hasXPFlag(player))
|
||||||
{
|
{
|
||||||
event.setRawXpGained(0);
|
event.setRawXpGained(0);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if (mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("No WG XP Flag - New Raw XP: "+event.getRawXpGained());
|
mcMMOPlayer.getPlayer().sendMessage("No WG XP Flag - New Raw XP: "+event.getRawXpGained());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,13 +117,13 @@ public class SelfListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ExperienceConfig.getInstance().isEarlyGameBoostEnabled())
|
if (ExperienceConfig.getInstance().isEarlyGameBoostEnabled())
|
||||||
{
|
{
|
||||||
|
|
||||||
int earlyGameBonusXP = 0;
|
int earlyGameBonusXP = 0;
|
||||||
|
|
||||||
//Give some bonus XP for low levels
|
//Give some bonus XP for low levels
|
||||||
if(PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType))
|
if (PlayerLevelUtils.qualifiesForEarlyGameBoost(mcMMOPlayer, primarySkillType))
|
||||||
{
|
{
|
||||||
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
|
earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05);
|
||||||
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
|
event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP);
|
||||||
@ -133,7 +133,7 @@ public class SelfListener implements Listener {
|
|||||||
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType);
|
int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType);
|
||||||
|
|
||||||
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) {
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if (mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
|
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
|
||||||
}
|
}
|
||||||
// Diminished returns is turned off
|
// Diminished returns is turned off
|
||||||
@ -167,7 +167,7 @@ public class SelfListener implements Listener {
|
|||||||
* Make sure players get a guaranteed minimum of XP
|
* Make sure players get a guaranteed minimum of XP
|
||||||
*/
|
*/
|
||||||
//If there is no guaranteed minimum proceed, otherwise only proceed if newValue would be higher than our guaranteed minimum
|
//If there is no guaranteed minimum proceed, otherwise only proceed if newValue would be higher than our guaranteed minimum
|
||||||
if(guaranteedMinimum <= 0 || newValue > guaranteedMinimum)
|
if (guaranteedMinimum <= 0 || newValue > guaranteedMinimum)
|
||||||
{
|
{
|
||||||
if (newValue > 0) {
|
if (newValue > 0) {
|
||||||
event.setRawXpGained(newValue);
|
event.setRawXpGained(newValue);
|
||||||
@ -181,7 +181,7 @@ public class SelfListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if (mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
|
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class WorldListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onStructureGrow(StructureGrowEvent event) {
|
public void onStructureGrow(StructureGrowEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Using 50 ms later as I do not know of a way to run one tick later (safely)
|
// Using 50 ms later as I do not know of a way to run one tick later (safely)
|
||||||
@ -45,7 +45,7 @@ public class WorldListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onWorldUnload(WorldUnloadEvent event) {
|
public void onWorldUnload(WorldUnloadEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mcMMO.getPlaceStore().unloadWorld(event.getWorld());
|
mcMMO.getPlaceStore().unloadWorld(event.getWorld());
|
||||||
@ -59,7 +59,7 @@ public class WorldListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||||
/* WORLD BLACKLIST CHECK */
|
/* WORLD BLACKLIST CHECK */
|
||||||
if(WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
if (WorldBlacklist.isWorldBlacklisted(event.getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Chunk chunk = event.getChunk();
|
Chunk chunk = event.getChunk();
|
||||||
|
@ -380,7 +380,7 @@ public final class LocaleLoader {
|
|||||||
* @return The message with the hex color codes translated to Minecraft color codes
|
* @return The message with the hex color codes translated to Minecraft color codes
|
||||||
*/
|
*/
|
||||||
public static String translateHexColorCodes(String messageWithHex) {
|
public static String translateHexColorCodes(String messageWithHex) {
|
||||||
if(messageWithHex == null) {
|
if (messageWithHex == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
checkModConfigs();
|
checkModConfigs();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(projectKorraEnabled) {
|
if (projectKorraEnabled) {
|
||||||
getLogger().info("ProjectKorra was detected, this can cause some issues with weakness potions and combat skills for mcMMO");
|
getLogger().info("ProjectKorra was detected, this can cause some issues with weakness potions and combat skills for mcMMO");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//Check for the newer API and tell them what to do if its missing
|
//Check for the newer API and tell them what to do if its missing
|
||||||
checkForOutdatedAPI();
|
checkForOutdatedAPI();
|
||||||
|
|
||||||
if(serverAPIOutdated)
|
if (serverAPIOutdated)
|
||||||
{
|
{
|
||||||
foliaLib
|
foliaLib
|
||||||
.getImpl()
|
.getImpl()
|
||||||
@ -237,7 +237,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
20, 20*60*30
|
20, 20*60*30
|
||||||
);
|
);
|
||||||
|
|
||||||
if(platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
|
if (platformManager.getServerSoftware() == ServerSoftwareType.CRAFT_BUKKIT)
|
||||||
{
|
{
|
||||||
foliaLib
|
foliaLib
|
||||||
.getImpl()
|
.getImpl()
|
||||||
@ -280,11 +280,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
//If anonymous statistics are enabled then use them
|
//If anonymous statistics are enabled then use them
|
||||||
Metrics metrics;
|
Metrics metrics;
|
||||||
|
|
||||||
if(generalConfig.getIsMetricsEnabled()) {
|
if (generalConfig.getIsMetricsEnabled()) {
|
||||||
metrics = new Metrics(this, 3894);
|
metrics = new Metrics(this, 3894);
|
||||||
metrics.addCustomChart(new SimplePie("version", () -> getDescription().getVersion()));
|
metrics.addCustomChart(new SimplePie("version", () -> getDescription().getVersion()));
|
||||||
|
|
||||||
if(generalConfig.getIsRetroMode())
|
if (generalConfig.getIsRetroMode())
|
||||||
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Retro"));
|
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Retro"));
|
||||||
else
|
else
|
||||||
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
|
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
|
||||||
@ -323,7 +323,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
transientEntityTracker = new TransientEntityTracker();
|
transientEntityTracker = new TransientEntityTracker();
|
||||||
setServerShutdown(false); //Reset flag, used to make decisions about async saves
|
setServerShutdown(false); //Reset flag, used to make decisions about async saves
|
||||||
|
|
||||||
if(Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
new PapiExpansion().register();
|
new PapiExpansion().register();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,7 +351,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
@Override
|
@Override
|
||||||
public void onLoad()
|
public void onLoad()
|
||||||
{
|
{
|
||||||
if(getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
|
||||||
WorldGuardManager.getInstance().registerFlags();
|
WorldGuardManager.getInstance().registerFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -372,11 +372,11 @@ public class mcMMO extends JavaPlugin {
|
|||||||
UserManager.saveAll(); // Make sure to save player information if the server shuts down
|
UserManager.saveAll(); // Make sure to save player information if the server shuts down
|
||||||
UserManager.clearAll();
|
UserManager.clearAll();
|
||||||
Alchemy.finishAllBrews(); // Finish all partially complete AlchemyBrewTasks to prevent vanilla brewing continuation on restart
|
Alchemy.finishAllBrews(); // Finish all partially complete AlchemyBrewTasks to prevent vanilla brewing continuation on restart
|
||||||
if(partyConfig.isPartyEnabled())
|
if (partyConfig.isPartyEnabled())
|
||||||
getPartyManager().saveParties(); // Save our parties
|
getPartyManager().saveParties(); // Save our parties
|
||||||
|
|
||||||
//TODO: Needed?
|
//TODO: Needed?
|
||||||
if(generalConfig.getScoreboardsEnabled())
|
if (generalConfig.getScoreboardsEnabled())
|
||||||
ScoreboardManager.teardownAll();
|
ScoreboardManager.teardownAll();
|
||||||
|
|
||||||
formulaManager.saveFormula();
|
formulaManager.saveFormula();
|
||||||
@ -615,7 +615,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
InteractionManager.initMaps(); //Init maps
|
InteractionManager.initMaps(); //Init maps
|
||||||
|
|
||||||
if(CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS))
|
if (CoreSkillsConfig.getInstance().isPrimarySkillEnabled(PrimarySkillType.ACROBATICS))
|
||||||
{
|
{
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "Enabling Acrobatics Skills");
|
LogUtils.debug(mcMMO.p.getLogger(), "Enabling Acrobatics Skills");
|
||||||
|
|
||||||
@ -657,7 +657,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Automatically remove old members from parties
|
// Automatically remove old members from parties
|
||||||
if(partyConfig.isPartyEnabled()) {
|
if (partyConfig.isPartyEnabled()) {
|
||||||
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
long kickIntervalTicks = generalConfig.getAutoPartyKickInterval() * 60L * 60L * Misc.TICK_CONVERSION_FACTOR;
|
||||||
|
|
||||||
if (kickIntervalTicks == 0) {
|
if (kickIntervalTicks == 0) {
|
||||||
@ -675,7 +675,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
getFoliaLib().getImpl().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
|
getFoliaLib().getImpl().runTimer(new ClearRegisteredXPGainTask(), 60, 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getAdvancedConfig().allowPlayerTips())
|
if (mcMMO.p.getAdvancedConfig().allowPlayerTips())
|
||||||
{
|
{
|
||||||
getFoliaLib().getImpl().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
|
getFoliaLib().getImpl().runTimer(new NotifySquelchReminderTask(), 60, ((20 * 60) * 60));
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ public final class PartyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
final McMMOPlayer mmoPlayer = UserManager.getPlayer(player);
|
||||||
if(mmoPlayer == null)
|
if (mmoPlayer == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return mmoPlayer.getParty();
|
return mmoPlayer.getParty();
|
||||||
|
@ -51,7 +51,7 @@ public final class ShareHandler {
|
|||||||
|
|
||||||
for (Player member : nearMembers) {
|
for (Player member : nearMembers) {
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(member) == null)
|
if (UserManager.getPlayer(member) == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ public final class ShareHandler {
|
|||||||
McMMOPlayer mcMMOMember = UserManager.getPlayer(member);
|
McMMOPlayer mcMMOMember = UserManager.getPlayer(member);
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(member) == null)
|
if (UserManager.getPlayer(member) == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public class MobDodgeMetaCleanup extends CancellableRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(!mob.isValid() || mob.getTarget() == null) {
|
if (!mob.isValid() || mob.getTarget() == null) {
|
||||||
mob.removeMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, pluginRef);
|
mob.removeMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, pluginRef);
|
||||||
this.cancel();
|
this.cancel();
|
||||||
} else if (!mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER)) {
|
} else if (!mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER)) {
|
||||||
|
@ -19,7 +19,7 @@ public class SaveTimerTask extends CancellableRunnable {
|
|||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMO.p.getPartyConfig().isPartyEnabled())
|
if (mcMMO.p.getPartyConfig().isPartyEnabled())
|
||||||
mcMMO.p.getPartyManager().saveParties();
|
mcMMO.p.getPartyManager().saveParties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ public class TravelingBlockMetaCleanup extends CancellableRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(!entity.isValid()) {
|
if (!entity.isValid()) {
|
||||||
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
|
entity.removeMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK, pluginRef);
|
||||||
this.cancel();
|
this.cancel();
|
||||||
} else if (!entity.hasMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK)) {
|
} else if (!entity.hasMetadata(MetadataConstants.METADATA_KEY_TRAVELING_BLOCK)) {
|
||||||
|
@ -45,14 +45,14 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
|
|||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
((Player) sender).removeMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND, mcMMO.p);
|
((Player) sender).removeMetadata(MetadataConstants.METADATA_KEY_DATABASE_COMMAND, mcMMO.p);
|
||||||
}
|
}
|
||||||
if(sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
sender.sendMessage(LocaleLoader.getString("Commands.mctop.Tip"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayChat() {
|
private void displayChat() {
|
||||||
|
|
||||||
if (skill == null) {
|
if (skill == null) {
|
||||||
if(sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
sender.sendMessage(LocaleLoader.getString("Commands.PowerLevel.Leaderboard"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -60,7 +60,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
sender.sendMessage(LocaleLoader.getString("Commands.Skill.Leaderboard", mcMMO.p.getSkillTools().getLocalizedSkillName(skill)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -74,7 +74,7 @@ public class MctopCommandDisplayTask extends CancellableRunnable {
|
|||||||
// Format:
|
// Format:
|
||||||
// 01. Playername - skill value
|
// 01. Playername - skill value
|
||||||
// 12. Playername - skill value
|
// 12. Playername - skill value
|
||||||
if(sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
|
sender.sendMessage(String.format("%2d. %s%s - %s%s", place, ChatColor.GREEN, stat.name, ChatColor.WHITE, stat.statVal));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -11,9 +11,9 @@ public class NotifySquelchReminderTask extends CancellableRunnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if(UserManager.getPlayer(player) != null)
|
if (UserManager.getPlayer(player) != null)
|
||||||
{
|
{
|
||||||
if(!UserManager.getPlayer(player).useChatNotifications())
|
if (!UserManager.getPlayer(player).useChatNotifications())
|
||||||
{
|
{
|
||||||
player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
|
player.sendMessage(LocaleLoader.getString("Reminder.Squelched"));
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public class PlayerProfileLoadingTask extends CancellableRunnable {
|
|||||||
|
|
||||||
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player);
|
PlayerProfile profile = mcMMO.getDatabaseManager().loadPlayerProfile(player);
|
||||||
|
|
||||||
if(!profile.isLoaded()) {
|
if (!profile.isLoaded()) {
|
||||||
LogUtils.debug(mcMMO.p.getLogger(), "Creating new data for player: "+player.getName());
|
LogUtils.debug(mcMMO.p.getLogger(), "Creating new data for player: "+player.getName());
|
||||||
//Profile isn't loaded so add as new user
|
//Profile isn't loaded so add as new user
|
||||||
profile = mcMMO.getDatabaseManager().newUser(player);
|
profile = mcMMO.getDatabaseManager().newUser(player);
|
||||||
|
@ -62,7 +62,7 @@ public class AbilityDisableTask extends CancellableRunnable {
|
|||||||
if (mcMMO.p.getAdvancedConfig().sendAbilityNotificationToOtherPlayers()) {
|
if (mcMMO.p.getAdvancedConfig().sendAbilityNotificationToOtherPlayers()) {
|
||||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
||||||
}
|
}
|
||||||
if(!mcMMO.isServerShutdownExecuted()) {
|
if (!mcMMO.isServerShutdownExecuted()) {
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityCooldownTask(mcMMOPlayer, ability), (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class AwardCombatXpTask extends CancellableRunnable {
|
|||||||
damage += health;
|
damage += health;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ExperienceConfig.getInstance().useCombatHPCeiling()) {
|
if (ExperienceConfig.getInstance().useCombatHPCeiling()) {
|
||||||
damage = Math.min(damage, ExperienceConfig.getInstance().getCombatHPCeiling());
|
damage = Math.min(damage, ExperienceConfig.getInstance().getCombatHPCeiling());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
//// debugMessage+="RemainingTicks=["+containerEntry.getValue().bleedTicks+"], ";
|
//// debugMessage+="RemainingTicks=["+containerEntry.getValue().bleedTicks+"], ";
|
||||||
//
|
//
|
||||||
// if (containerEntry.getValue().bleedTicks <= 0 || !target.isValid()) {
|
// if (containerEntry.getValue().bleedTicks <= 0 || !target.isValid()) {
|
||||||
// if(target instanceof Player)
|
// if (target instanceof Player)
|
||||||
// {
|
// {
|
||||||
// NotificationManager.sendPlayerInformation((Player) target, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Stopped");
|
// NotificationManager.sendPlayerInformation((Player) target, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Bleeding.Stopped");
|
||||||
// }
|
// }
|
||||||
@ -96,7 +96,7 @@
|
|||||||
//
|
//
|
||||||
//// debugMessage+="FullArmor=["+String.valueOf(armorCount > 3)+"], ";
|
//// debugMessage+="FullArmor=["+String.valueOf(armorCount > 3)+"], ";
|
||||||
//
|
//
|
||||||
// if(armorCount > 3)
|
// if (armorCount > 3)
|
||||||
// {
|
// {
|
||||||
// damage = damage * .75;
|
// damage = damage * .75;
|
||||||
// }
|
// }
|
||||||
@ -104,13 +104,13 @@
|
|||||||
//// debugMessage+="AfterRankAndArmorChecks["+damage+"], ";
|
//// debugMessage+="AfterRankAndArmorChecks["+damage+"], ";
|
||||||
//
|
//
|
||||||
// //Weapons below Diamond get damage cut in half
|
// //Weapons below Diamond get damage cut in half
|
||||||
// if(toolTier < 4)
|
// if (toolTier < 4)
|
||||||
// damage = damage / 2;
|
// damage = damage / 2;
|
||||||
//
|
//
|
||||||
//// debugMessage+="AfterDiamondCheck=["+String.valueOf(damage)+"], ";
|
//// debugMessage+="AfterDiamondCheck=["+String.valueOf(damage)+"], ";
|
||||||
//
|
//
|
||||||
// //Wood weapons get damage cut in half again
|
// //Wood weapons get damage cut in half again
|
||||||
// if(toolTier < 2)
|
// if (toolTier < 2)
|
||||||
// damage = damage / 2;
|
// damage = damage / 2;
|
||||||
//
|
//
|
||||||
//// debugMessage+="AfterWoodenCheck=["+String.valueOf(damage)+"], ";
|
//// debugMessage+="AfterWoodenCheck=["+String.valueOf(damage)+"], ";
|
||||||
@ -129,7 +129,7 @@
|
|||||||
//
|
//
|
||||||
//// debugMessage+="TargetHealthAfterDMG=["+String.valueOf(target.getHealth())+"], ";
|
//// debugMessage+="TargetHealthAfterDMG=["+String.valueOf(target.getHealth())+"], ";
|
||||||
//
|
//
|
||||||
// if(victimHealthAftermath <= 0 || victimHealth != victimHealthAftermath)
|
// if (victimHealthAftermath <= 0 || victimHealth != victimHealthAftermath)
|
||||||
// {
|
// {
|
||||||
// //Play Bleed Sound
|
// //Play Bleed Sound
|
||||||
// SoundManager.worldSendSound(target.getWorld(), target.getLocation(), SoundType.BLEED);
|
// SoundManager.worldSendSound(target.getWorld(), target.getLocation(), SoundType.BLEED);
|
||||||
@ -187,7 +187,7 @@
|
|||||||
// throw new IllegalStateException("Cannot add bleed task async!");
|
// throw new IllegalStateException("Cannot add bleed task async!");
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// if(isIterating) {
|
// if (isIterating) {
|
||||||
// //Used to throw an error here, but in reality all we are really doing is preventing concurrency issues from other plugins being naughty and its not really needed
|
// //Used to throw an error here, but in reality all we are really doing is preventing concurrency issues from other plugins being naughty and its not really needed
|
||||||
// //I'm not really a fan of silent errors, but I'm sick of seeing people using crazy enchantments come in and report this "bug"
|
// //I'm not really a fan of silent errors, but I'm sick of seeing people using crazy enchantments come in and report this "bug"
|
||||||
// return;
|
// return;
|
||||||
@ -195,7 +195,7 @@
|
|||||||
//
|
//
|
||||||
//// if (isIterating) throw new IllegalStateException("Cannot add task while iterating timers!");
|
//// if (isIterating) throw new IllegalStateException("Cannot add task while iterating timers!");
|
||||||
//
|
//
|
||||||
// if(toolTier < 4)
|
// if (toolTier < 4)
|
||||||
// ticks = Math.max(1, (ticks / 3));
|
// ticks = Math.max(1, (ticks / 3));
|
||||||
//
|
//
|
||||||
// ticks+=1;
|
// ticks+=1;
|
||||||
|
@ -35,7 +35,7 @@ public class DelayedCropReplant extends CancellableRunnable {
|
|||||||
public DelayedCropReplant(BlockBreakEvent blockBreakEvent, BlockState cropState, int desiredCropAge, boolean wasImmaturePlant) {
|
public DelayedCropReplant(BlockBreakEvent blockBreakEvent, BlockState cropState, int desiredCropAge, boolean wasImmaturePlant) {
|
||||||
BlockData cropData = cropState.getBlockData();
|
BlockData cropData = cropState.getBlockData();
|
||||||
|
|
||||||
if(cropData instanceof Directional cropDir) {
|
if (cropData instanceof Directional cropDir) {
|
||||||
cropFace = cropDir.getFacing();
|
cropFace = cropDir.getFacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,13 +56,13 @@ public class DelayedCropReplant extends CancellableRunnable {
|
|||||||
//Remove the metadata marking the block as recently replanted
|
//Remove the metadata marking the block as recently replanted
|
||||||
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
|
mcMMO.p.getFoliaLib().getImpl().runAtLocationLater(blockBreakEvent.getBlock().getLocation(), new markPlantAsOld(blockBreakEvent.getBlock().getLocation()), 10);
|
||||||
|
|
||||||
if(blockBreakEvent.isCancelled()) {
|
if (blockBreakEvent.isCancelled()) {
|
||||||
wasImmaturePlant = true;
|
wasImmaturePlant = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Two kinds of air in Minecraft
|
//Two kinds of air in Minecraft
|
||||||
if(currentState.getType().equals(cropMaterial) || currentState.getType().equals(Material.AIR) || currentState.getType().equals(Material.CAVE_AIR)) {
|
if (currentState.getType().equals(cropMaterial) || currentState.getType().equals(Material.AIR) || currentState.getType().equals(Material.CAVE_AIR)) {
|
||||||
// if(currentState.getBlock().getRelative(BlockFace.DOWN))
|
// if (currentState.getBlock().getRelative(BlockFace.DOWN))
|
||||||
//The space is not currently occupied by a block so we can fill it
|
//The space is not currently occupied by a block so we can fill it
|
||||||
cropBlock.setType(cropMaterial);
|
cropBlock.setType(cropMaterial);
|
||||||
|
|
||||||
@ -74,19 +74,19 @@ public class DelayedCropReplant extends CancellableRunnable {
|
|||||||
int age = 0;
|
int age = 0;
|
||||||
|
|
||||||
//Crop age should always be 0 if the plant was immature
|
//Crop age should always be 0 if the plant was immature
|
||||||
if(!wasImmaturePlant) {
|
if (!wasImmaturePlant) {
|
||||||
age = desiredCropAge;
|
age = desiredCropAge;
|
||||||
//Otherwise make the plant the desired age
|
//Otherwise make the plant the desired age
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newData instanceof Directional) {
|
if (newData instanceof Directional) {
|
||||||
//Cocoa Version
|
//Cocoa Version
|
||||||
Directional directional = (Directional) newState.getBlockData();
|
Directional directional = (Directional) newState.getBlockData();
|
||||||
directional.setFacing(cropFace);
|
directional.setFacing(cropFace);
|
||||||
|
|
||||||
newState.setBlockData(directional);
|
newState.setBlockData(directional);
|
||||||
|
|
||||||
if(newData instanceof Cocoa) {
|
if (newData instanceof Cocoa) {
|
||||||
plantAnchorType = PlantAnchorType.COCOA;
|
plantAnchorType = PlantAnchorType.COCOA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -119,7 +119,7 @@ public class DelayedCropReplant extends CancellableRunnable {
|
|||||||
this.plantBlock = plantBlock;
|
this.plantBlock = plantBlock;
|
||||||
this.plantAnchorType = plantAnchorType;
|
this.plantAnchorType = plantAnchorType;
|
||||||
|
|
||||||
if(plantFace != null) {
|
if (plantFace != null) {
|
||||||
this.plantFace = plantFace;
|
this.plantFace = plantFace;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,8 +140,8 @@ public class DelayedCropReplant extends CancellableRunnable {
|
|||||||
private void checkPlantIntegrity(@NotNull BlockFace blockFace) {
|
private void checkPlantIntegrity(@NotNull BlockFace blockFace) {
|
||||||
Block neighbor = plantBlock.getRelative(blockFace);
|
Block neighbor = plantBlock.getRelative(blockFace);
|
||||||
|
|
||||||
if(plantAnchorType == PlantAnchorType.COCOA) {
|
if (plantAnchorType == PlantAnchorType.COCOA) {
|
||||||
if(!neighbor.getType().toString().toLowerCase().contains("jungle")) {
|
if (!neighbor.getType().toString().toLowerCase().contains("jungle")) {
|
||||||
plantBlock.breakNaturally();
|
plantBlock.breakNaturally();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -171,7 +171,7 @@ public class DelayedCropReplant extends CancellableRunnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Block cropBlock = cropLoc.getBlock();
|
Block cropBlock = cropLoc.getBlock();
|
||||||
if(cropBlock.getMetadata(MetadataConstants.METADATA_KEY_REPLANT).size() > 0)
|
if (cropBlock.getMetadata(MetadataConstants.METADATA_KEY_REPLANT).size() > 0)
|
||||||
cropBlock.setMetadata(MetadataConstants.METADATA_KEY_REPLANT, new RecentlyReplantedCropMeta(mcMMO.p, false));
|
cropBlock.setMetadata(MetadataConstants.METADATA_KEY_REPLANT, new RecentlyReplantedCropMeta(mcMMO.p, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public class ExperienceBarHideTask extends CancellableRunnable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if(experienceBarManagerRef == null || mcMMOPlayer == null)
|
if (experienceBarManagerRef == null || mcMMOPlayer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
experienceBarManagerRef.hideExperienceBar(primarySkillType);
|
experienceBarManagerRef.hideExperienceBar(primarySkillType);
|
||||||
|
@ -42,15 +42,15 @@ public class RuptureTask extends CancellableRunnable {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
//Check validity
|
//Check validity
|
||||||
if(targetEntity.isValid()) {
|
if (targetEntity.isValid()) {
|
||||||
ruptureTick += 1; //Advance rupture tick by 1.
|
ruptureTick += 1; //Advance rupture tick by 1.
|
||||||
damageTickTracker += 1; //Increment damage tick tracker
|
damageTickTracker += 1; //Increment damage tick tracker
|
||||||
|
|
||||||
//TODO: Clean this code up, applyRupture() is a confusing name for something that returns boolean
|
//TODO: Clean this code up, applyRupture() is a confusing name for something that returns boolean
|
||||||
//Rupture hasn't ended yet
|
//Rupture hasn't ended yet
|
||||||
if(ruptureTick < expireTick) {
|
if (ruptureTick < expireTick) {
|
||||||
//Is it time to damage?
|
//Is it time to damage?
|
||||||
if(damageTickTracker >= DAMAGE_TICK_INTERVAL) {
|
if (damageTickTracker >= DAMAGE_TICK_INTERVAL) {
|
||||||
|
|
||||||
damageTickTracker = 0; //Reset timer
|
damageTickTracker = 0; //Reset timer
|
||||||
if (applyRupture()) return;
|
if (applyRupture()) return;
|
||||||
@ -58,7 +58,7 @@ public class RuptureTask extends CancellableRunnable {
|
|||||||
playAnimation();
|
playAnimation();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!applyRupture()) {
|
if (!applyRupture()) {
|
||||||
playAnimation();
|
playAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ public class RuptureTask extends CancellableRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void playAnimation() {
|
private void playAnimation() {
|
||||||
if(animationTick >= ANIMATION_TICK_INTERVAL) {
|
if (animationTick >= ANIMATION_TICK_INTERVAL) {
|
||||||
ParticleEffectUtils.playBleedEffect(targetEntity); //Animate
|
ParticleEffectUtils.playBleedEffect(targetEntity); //Animate
|
||||||
animationTick = 0;
|
animationTick = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -114,7 +114,7 @@ public class RuptureTask extends CancellableRunnable {
|
|||||||
//
|
//
|
||||||
// ParticleEffectUtils.playGreaterImpactEffect(targetEntity); //Animate
|
// ParticleEffectUtils.playGreaterImpactEffect(targetEntity); //Animate
|
||||||
//
|
//
|
||||||
// if(ruptureSource.getPlayer() != null && ruptureSource.getPlayer().isValid()) {
|
// if (ruptureSource.getPlayer() != null && ruptureSource.getPlayer().isValid()) {
|
||||||
// targetEntity.damage(getExplosionDamage(), ruptureSource.getPlayer());
|
// targetEntity.damage(getExplosionDamage(), ruptureSource.getPlayer());
|
||||||
// } else {
|
// } else {
|
||||||
// targetEntity.damage(getExplosionDamage(), null);
|
// targetEntity.damage(getExplosionDamage(), null);
|
||||||
@ -129,10 +129,10 @@ public class RuptureTask extends CancellableRunnable {
|
|||||||
private double calculateAdjustedTickDamage() {
|
private double calculateAdjustedTickDamage() {
|
||||||
double tickDamage = pureTickDamage;
|
double tickDamage = pureTickDamage;
|
||||||
|
|
||||||
if(targetEntity.getHealth() <= tickDamage) {
|
if (targetEntity.getHealth() <= tickDamage) {
|
||||||
tickDamage = targetEntity.getHealth() - 0.01;
|
tickDamage = targetEntity.getHealth() - 0.01;
|
||||||
|
|
||||||
if(tickDamage <= 0) {
|
if (tickDamage <= 0) {
|
||||||
tickDamage = 0;
|
tickDamage = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,10 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
|
|
||||||
public boolean canGainRollXP()
|
public boolean canGainRollXP()
|
||||||
{
|
{
|
||||||
if(!ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented())
|
if (!ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(System.currentTimeMillis() >= rollXPCooldown)
|
if (System.currentTimeMillis() >= rollXPCooldown)
|
||||||
{
|
{
|
||||||
rollXPCooldown = System.currentTimeMillis() + rollXPInterval;
|
rollXPCooldown = System.currentTimeMillis() + rollXPInterval;
|
||||||
rollXPIntervalLengthen = (1000 * 10); //5 Seconds
|
rollXPIntervalLengthen = (1000 * 10); //5 Seconds
|
||||||
@ -67,10 +67,10 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDodge(Entity damager) {
|
public boolean canDodge(Entity damager) {
|
||||||
if(getPlayer().isBlocking())
|
if (getPlayer().isBlocking())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ACROBATICS_DODGE))
|
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ACROBATICS_DODGE))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ACROBATICS_DODGE)) {
|
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ACROBATICS_DODGE)) {
|
||||||
@ -103,14 +103,14 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SkillUtils.cooldownExpired(mmoPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
if (SkillUtils.cooldownExpired(mmoPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
||||||
if(attacker instanceof Mob mob) {
|
if (attacker instanceof Mob mob) {
|
||||||
//Check to see how many dodge XP rewards this mob has handed out
|
//Check to see how many dodge XP rewards this mob has handed out
|
||||||
if(mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER) && ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented()) {
|
if (mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER) && ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented()) {
|
||||||
//If Dodge XP has been handed out 5 times then consider it being exploited
|
//If Dodge XP has been handed out 5 times then consider it being exploited
|
||||||
MetadataValue metadataValue = mob.getMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER).get(0);
|
MetadataValue metadataValue = mob.getMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER).get(0);
|
||||||
int count = metadataValue.asInt();
|
int count = metadataValue.asInt();
|
||||||
|
|
||||||
if(count <= 5) {
|
if (count <= 5) {
|
||||||
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
applyXpGain((float) (damage * Acrobatics.dodgeXpModifier), XPGainReason.PVE);
|
||||||
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
|
mob.setMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER, new FixedMetadataValue(mcMMO.p, count + 1));
|
||||||
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);
|
MobDodgeMetaCleanup metaCleanupTask = new MobDodgeMetaCleanup(mob, mcMMO.p);
|
||||||
|
@ -85,7 +85,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void removeIngredient(BrewerInventory inventory, Player player) {
|
private static void removeIngredient(BrewerInventory inventory, Player player) {
|
||||||
if(inventory.getIngredient() == null)
|
if (inventory.getIngredient() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemStack ingredient = inventory.getIngredient().clone();
|
ItemStack ingredient = inventory.getIngredient().clone();
|
||||||
@ -137,7 +137,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static List<ItemStack> getValidIngredients(@Nullable McMMOPlayer mmoPlayer) {
|
private static List<ItemStack> getValidIngredients(@Nullable McMMOPlayer mmoPlayer) {
|
||||||
if(mmoPlayer == null) {
|
if (mmoPlayer == null) {
|
||||||
return mcMMO.p.getPotionConfig().getIngredients(1);
|
return mcMMO.p.getPotionConfig().getIngredients(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,7 +202,7 @@ public final class AlchemyPotionBrewer {
|
|||||||
|
|
||||||
// Update the brewing inventory with the new potions
|
// Update the brewing inventory with the new potions
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
if(outputList.get(i) != null) {
|
if (outputList.get(i) != null) {
|
||||||
inventory.setItem(i, outputList.get(i));
|
inventory.setItem(i, outputList.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,21 +27,21 @@ public class ArcheryManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canDaze(LivingEntity target) {
|
public boolean canDaze(LivingEntity target) {
|
||||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_DAZE))
|
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_DAZE))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return target instanceof Player && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_DAZE);
|
return target instanceof Player && Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_DAZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSkillShot() {
|
public boolean canSkillShot() {
|
||||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT))
|
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT);
|
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_SKILL_SHOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRetrieveArrows() {
|
public boolean canRetrieveArrows() {
|
||||||
if(!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL))
|
if (!RankUtils.hasUnlockedSubskill(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
return Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.ARCHERY_ARROW_RETRIEVAL);
|
||||||
@ -55,13 +55,13 @@ public class ArcheryManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
public static double distanceXpBonusMultiplier(LivingEntity target, Entity arrow) {
|
public static double distanceXpBonusMultiplier(LivingEntity target, Entity arrow) {
|
||||||
//Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires
|
//Hacky Fix - some plugins spawn arrows and assign them to players after the ProjectileLaunchEvent fires
|
||||||
if(!arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE))
|
if (!arrow.hasMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
Location firedLocation = (Location) arrow.getMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE).get(0).value();
|
Location firedLocation = (Location) arrow.getMetadata(MetadataConstants.METADATA_KEY_ARROW_DISTANCE).get(0).value();
|
||||||
Location targetLocation = target.getLocation();
|
Location targetLocation = target.getLocation();
|
||||||
|
|
||||||
if(firedLocation == null || firedLocation.getWorld() == null)
|
if (firedLocation == null || firedLocation.getWorld() == null)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (firedLocation.getWorld() != targetLocation.getWorld()) {
|
if (firedLocation.getWorld() != targetLocation.getWorld()) {
|
||||||
@ -77,7 +77,7 @@ public class ArcheryManager extends SkillManager {
|
|||||||
* @param target The {@link LivingEntity} damaged by the arrow
|
* @param target The {@link LivingEntity} damaged by the arrow
|
||||||
*/
|
*/
|
||||||
public void retrieveArrows(LivingEntity target, Projectile projectile) {
|
public void retrieveArrows(LivingEntity target, Projectile projectile) {
|
||||||
if(projectile.hasMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW)) {
|
if (projectile.hasMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW)) {
|
||||||
Archery.incrementTrackerValue(target);
|
Archery.incrementTrackerValue(target);
|
||||||
projectile.removeMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW, mcMMO.p); //Only 1 entity per projectile
|
projectile.removeMetadata(MetadataConstants.METADATA_KEY_TRACKED_ARROW, mcMMO.p); //Only 1 entity per projectile
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user