remove unimplemented features, fix tests again, and optimize imports

This commit is contained in:
nossr50 2024-03-30 05:05:28 -07:00
parent ef3887a720
commit bf901a0a34
38 changed files with 73 additions and 231 deletions

View File

@ -5,10 +5,8 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.party.PartyLeader;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.NotificationManager;
import com.gmail.nossr50.util.player.UserManager;
import jdk.jfr.Experimental;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.Nullable;

View File

@ -11,7 +11,6 @@ import com.gmail.nossr50.datatypes.chat.ChatChannel;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.text.StringUtils;
import org.bukkit.entity.Player;

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.OfflinePlayer;

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;

View File

@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;

View File

@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.party.ShareMode;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.OfflinePlayer;

View File

@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;

View File

@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.party.McMMOPartyChangeEvent.EventReason;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.commands.party.alliance;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;

View File

@ -5,7 +5,6 @@ import com.gmail.nossr50.datatypes.party.PartyFeature;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import com.google.common.collect.ImmutableList;

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.commands.CommandUtils;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.command.Command;

View File

@ -7,7 +7,6 @@ import com.gmail.nossr50.datatypes.party.PartyTeleportRecord;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.items.TeleportationWarmup;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;

View File

@ -6,7 +6,6 @@ import com.gmail.nossr50.datatypes.experience.FormulaType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;
import com.gmail.nossr50.util.sounds.SoundManager;

View File

@ -20,12 +20,9 @@ import com.gmail.nossr50.datatypes.skills.ToolType;
import com.gmail.nossr50.events.experience.McMMOPlayerPreXpGainEvent;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.party.ShareHandler;
import com.gmail.nossr50.runnables.skills.AbilityCooldownTask;
import com.gmail.nossr50.runnables.skills.AbilityDisableTask;
import com.gmail.nossr50.runnables.skills.ToolLowerTask;
import com.gmail.nossr50.skills.AlternateFiringSuperSkill;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.alchemy.AlchemyManager;
@ -964,72 +961,6 @@ public class McMMOPlayer implements Identified {
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(player, new AbilityDisableTask(this, superAbilityType), (long) ticks * Misc.TICK_CONVERSION_FACTOR);
}
public void checkCrossbowAbilityActivation() {
PrimarySkillType primarySkillType = PrimarySkillType.CROSSBOWS;
ToolType tool = ToolType.CROSSBOW;
SuperAbilityType superAbilityType = SuperAbilityType.SUPER_SHOTGUN;
SubSkillType subSkillType = SubSkillType.CROSSBOWS_SUPER_SHOTGUN;
AlternateFiringSuperSkill skillManager = getCrossbowsManager();
// Check permission
if (!superAbilityType.getPermissions(player)) {
return;
}
//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)
if(!RankUtils.hasUnlockedSubskill(player, subSkillType))
{
int diff = RankUtils.getSuperAbilityUnlockRequirement(superAbilityType) - getSkillLevel(primarySkillType);
//Inform the player they are not yet skilled enough
NotificationManager.sendPlayerInformation(player,
NotificationType.ABILITY_COOLDOWN,
"Skills.AbilityGateRequirementFail",
String.valueOf(diff),
mcMMO.p.getSkillTools().getLocalizedSkillName(primarySkillType));
return;
}
// Call the event
if (EventUtils.callPlayerAbilityActivateEvent(player, primarySkillType).isCancelled()) {
return;
}
// Check if we can fire the ability
if (!skillManager.isReadyToFire()) {
return;
}
if (useChatNotifications()) {
NotificationManager.sendPlayerInformation(player, NotificationType.SUPER_ABILITY, superAbilityType.getAbilityOn());
}
if (mcMMO.p.getAdvancedConfig().sendAbilityNotificationToOtherPlayers()) {
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, superAbilityType.getAbilityPlayer());
}
//Sounds
SoundManager.worldSendSound(player.getWorld(), player.getLocation(), SoundType.ABILITY_ACTIVATED_GENERIC);
// TODO: Fire the ability
profile.setAbilityDATS(superAbilityType, System.currentTimeMillis());
setToolPreparationMode(tool, false);
skillManager.resetCharge();
skillManager.fireSuper();
if(!mcMMO.isServerShutdownExecuted()) {
mcMMO.p.getFoliaLib().getImpl().runAtEntityLater(
player,
new AbilityCooldownTask(this, superAbilityType),
(long) PerksUtils.handleCooldownPerks(player, superAbilityType.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
}
}
public void chargeCrossbowSuper() {
getCrossbowsManager().chargeSuper();
}
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
if (!mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(getPlayer(), primarySkillType)) {
return;

View File

@ -22,7 +22,6 @@ public enum SubSkillType {
ARCHERY_DAZE,
ARCHERY_SKILL_SHOT(20),
ARCHERY_ARCHERY_LIMIT_BREAK(10),
ARCHERY_EXPLOSIVE_SHOT(1),
/* Axes */
AXES_ARMOR_IMPACT(20),
@ -33,7 +32,6 @@ public enum SubSkillType {
AXES_SKULL_SPLITTER(1),
/* CROSSBOWS */
CROSSBOWS_SUPER_SHOTGUN(1),
CROSSBOWS_CROSSBOWS_LIMIT_BREAK(10),
CROSSBOWS_TRICK_SHOT(3),
CROSSBOWS_POWERED_SHOT(20),
@ -101,7 +99,6 @@ public enum SubSkillType {
TAMING_THICK_FUR(1),
/* Tridents */
TRIDENTS_SUPER(1),
TRIDENTS_IMPALE(10),
TRIDENTS_TRIDENTS_LIMIT_BREAK(10),

View File

@ -112,8 +112,6 @@ public enum SuperAbilityType {
TREE_FELLER.subSkillTypeDefinition = SubSkillType.WOODCUTTING_TREE_FELLER;
SERRATED_STRIKES.subSkillTypeDefinition = SubSkillType.SWORDS_SERRATED_STRIKES;
BLAST_MINING.subSkillTypeDefinition = SubSkillType.MINING_BLAST_MINING;
TRIDENTS_SUPER_ABILITY.subSkillTypeDefinition = SubSkillType.TRIDENTS_SUPER;
SUPER_SHOTGUN.subSkillTypeDefinition = SubSkillType.CROSSBOWS_SUPER_SHOTGUN;
}
private final String abilityOn;

View File

@ -24,7 +24,6 @@ import com.gmail.nossr50.skills.taming.TamingManager;
import com.gmail.nossr50.util.*;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.scoreboards.ScoreboardManager;
import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.RankUtils;
import com.gmail.nossr50.util.skills.SkillUtils;
import com.gmail.nossr50.util.sounds.SoundManager;
@ -828,11 +827,6 @@ public class PlayerListener implements Listener {
mcMMOPlayer.processAbilityActivation(PrimarySkillType.HERBALISM);
}
// Projectile Skills
if (ItemUtils.isCrossbow(heldItem) || ItemUtils.isBow(heldItem)) {
CombatUtils.processProjectileSkillSuperAbilityActivation(mcMMOPlayer, heldItem);
}
mcMMOPlayer.processAbilityActivation(PrimarySkillType.AXES);
mcMMOPlayer.processAbilityActivation(PrimarySkillType.EXCAVATION);
mcMMOPlayer.processAbilityActivation(PrimarySkillType.MINING);
@ -904,11 +898,6 @@ public class PlayerListener implements Listener {
mcMMOPlayer.processAbilityActivation(PrimarySkillType.SWORDS);
mcMMOPlayer.processAbilityActivation(PrimarySkillType.UNARMED);
mcMMOPlayer.processAbilityActivation(PrimarySkillType.WOODCUTTING);
// Projectile Skills
if (ItemUtils.isCrossbow(heldItem) || ItemUtils.isBow(heldItem)) {
CombatUtils.processProjectileSkillSuperAbilityActivation(mcMMOPlayer, heldItem);
}
}
/* ITEM CHECKS */
@ -929,11 +918,6 @@ public class PlayerListener implements Listener {
break;
}
// Check charge up supers (crossbows, etc...)
if (ItemUtils.isCrossbow(heldItem)) {
mcMMOPlayer.chargeCrossbowSuper();
}
/* CALL OF THE WILD CHECKS */
Material type = heldItem.getType();
TamingManager tamingManager = mcMMOPlayer.getTamingManager();

View File

@ -55,12 +55,22 @@ public final class PartyManager {
* @return true if party is full and cannot be joined
*/
public boolean isPartyFull(@NotNull Player player, @NotNull Party targetParty) {
requireNonNull(player, "player cannot be null!");
requireNonNull(targetParty, "targetParty cannot be null!");
return !Permissions.partySizeBypass(player) && pluginRef.getGeneralConfig().getPartyMaxSize() >= 1 && targetParty.getOnlineMembers().size() >= pluginRef.getGeneralConfig().getPartyMaxSize();
}
public boolean areAllies(@NotNull Player firstPlayer, @NotNull Player secondPlayer) {
//Profile is not loaded
if (UserManager.getPlayer(firstPlayer) == null || UserManager.getPlayer(secondPlayer) == null) {
requireNonNull(firstPlayer, "firstPlayer cannot be null!");
requireNonNull(secondPlayer, "secondPlayer cannot be null!");
//Profile not loaded
if (UserManager.getPlayer(firstPlayer) == null) {
return false;
}
//Profile not loaded
if (UserManager.getPlayer(secondPlayer) == null) {
return false;
}
@ -100,6 +110,7 @@ public final class PartyManager {
}
public @NotNull List<Player> getNearVisibleMembers(@NotNull McMMOPlayer mmoPlayer) {
requireNonNull(mmoPlayer, "mmoPlayer cannot be null!");
List<Player> nearMembers = new ArrayList<>();
Party party = mmoPlayer.getParty();
@ -126,6 +137,7 @@ public final class PartyManager {
* @return all the players in the player's party
*/
public @NotNull LinkedHashMap<UUID, String> getAllMembers(@NotNull Player player) {
requireNonNull(player, "player cannot be null!");
Party party = getParty(player);
return party == null ? new LinkedHashMap<>() : party.getMembers();
@ -138,6 +150,7 @@ public final class PartyManager {
* @return all online players in this party
*/
public @NotNull List<Player> getOnlineMembers(@NotNull String partyName) {
requireNonNull(partyName, "partyName cannot be null!");
return getOnlineMembers(getParty(partyName));
}
@ -148,6 +161,7 @@ public final class PartyManager {
* @return all online players in this party
*/
public @NotNull List<Player> getOnlineMembers(@NotNull Player player) {
requireNonNull(player, "player cannot be null!");
return getOnlineMembers(getParty(player));
}
@ -162,6 +176,7 @@ public final class PartyManager {
* @return the existing party, null otherwise
*/
public @Nullable Party getParty(@NotNull String partyName) {
requireNonNull(partyName, "partyName cannot be null!");
for (Party party : parties) {
if (party.getName().equalsIgnoreCase(partyName)) {
return party;
@ -179,6 +194,7 @@ public final class PartyManager {
*/
@Deprecated
public @Nullable Party getPlayerParty(@NotNull String playerName) {
requireNonNull(playerName, "playerName cannot be null!");
for (Party party : parties) {
if (party.getMembers().containsValue(playerName)) {
return party;
@ -195,6 +211,8 @@ public final class PartyManager {
* @return the existing party, null otherwise
*/
public @Nullable Party getPlayerParty(@NotNull String playerName, @NotNull UUID uuid) {
requireNonNull(playerName, "playerName cannot be null!");
requireNonNull(uuid, "uuid cannot be null!");
for (Party party : parties) {
LinkedHashMap<UUID, String> members = party.getMembers();
if (members.containsKey(uuid) || members.containsValue(playerName)) {
@ -218,7 +236,8 @@ public final class PartyManager {
* @return the existing party, null otherwise
*/
public @Nullable Party getParty(@NotNull Player player) {
//Profile is not loaded
requireNonNull(player, "player cannot be null!");
//Profile not loaded
if (UserManager.getPlayer(player) == null) {
return null;
}
@ -246,6 +265,9 @@ public final class PartyManager {
* @param party The party
*/
public void removeFromParty(@NotNull OfflinePlayer player, @NotNull Party party) {
requireNonNull(player, "player cannot be null!");
requireNonNull(party, "party cannot be null!");
LinkedHashMap<UUID, String> members = party.getMembers();
String playerName = player.getName();
@ -273,6 +295,7 @@ public final class PartyManager {
* @param mcMMOPlayer The player to remove
*/
public void removeFromParty(@NotNull McMMOPlayer mcMMOPlayer) {
requireNonNull(mcMMOPlayer, "mcMMOPlayer cannot be null!");
if (mcMMOPlayer.getParty() == null) {
return;
}
@ -288,6 +311,7 @@ public final class PartyManager {
* @deprecated Use {@link #disbandParty(McMMOPlayer, Party)}
*/
public void disbandParty(@NotNull Party party) {
requireNonNull(party, "party cannot be null!");
disbandParty(null, party);
}
@ -298,6 +322,7 @@ public final class PartyManager {
* @param party The party to remove
*/
public void disbandParty(@Nullable McMMOPlayer mcMMOPlayer, @NotNull Party party) {
requireNonNull(party, "party cannot be null!");
//TODO: Potential issues with unloaded profile?
for (final Player member : party.getOnlineMembers()) {
//Profile not loaded
@ -379,6 +404,7 @@ public final class PartyManager {
* @param mcMMOPlayer The player to add to the party
*/
public void joinInvitedParty(@NotNull McMMOPlayer mcMMOPlayer) {
requireNonNull(mcMMOPlayer, "mcMMOPlayer cannot be null!");
Party invite = mcMMOPlayer.getPartyInvite();
// Check if the party still exists, it might have been disbanded
@ -406,6 +432,7 @@ public final class PartyManager {
* @param mcMMOPlayer The player who accepts the alliance invite
*/
public void acceptAllianceInvite(@NotNull McMMOPlayer mcMMOPlayer) {
requireNonNull(mcMMOPlayer, "mcMMOPlayer cannot be null!");
Party invite = mcMMOPlayer.getPartyAllianceInvite();
Player player = mcMMOPlayer.getPlayer();
@ -426,6 +453,9 @@ public final class PartyManager {
}
public void createAlliance(@NotNull Party firstParty, @NotNull Party secondParty) {
requireNonNull(firstParty, "firstParty cannot be null!");
requireNonNull(secondParty, "secondParty cannot be null!");
firstParty.setAlly(secondParty);
secondParty.setAlly(firstParty);
@ -439,6 +469,10 @@ public final class PartyManager {
}
public boolean disbandAlliance(@NotNull Player player, @NotNull Party firstParty, @NotNull Party secondParty) {
requireNonNull(player, "player cannot be null!");
requireNonNull(firstParty, "firstParty cannot be null!");
requireNonNull(secondParty, "secondParty cannot be null!");
if (!handlePartyChangeAllianceEvent(player, firstParty.getName(), secondParty.getName(), McMMOPartyAllianceChangeEvent.EventReason.DISBAND_ALLIANCE)) {
return false;
}
@ -448,6 +482,8 @@ public final class PartyManager {
}
private void disbandAlliance(@NotNull Party firstParty, @NotNull Party secondParty) {
requireNonNull(firstParty, "firstParty cannot be null!");
requireNonNull(secondParty, "secondParty cannot be null!");
firstParty.setAlly(null);
secondParty.setAlly(null);
@ -467,6 +503,9 @@ public final class PartyManager {
* @param party The party
*/
public void addToParty(@NotNull McMMOPlayer mcMMOPlayer, @NotNull Party party) {
requireNonNull(mcMMOPlayer, "mcMMOPlayer cannot be null!");
requireNonNull(party, "party cannot be null!");
Player player = mcMMOPlayer.getPlayer();
String playerName = player.getName();
@ -483,6 +522,7 @@ public final class PartyManager {
* @return the leader of the party
*/
public @Nullable String getPartyLeaderName(@NotNull String partyName) {
requireNonNull(partyName, "partyName cannot be null!");
Party party = getParty(partyName);
return party == null ? null : party.getLeader().getPlayerName();
@ -495,6 +535,8 @@ public final class PartyManager {
* @param party The party
*/
public void setPartyLeader(@NotNull UUID uuid, @NotNull Party party) {
requireNonNull(uuid, "uuid cannot be null!");
requireNonNull(party, "party cannot be null!");
OfflinePlayer player = pluginRef.getServer().getOfflinePlayer(uuid);
UUID leaderUniqueId = party.getLeader().getUniqueId();
@ -519,6 +561,7 @@ public final class PartyManager {
* @return true if the player can invite
*/
public boolean canInvite(@NotNull McMMOPlayer mcMMOPlayer) {
requireNonNull(mcMMOPlayer, "mcMMOPlayer cannot be null!");
Party party = mcMMOPlayer.getParty();
return !party.isLocked() || party.getLeader().getUniqueId().equals(mcMMOPlayer.getPlayer().getUniqueId());
@ -532,6 +575,9 @@ public final class PartyManager {
* @return true if a party with that name exists, false otherwise
*/
public boolean checkPartyExistence(@NotNull Player player, @NotNull String partyName) {
requireNonNull(player, "player cannot be null!");
requireNonNull(partyName, "partyName cannot be null!");
if (getParty(partyName) == null) {
return false;
}
@ -548,6 +594,9 @@ public final class PartyManager {
* @return true if the party was joined successfully, false otherwise
*/
public boolean changeOrJoinParty(@NotNull McMMOPlayer mmoPlayer, @NotNull String newPartyName) {
requireNonNull(mmoPlayer, "mmoPlayer cannot be null!");
requireNonNull(newPartyName, "newPartyName cannot be null!");
final Player player = mmoPlayer.getPlayer();
if (mmoPlayer.inParty()) {
@ -571,6 +620,9 @@ public final class PartyManager {
* @return true if they are in the same party, false otherwise
*/
public boolean inSameParty(@NotNull Player firstPlayer, @NotNull Player secondPlayer) {
requireNonNull(firstPlayer, "firstPlayer cannot be null!");
requireNonNull(secondPlayer, "secondPlayer cannot be null!");
//Profile not loaded
if (UserManager.getPlayer(firstPlayer) == null) {
return false;

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.LogUtils;

View File

@ -3,7 +3,6 @@ package com.gmail.nossr50.runnables.items;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.CancellableRunnable;
import com.gmail.nossr50.util.EventUtils;
import com.gmail.nossr50.util.Misc;

View File

@ -2,7 +2,6 @@ package com.gmail.nossr50.runnables.party;
import com.gmail.nossr50.datatypes.party.Party;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.CancellableRunnable;
import org.bukkit.OfflinePlayer;

View File

@ -1,6 +1,5 @@
package com.gmail.nossr50.runnables.skills;
import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.events.skills.rupture.McMMOEntityDamageByRuptureEvent;
import com.gmail.nossr50.mcMMO;

View File

@ -1,13 +0,0 @@
package com.gmail.nossr50.skills;
public interface AlternateFiringSuperSkill {
int chargeSuper();
void fireSuper();
void resetCharge();
boolean isReadyToFire();
long lastChargeTime();
}

View File

@ -1,7 +1,6 @@
package com.gmail.nossr50.skills.crossbows;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.player.UserManager;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;

View File

@ -4,7 +4,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.AlternateFiringSuperSkill;
import com.gmail.nossr50.skills.SkillManager;
import com.gmail.nossr50.util.MetadataConstants;
import com.gmail.nossr50.util.Permissions;
@ -23,15 +22,11 @@ import org.jetbrains.annotations.NotNull;
import static com.gmail.nossr50.util.skills.CombatUtils.delayArrowMetaCleanup;
public class CrossbowsManager extends SkillManager implements AlternateFiringSuperSkill {
public class CrossbowsManager extends SkillManager {
public CrossbowsManager(McMMOPlayer mmoPlayer) {
super(mmoPlayer, PrimarySkillType.CROSSBOWS);
}
private long lastChargeTime = 0;
private int crossbowSuperWindupState = 0;
public void handleRicochet(@NotNull Plugin pluginRef, @NotNull Arrow arrow, @NotNull Vector hitBlockNormal) {
if(!arrow.isShotFromCrossbow())
return;
@ -110,38 +105,4 @@ public class CrossbowsManager extends SkillManager implements AlternateFiringSup
return oldDamage;
}
}
@Override
public int chargeSuper() {
if (lastChargeTime < System.currentTimeMillis() - 2000) {
crossbowSuperWindupState = 0;
}
if (crossbowSuperWindupState < 3) {
crossbowSuperWindupState++;
}
lastChargeTime = System.currentTimeMillis();
return crossbowSuperWindupState;
}
@Override
public void fireSuper() {
// TODO: Impl
}
@Override
public void resetCharge() {
crossbowSuperWindupState = 0;
}
@Override
public boolean isReadyToFire() {
return crossbowSuperWindupState == 3;
}
@Override
public long lastChargeTime() {
return lastChargeTime;
}
}

View File

@ -167,18 +167,11 @@ public final class Permissions {
*/
public static boolean skillEnabled(Permissible permissible, PrimarySkillType skill) {
// hack to disable tridents for now
if (skill == PrimarySkillType.TRIDENTS)
return false;
return permissible.hasPermission("mcmmo.skills." + skill.toString().toLowerCase(Locale.ENGLISH));
}
public static boolean vanillaXpBoost(Permissible permissible, PrimarySkillType skill) { return permissible.hasPermission("mcmmo.ability." + skill.toString().toLowerCase(Locale.ENGLISH) + ".vanillaxpboost"); }
public static boolean isSubSkillEnabled(Permissible permissible, SubSkillType subSkillType) {
// hack to disable supers that aren't coded yet
if(subSkillType == SubSkillType.TRIDENTS_SUPER)
return false;
return permissible.hasPermission(subSkillType.getPermissionNodeAddress());
}
@ -293,10 +286,6 @@ public final class Permissions {
* @return true if the player has permission and has the skill unlocked
*/
public static boolean canUseSubSkill(@NotNull Player player, @NotNull SubSkillType subSkillType) {
// Hack to disable tridents for now
if (subSkillType.getParentSkill() == PrimarySkillType.TRIDENTS)
return false;
return isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
}
}

View File

@ -10,7 +10,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.metadata.MobMetaFlagType;
import com.gmail.nossr50.metadata.MobMetadataService;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.runnables.skills.AwardCombatXpTask;
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
import com.gmail.nossr50.skills.archery.ArcheryManager;
@ -46,17 +45,6 @@ public final class CombatUtils {
return mcMMO.getMetadataService().getMobMetadataService();
}
// TODO: Unit tests
public static void processProjectileSkillSuperAbilityActivation(McMMOPlayer mmoPlayer, ItemStack heldItem) {
// TODO: Support archery super as well
if (heldItem != null && mmoPlayer != null) {
if (ItemUtils.isCrossbow(heldItem)) {
mmoPlayer.checkCrossbowAbilityActivation();
}
}
}
//Likely.. because who knows what plugins are throwing around
public static boolean isDamageLikelyFromNormalCombat(@NotNull DamageCause damageCause) {
return switch (damageCause) {
case ENTITY_ATTACK, ENTITY_SWEEP_ATTACK, PROJECTILE -> true;

View File

@ -362,13 +362,7 @@ public final class SkillUtils {
* @param subSkillType target subskill
* @return true if the player has permission and has the skill unlocked
*/
public static boolean canUseSubskill(Player player, SubSkillType subSkillType)
{
requireNonNull(subSkillType, "subSkillType cannot be null");
// hack to disable supers that aren't coded yet
if(subSkillType == SubSkillType.TRIDENTS_SUPER || subSkillType == SubSkillType.CROSSBOWS_SUPER_SHOTGUN)
return false;
public static boolean canUseSubskill(Player player, @NotNull SubSkillType subSkillType) {
return Permissions.isSubSkillEnabled(player, subSkillType) && RankUtils.hasUnlockedSubskill(player, subSkillType);
}
}

View File

@ -5,7 +5,7 @@
# For advanced users only! There is no need to change anything here.
#
# You can customize almost every aspect of every skill here.
# Its mainly here if you've customized the experience formula.
# It's mainly here if you've customized the experience formula.
# Configure at what level you get better with certain abilities.
#
#####
@ -20,7 +20,7 @@ Feedback:
PlayerTips: true
SkillCommand:
BlankLinesAboveHeader: true
# If sendtitles is true messages will be sent using the title api (BIG TEXT ON SCREEN)
# If sendtitles is true, messages will be sent using the title api (BIG TEXT ON SCREEN)
Events:
XP:
SendTitles: true

View File

@ -432,9 +432,6 @@ Crossbows.Skills.SSG.Other.On=&a{0}&2 used &Super Shotgun!
Crossbows.SubSkill.PoweredShot.Name=Powered Shot
Crossbows.SubSkill.PoweredShot.Description=Increases damage done with crossbows
Crossbows.SubSkill.PoweredShot.Stat=Powered Shot Bonus Damage
Crossbows.SubSkill.SuperShotgun.Name=Super Shotgun
Crossbows.SubSkill.SuperShotgun.Description=Shoot dozens of arrows at once
Crossbows.SubSkill.SuperShotgun.Stat=Per Projectile damage &a{0}
Crossbows.SubSkill.CrossbowsLimitBreak.Name=Crossbows Limit Break
Crossbows.SubSkill.CrossbowsLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether it will boost damage in PVE.
Crossbows.SubSkill.CrossbowsLimitBreak.Stat=Limit Break Max DMG
@ -451,9 +448,6 @@ Tridents.Ability.Lower=&7You lower your trident.
Tridents.Ability.Ready=&3You &6ready&3 your Trident.
Tridents.Skills.TA.Refresh=&aYour &eSuper &aability is refreshed!
Tridents.Skills.TA.Other.On=&a{0}&2 used Trident &Super!
Tridents.SubSkill.SuperAbility.Name=Tridents Super Ability
Tridents.SubSkill.SuperAbility.Description=N/A
Tridents.SubSkill.SuperAbility.Stat=N/A
Tridents.SubSkill.Impale.Name=Impale
Tridents.SubSkill.Impale.Description=Increases damage done with tridents
Tridents.SubSkill.Impale.Stat=Impale Bonus Damage
@ -462,6 +456,18 @@ Tridents.SubSkill.TridentsLimitBreak.Description=Breaking your limits. Increased
Tridents.SubSkill.TridentsLimitBreak.Stat=Limit Break Max DMG
Tridents.Listener=Tridents:
#MACES
Maces.SkillName=MACES
Maces.Ability.Lower=&7You lower your mace.
Maces.Ability.Ready=&3You &6ready&3 your Mace.
Maces.Skills.MaceSmash.Refresh=&aYour &eGiga Smash &aability is refreshed!
Maces.Skills.MaceSmash.Other.On=&a{0}&2 used &cGiga Smash!
Maces.SubSkill.GigaSmash.Name=Giga Smash
Maces.SubSkill.MacesLimitBreak.Name=Maces Limit Break
Maces.SubSkill.MacesLimitBreak.Description=Breaking your limits. Increased damage against tough opponents. Intended for PVP, up to server settings for whether it will boost damage in PVE.
Maces.SubSkill.MacesLimitBreak.Stat=Limit Break Max DMG
Maces.Listener=Maces:
#SWORDS
Swords.Ability.Lower=&7You lower your sword.
Swords.Ability.Ready=&3You &6ready&3 your Sword.

View File

@ -338,12 +338,9 @@ permissions:
mcmmo.ability.crossbows.all:
description: Allows access to all Crossbows abilities
children:
mcmmo.ability.crossbows.supershotgun: true
mcmmo.ability.crossbows.trickshot: true
mcmmo.ability.crossbows.poweredshot: true
mcmmo.ability.crossbows.crossbowslimitbreak: true
mcmmo.ability.crossbows.supershotgun:
description: Allows access to the Super Shotgun super ability
mcmmo.ability.crossbows.crossbowslimitbreak:
description: Adds damage to crossbows
mcmmo.ability.crossbows.trickshot:
@ -722,11 +719,8 @@ permissions:
mcmmo.ability.tridents.all:
description: Allows access to all Trident abilities
children:
mcmmo.ability.tridents.superability: true
mcmmo.ability.tridents.impale: true
mcmmo.ability.tridents.tridentslimitbreak: true
mcmmo.ability.tridents.superability:
description: Allows access to tridents super ability
mcmmo.ability.tridents.impale:
description: Allows access to tridents Impale ability
mcmmo.ability.tridents.tridentslimitbreak:

View File

@ -31,11 +31,6 @@ Alchemy:
Rank_7: 900
Rank_8: 1000
Archery:
ExplosiveShot:
Standard:
Rank_1: 5
RetroMode:
Rank_1: 50
ArcheryLimitBreak:
Standard:
Rank_1: 10
@ -282,11 +277,6 @@ Crossbows:
Rank_8: 800
Rank_9: 900
Rank_10: 1000
SuperShotgun:
Standard:
Rank_1: 5
RetroMode:
Rank_1: 50
Tridents:
TridentsLimitBreak:
Standard:
@ -311,11 +301,6 @@ Tridents:
Rank_8: 800
Rank_9: 900
Rank_10: 1000
TridentsSuperAbility:
Standard:
Rank_1: 5
RetroMode:
Rank_1: 50
Impale:
Standard:
Rank_1: 5

View File

@ -78,7 +78,7 @@ class PartyManagerTest extends MMOTestEnvironment {
when(player.getUniqueId()).thenReturn(new UUID(0, 0));
// When & Then
assertThrows(IllegalArgumentException.class,
assertThrows(NullPointerException.class,
() -> partyManager.createParty(mmoPlayer, null, partyPassword));
}
@ -90,7 +90,7 @@ class PartyManagerTest extends MMOTestEnvironment {
String partyPassword = "somePassword";
// When & Then
assertThrows(IllegalArgumentException.class,
assertThrows(NullPointerException.class,
() -> partyManager.createParty(null, partyName, partyPassword));
}