mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
More API work
This commit is contained in:
parent
c916070cd1
commit
c2bbbdf24f
@ -1,4 +1,6 @@
|
|||||||
package com.gmail.nossr50.mcmmo.api.data;
|
package com.gmail.nossr50.mcmmo.api.data;
|
||||||
|
|
||||||
public interface MMOEntity {
|
public interface MMOEntity<N> {
|
||||||
|
|
||||||
|
N getNative();
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.gmail.nossr50.mcmmo.api.data;
|
package com.gmail.nossr50.mcmmo.api.data;
|
||||||
|
|
||||||
public interface MMOPlayer<N> extends MMOEntity {
|
public interface MMOPlayer<N> extends MMOEntity<N> {
|
||||||
|
|
||||||
|
|
||||||
N getPlayer();
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package com.gmail.nossr50.mcmmo.api.platform;
|
|||||||
|
|
||||||
import com.gmail.nossr50.mcmmo.api.platform.scheduler.PlatformScheduler;
|
import com.gmail.nossr50.mcmmo.api.platform.scheduler.PlatformScheduler;
|
||||||
import com.gmail.nossr50.mcmmo.api.platform.util.MetadataStore;
|
import com.gmail.nossr50.mcmmo.api.platform.util.MetadataStore;
|
||||||
|
import com.gmail.nossr50.mcmmo.api.platform.util.MobHealthBarManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -35,4 +36,6 @@ public interface PlatformProvider {
|
|||||||
PlatformScheduler getScheduler();
|
PlatformScheduler getScheduler();
|
||||||
|
|
||||||
void checkMetrics();
|
void checkMetrics();
|
||||||
|
|
||||||
|
MobHealthBarManager getHealthBarManager();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.gmail.nossr50.mcmmo.api.platform.util;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcmmo.api.data.MMOEntity;
|
||||||
|
import com.gmail.nossr50.mcmmo.api.data.MMOPlayer;
|
||||||
|
|
||||||
|
@Deprecated // Not really deprecated, just /really/ needs a do-over...
|
||||||
|
public interface MobHealthBarManager<PT, ET> {
|
||||||
|
/**
|
||||||
|
* Fix issues with death messages caused by the mob healthbars.
|
||||||
|
*
|
||||||
|
* @param deathMessage The original death message
|
||||||
|
* @param player The player who died
|
||||||
|
* @return the fixed death message
|
||||||
|
*/
|
||||||
|
public String fixDeathMessage(String deathMessage, MMOPlayer<PT> player);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the creation of mob healthbars.
|
||||||
|
*
|
||||||
|
* @param target the targetted entity
|
||||||
|
* @param damage damage done by the attack triggering this
|
||||||
|
*/
|
||||||
|
public void handleMobHealthbars(MMOEntity<ET> target, double damage);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -11,7 +11,9 @@ import com.gmail.nossr50.mcmmo.api.platform.PlatformProvider;
|
|||||||
import com.gmail.nossr50.mcmmo.api.platform.ServerSoftwareType;
|
import com.gmail.nossr50.mcmmo.api.platform.ServerSoftwareType;
|
||||||
import com.gmail.nossr50.mcmmo.api.platform.scheduler.PlatformScheduler;
|
import com.gmail.nossr50.mcmmo.api.platform.scheduler.PlatformScheduler;
|
||||||
import com.gmail.nossr50.mcmmo.api.platform.util.MetadataStore;
|
import com.gmail.nossr50.mcmmo.api.platform.util.MetadataStore;
|
||||||
|
import com.gmail.nossr50.mcmmo.api.platform.util.MobHealthBarManager;
|
||||||
import com.gmail.nossr50.mcmmo.bukkit.platform.scheduler.BukkitPlatformScheduler;
|
import com.gmail.nossr50.mcmmo.bukkit.platform.scheduler.BukkitPlatformScheduler;
|
||||||
|
import com.gmail.nossr50.mcmmo.bukkit.platform.util.BukkitMobHealthBarManager;
|
||||||
|
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -27,6 +29,7 @@ public class BukkitBoostrap extends JavaPlugin implements PlatformProvider {
|
|||||||
|
|
||||||
private mcMMO core = new mcMMO(this);
|
private mcMMO core = new mcMMO(this);
|
||||||
private final BukkitPlatformScheduler scheduler = new BukkitPlatformScheduler(this);
|
private final BukkitPlatformScheduler scheduler = new BukkitPlatformScheduler(this);
|
||||||
|
private final MobHealthBarManager healthBarManager = new BukkitMobHealthBarManager(core);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @NotNull Logger getLogger() {
|
public @NotNull Logger getLogger() {
|
||||||
@ -53,6 +56,12 @@ public class BukkitBoostrap extends JavaPlugin implements PlatformProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void earlyInit() {
|
public void earlyInit() {
|
||||||
|
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||||
|
if (pluginManager.getPlugin("NoCheatPlus") != null && pluginManager.getPlugin("CompatNoCheatPlus") == null) {
|
||||||
|
getLogger().warning("NoCheatPlus plugin found, but CompatNoCheatPlus was not found!");
|
||||||
|
getLogger().warning("mcMMO will not work properly alongside NoCheatPlus without CompatNoCheatPlus");
|
||||||
|
}
|
||||||
|
|
||||||
registerEvents();
|
registerEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -117,6 +126,11 @@ public class BukkitBoostrap extends JavaPlugin implements PlatformProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MobHealthBarManager getHealthBarManager() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void registerEvents() {
|
private void registerEvents() {
|
||||||
PluginManager pluginManager = getServer().getPluginManager();
|
PluginManager pluginManager = getServer().getPluginManager();
|
||||||
|
@ -15,7 +15,6 @@ public class BukkitPlatformScheduler implements PlatformScheduler {
|
|||||||
private final BukkitBoostrap bukkitBoostrap;
|
private final BukkitBoostrap bukkitBoostrap;
|
||||||
|
|
||||||
public BukkitPlatformScheduler(BukkitBoostrap bukkitBoostrap) {
|
public BukkitPlatformScheduler(BukkitBoostrap bukkitBoostrap) {
|
||||||
|
|
||||||
this.bukkitBoostrap = bukkitBoostrap;
|
this.bukkitBoostrap = bukkitBoostrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,22 +1,37 @@
|
|||||||
package com.gmail.nossr50.util;
|
package com.gmail.nossr50.mcmmo.bukkit.platform.util;
|
||||||
|
|
||||||
import com.gmail.nossr50.core.MetadataConstants;
|
import com.gmail.nossr50.core.MetadataConstants;
|
||||||
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
import com.gmail.nossr50.datatypes.MobHealthbarType;
|
||||||
import com.gmail.nossr50.datatypes.meta.OldName;
|
import com.gmail.nossr50.datatypes.meta.OldName;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.gmail.nossr50.mcmmo.api.data.MMOEntity;
|
||||||
|
import com.gmail.nossr50.mcmmo.api.data.MMOPlayer;
|
||||||
|
import com.gmail.nossr50.mcmmo.api.platform.util.MobHealthBarManager;
|
||||||
import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
|
import com.gmail.nossr50.runnables.MobHealthDisplayUpdaterTask;
|
||||||
|
import com.gmail.nossr50.util.StringUtils;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
public final class MobHealthBarManager {
|
public final class BukkitMobHealthBarManager implements MobHealthBarManager<Player, LivingEntity> {
|
||||||
private final mcMMO pluginRef;
|
private final mcMMO pluginRef;
|
||||||
|
private final boolean healthBarPluginEnabled;
|
||||||
|
|
||||||
public MobHealthBarManager(mcMMO pluginRef) {
|
public BukkitMobHealthBarManager(mcMMO pluginRef) {
|
||||||
this.pluginRef = pluginRef;
|
this.pluginRef = pluginRef;
|
||||||
|
PluginManager pluginManager = Bukkit.getServer().getPluginManager();
|
||||||
|
healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null;
|
||||||
|
|
||||||
|
if (healthBarPluginEnabled) {
|
||||||
|
pluginRef.getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled.");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,8 +41,9 @@ public final class MobHealthBarManager {
|
|||||||
* @param player The player who died
|
* @param player The player who died
|
||||||
* @return the fixed death message
|
* @return the fixed death message
|
||||||
*/
|
*/
|
||||||
public String fixDeathMessage(String deathMessage, Player player) {
|
@Override
|
||||||
EntityDamageEvent lastDamageCause = player.getLastDamageCause();
|
public String fixDeathMessage(String deathMessage, MMOPlayer<Player> player) {
|
||||||
|
EntityDamageEvent lastDamageCause = player.getNative().getLastDamageCause();
|
||||||
String replaceString = lastDamageCause instanceof EntityDamageByEntityEvent ? StringUtils.getPrettyEntityTypeString(((EntityDamageByEntityEvent) lastDamageCause).getDamager().getType()) : "a mob";
|
String replaceString = lastDamageCause instanceof EntityDamageByEntityEvent ? StringUtils.getPrettyEntityTypeString(((EntityDamageByEntityEvent) lastDamageCause).getDamager().getType()) : "a mob";
|
||||||
|
|
||||||
return deathMessage.replaceAll("(?:\u00A7(?:[0-9A-FK-ORa-fk-or]){1}(?:[\u2764\u25A0]{1,10})){1,2}", replaceString);
|
return deathMessage.replaceAll("(?:\u00A7(?:[0-9A-FK-ORa-fk-or]){1}(?:[\u2764\u25A0]{1,10})){1,2}", replaceString);
|
||||||
@ -39,10 +55,12 @@ public final class MobHealthBarManager {
|
|||||||
* @param target the targetted entity
|
* @param target the targetted entity
|
||||||
* @param damage damage done by the attack triggering this
|
* @param damage damage done by the attack triggering this
|
||||||
*/
|
*/
|
||||||
public void handleMobHealthbars(LivingEntity target, double damage, mcMMO plugin) {
|
@Override
|
||||||
if (pluginRef.isHealthBarPluginEnabled() || !pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) {
|
public void handleMobHealthbars(MMOEntity<LivingEntity> mmoTarget, double damage) {
|
||||||
|
if (healthBarPluginEnabled || !pluginRef.getConfigManager().getConfigMobs().getCombat().getHealthBars().isEnableHealthBars()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
LivingEntity target = mmoTarget.getNative();
|
||||||
|
|
||||||
if (isBoss(target)) {
|
if (isBoss(target)) {
|
||||||
return;
|
return;
|
||||||
@ -60,7 +78,7 @@ public final class MobHealthBarManager {
|
|||||||
* Store the name in metadata
|
* Store the name in metadata
|
||||||
*/
|
*/
|
||||||
if (target.getMetadata("mcMMO_oldName").size() <= 0 && originalName != null)
|
if (target.getMetadata("mcMMO_oldName").size() <= 0 && originalName != null)
|
||||||
target.setMetadata("mcMMO_oldName", new OldName(originalName, plugin));
|
target.setMetadata("mcMMO_oldName", new OldName(originalName, pluginRef));
|
||||||
|
|
||||||
if (oldName == null) {
|
if (oldName == null) {
|
||||||
oldName = "";
|
oldName = "";
|
@ -85,7 +85,7 @@ public class ChatManager {
|
|||||||
* Party Chat Spying
|
* Party Chat Spying
|
||||||
*/
|
*/
|
||||||
for (BukkitMMOPlayer mcMMOPlayer : pluginRef.getUserManager().getPlayers()) {
|
for (BukkitMMOPlayer mcMMOPlayer : pluginRef.getUserManager().getPlayers()) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
|
|
||||||
//Check for toggled players
|
//Check for toggled players
|
||||||
if (mcMMOPlayer.isPartyChatSpying()) {
|
if (mcMMOPlayer.isPartyChatSpying()) {
|
||||||
|
@ -22,7 +22,7 @@ public class AbilityToggleCommand extends ToggleCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
|
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.Ability." + (mcMMOPlayer.getAllowAbilityUse() ? "Off" : "On")));
|
mcMMOPlayer.getNative().sendMessage(pluginRef.getLocaleManager().getString("Commands.Ability." + (mcMMOPlayer.getAllowAbilityUse() ? "Off" : "On")));
|
||||||
mcMMOPlayer.toggleAbilityUse();
|
mcMMOPlayer.toggleAbilityUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ public class GodModeCommand extends ToggleCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
|
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
|
mcMMOPlayer.getNative().sendMessage(pluginRef.getLocaleManager().getString("Commands.GodMode." + (mcMMOPlayer.getGodMode() ? "Disabled" : "Enabled")));
|
||||||
mcMMOPlayer.toggleGodMode();
|
mcMMOPlayer.toggleGodMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class RefreshCooldownsCommand extends ToggleCommand {
|
|||||||
mcMMOPlayer.resetToolPrepMode();
|
mcMMOPlayer.resetToolPrepMode();
|
||||||
mcMMOPlayer.resetSuperAbilityMode();
|
mcMMOPlayer.resetSuperAbilityMode();
|
||||||
|
|
||||||
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Ability.Generic.Refresh"));
|
mcMMOPlayer.getNative().sendMessage(pluginRef.getLocaleManager().getString("Ability.Generic.Refresh"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,7 +20,7 @@ public class PlayerDebugCommand implements CommandExecutor {
|
|||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
BukkitMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer((Player) sender);
|
BukkitMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer((Player) sender);
|
||||||
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
||||||
pluginRef.getNotificationManager().sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
pluginRef.getNotificationManager().sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getNative(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -23,7 +23,7 @@ public class ChatSpyCommand extends ToggleCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
|
protected void applyCommandAction(BukkitMMOPlayer mcMMOPlayer) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage(pluginRef.getLocaleManager().getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
|
mcMMOPlayer.getNative().sendMessage(pluginRef.getLocaleManager().getString("Commands.AdminChatSpy." + (mcMMOPlayer.isPartyChatSpying() ? "Disabled" : "Enabled")));
|
||||||
mcMMOPlayer.togglePartyChatSpying();
|
mcMMOPlayer.togglePartyChatSpying();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public abstract class ExperienceCommand implements TabExecutor {
|
|||||||
|
|
||||||
editValues(null, profile, skill, value);
|
editValues(null, profile, skill, value);
|
||||||
} else {
|
} else {
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill, value);
|
editValues(mcMMOPlayer.getNative(), mcMMOPlayer.getProfile(), skill, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSenderMessage(sender, playerName, skill);
|
handleSenderMessage(sender, playerName, skill);
|
||||||
|
@ -98,7 +98,7 @@ public class SkillResetCommand implements TabExecutor {
|
|||||||
|
|
||||||
editValues(null, profile, skill);
|
editValues(null, profile, skill);
|
||||||
} else {
|
} else {
|
||||||
editValues(mcMMOPlayer.getPlayer(), mcMMOPlayer.getProfile(), skill);
|
editValues(mcMMOPlayer.getNative(), mcMMOPlayer.getProfile(), skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSenderMessage(sender, playerName, skill);
|
handleSenderMessage(sender, playerName, skill);
|
||||||
|
@ -27,7 +27,7 @@ public class PartyInviteCommand implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getNative();
|
||||||
|
|
||||||
if (pluginRef.getUserManager().getPlayer((Player) sender) == null) {
|
if (pluginRef.getUserManager().getPlayer((Player) sender) == null) {
|
||||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
|
sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
|
||||||
|
@ -28,7 +28,7 @@ public class PartyJoinCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getNative();
|
||||||
|
|
||||||
if (!mcMMOTarget.inParty()) {
|
if (!mcMMOTarget.inParty()) {
|
||||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Party.PlayerNotInParty", targetName));
|
sender.sendMessage(pluginRef.getLocaleManager().getString("Party.PlayerNotInParty", targetName));
|
||||||
|
@ -38,7 +38,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
|
|
||||||
// Check to see if the party exists, and if it does cancel renaming the party
|
// Check to see if the party exists, and if it does cancel renaming the party
|
||||||
if (pluginRef.getPartyManager().checkPartyExistence(player, newPartyName)) {
|
if (pluginRef.getPartyManager().checkPartyExistence(player, newPartyName)) {
|
||||||
|
@ -27,7 +27,7 @@ public class PartyAllianceInviteCommand implements CommandExecutor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getNative();
|
||||||
|
|
||||||
if (pluginRef.getUserManager().getPlayer((Player) sender) == null) {
|
if (pluginRef.getUserManager().getPlayer((Player) sender) == null) {
|
||||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
|
sender.sendMessage(pluginRef.getLocaleManager().getString("Profile.PendingLoad"));
|
||||||
|
@ -158,7 +158,7 @@ public class PtpCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BukkitMMOPlayer mcMMOTarget = pluginRef.getUserManager().getPlayer(targetName);
|
BukkitMMOPlayer mcMMOTarget = pluginRef.getUserManager().getPlayer(targetName);
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getNative();
|
||||||
|
|
||||||
if (pluginRef.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
|
if (pluginRef.getConfigManager().getConfigParty().getPTP().isPtpWorldBasedPermissions()) {
|
||||||
World targetWorld = target.getWorld();
|
World targetWorld = target.getWorld();
|
||||||
|
@ -65,7 +65,7 @@ public class InspectCommand implements TabExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Player target = mcMMOPlayer.getPlayer();
|
Player target = mcMMOPlayer.getNative();
|
||||||
|
|
||||||
if (pluginRef.getCommandTools().hidden(sender, target, pluginRef.getPermissionTools().inspectHidden(sender))) {
|
if (pluginRef.getCommandTools().hidden(sender, target, pluginRef.getPermissionTools().inspectHidden(sender))) {
|
||||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Offline"));
|
sender.sendMessage(pluginRef.getLocaleManager().getString("Inspect.Offline"));
|
||||||
|
@ -59,7 +59,7 @@ public class RankCommand implements TabExecutor {
|
|||||||
BukkitMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getOfflinePlayer(playerName);
|
BukkitMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getOfflinePlayer(playerName);
|
||||||
|
|
||||||
if (mcMMOPlayer != null) {
|
if (mcMMOPlayer != null) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
playerName = player.getName();
|
playerName = player.getName();
|
||||||
|
|
||||||
if (pluginRef.getCommandTools().tooFar(sender, player, pluginRef.getPermissionTools().mcrankFar(sender))) {
|
if (pluginRef.getCommandTools().tooFar(sender, player, pluginRef.getPermissionTools().mcrankFar(sender))) {
|
||||||
|
@ -508,7 +508,7 @@ public class Party {
|
|||||||
Party party = mcMMOPlayer.getParty();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
double range = pluginRef.getConfigManager().getConfigParty().getPartyXP().getPartyExperienceSharing().getPartyShareRange();
|
double range = pluginRef.getConfigManager().getConfigParty().getPartyXP().getPartyExperienceSharing().getPartyShareRange();
|
||||||
|
|
||||||
for (Player member : party.getOnlineMembers()) {
|
for (Player member : party.getOnlineMembers()) {
|
||||||
|
@ -695,7 +695,7 @@ public class BukkitMMOPlayer implements MMOPlayer<Player> {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Player getPlayer() {
|
public Player getNative() {
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,7 +769,7 @@ public class BukkitMMOPlayer implements MMOPlayer<Player> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void loginParty() {
|
public void loginParty() {
|
||||||
party.addOnlineMember(this.getPlayer());
|
party.addOnlineMember(this.getNative());
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemShareModifier() {
|
public int getItemShareModifier() {
|
||||||
@ -903,7 +903,7 @@ public class BukkitMMOPlayer implements MMOPlayer<Player> {
|
|||||||
|
|
||||||
//TODO: This is hacky and temporary solution until skills are moved to the new system
|
//TODO: This is hacky and temporary solution until skills are moved 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 (!pluginRef.getSkillTools().isSuperAbilityUnlocked(primarySkillType, getPlayer())) {
|
if (!pluginRef.getSkillTools().isSuperAbilityUnlocked(primarySkillType, getNative())) {
|
||||||
int diff = pluginRef.getRankTools().getSuperAbilityUnlockRequirement(pluginRef.getSkillTools().getSuperAbility(primarySkillType)) - getSkillLevel(primarySkillType);
|
int diff = pluginRef.getRankTools().getSuperAbilityUnlockRequirement(pluginRef.getSkillTools().getSuperAbility(primarySkillType)) - getSkillLevel(primarySkillType);
|
||||||
|
|
||||||
//Inform the player they are not yet skilled enough
|
//Inform the player they are not yet skilled enough
|
||||||
@ -1071,7 +1071,7 @@ public class BukkitMMOPlayer implements MMOPlayer<Player> {
|
|||||||
* @param syncSave if true, data is saved synchronously
|
* @param syncSave if true, data is saved synchronously
|
||||||
*/
|
*/
|
||||||
public void logout(boolean syncSave) {
|
public void logout(boolean syncSave) {
|
||||||
Player thisPlayer = getPlayer();
|
Player thisPlayer = getNative();
|
||||||
resetSuperAbilityMode();
|
resetSuperAbilityMode();
|
||||||
pluginRef.getBleedTimerTask().bleedOut(thisPlayer);
|
pluginRef.getBleedTimerTask().bleedOut(thisPlayer);
|
||||||
cleanup();
|
cleanup();
|
||||||
|
@ -222,7 +222,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getActivationChance(BukkitMMOPlayer mcMMOPlayer) {
|
private int getActivationChance(BukkitMMOPlayer mcMMOPlayer) {
|
||||||
return pluginRef.getPerkUtils().handleLuckyPerks(mcMMOPlayer.getPlayer(), getPrimarySkill());
|
return pluginRef.getPerkUtils().handleLuckyPerks(mcMMOPlayer.getNative(), getPrimarySkill());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -276,7 +276,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
|
|
||||||
if (pluginRef.getItemTools().hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) {
|
if (pluginRef.getItemTools().hasItemInEitherHand(player, Material.ENDER_PEARL) || player.isInsideVehicle()) {
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if(mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Ender Pearl or Inside Vehicle");
|
mcMMOPlayer.getNative().sendMessage("Acrobatics XP Prevented: Ender Pearl or Inside Vehicle");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -288,7 +288,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
if (pluginRef.getUserManager().getPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player)))
|
if (pluginRef.getUserManager().getPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player)))
|
||||||
{
|
{
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if(mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Acrobatics XP Prevented: Fallen in location before");
|
mcMMOPlayer.getNative().sendMessage("Acrobatics XP Prevented: Fallen in location before");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -62,8 +62,8 @@ public class SelfListener implements Listener {
|
|||||||
PrimarySkillType primarySkillType = event.getSkill();
|
PrimarySkillType primarySkillType = event.getSkill();
|
||||||
|
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if(mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage(event.getSkill().toString() + " XP Gained");
|
mcMMOPlayer.getNative().sendMessage(event.getSkill().toString() + " XP Gained");
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Incoming Raw XP: "+event.getRawXpGained());
|
mcMMOPlayer.getNative().sendMessage("Incoming Raw XP: "+event.getRawXpGained());
|
||||||
}
|
}
|
||||||
|
|
||||||
//WorldGuard XP Check
|
//WorldGuard XP Check
|
||||||
@ -77,7 +77,7 @@ public class SelfListener implements Listener {
|
|||||||
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.getNative().sendMessage("No WG XP Flag - New Raw XP: "+event.getRawXpGained());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ public class SelfListener implements Listener {
|
|||||||
|
|
||||||
if (threshold <= 0 || !pluginRef.getConfigManager().getConfigLeveling().getConfigLevelingDiminishedReturns().isDiminishedReturnsEnabled()) {
|
if (threshold <= 0 || !pluginRef.getConfigManager().getConfigLeveling().getConfigLevelingDiminishedReturns().isDiminishedReturnsEnabled()) {
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if(mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
|
mcMMOPlayer.getNative().sendMessage("Final Raw XP: "+event.getRawXpGained());
|
||||||
}
|
}
|
||||||
// Diminished returns is turned off
|
// Diminished returns is turned off
|
||||||
return;
|
return;
|
||||||
@ -149,7 +149,7 @@ public class SelfListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if(mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Final Raw XP: "+event.getRawXpGained());
|
mcMMOPlayer.getNative().sendMessage("Final Raw XP: "+event.getRawXpGained());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ import com.gmail.nossr50.util.sounds.SoundManager;
|
|||||||
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
import com.gmail.nossr50.worldguard.WorldGuardManager;
|
||||||
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
import com.gmail.nossr50.worldguard.WorldGuardUtils;
|
||||||
import net.shatteredlands.shatt.backup.ZipLibrary;
|
import net.shatteredlands.shatt.backup.ZipLibrary;
|
||||||
import org.bstats.bukkit.Metrics;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
@ -77,7 +77,6 @@ public class mcMMO implements McMMOApi {
|
|||||||
private PartyManager partyManager;
|
private PartyManager partyManager;
|
||||||
private LocaleManager localeManager;
|
private LocaleManager localeManager;
|
||||||
private ChatManager chatManager;
|
private ChatManager chatManager;
|
||||||
private MobHealthBarManager mobHealthBarManager;
|
|
||||||
private EventManager eventManager;
|
private EventManager eventManager;
|
||||||
private UserManager userManager;
|
private UserManager userManager;
|
||||||
private ScoreboardManager scoreboardManager;
|
private ScoreboardManager scoreboardManager;
|
||||||
@ -115,8 +114,6 @@ public class mcMMO implements McMMOApi {
|
|||||||
private String usersFile;
|
private String usersFile;
|
||||||
private String modDirectory;
|
private String modDirectory;
|
||||||
|
|
||||||
/* Plugin Checks */
|
|
||||||
private boolean healthBarPluginEnabled;
|
|
||||||
// API checks
|
// API checks
|
||||||
private boolean serverAPIOutdated = false;
|
private boolean serverAPIOutdated = false;
|
||||||
// XP Event Check
|
// XP Event Check
|
||||||
@ -135,9 +132,6 @@ public class mcMMO implements McMMOApi {
|
|||||||
try {
|
try {
|
||||||
platformProvider.getLogger().setFilter(new LogFilter(this));
|
platformProvider.getLogger().setFilter(new LogFilter(this));
|
||||||
|
|
||||||
PluginManager pluginManager = platformProvider.getServer().getPluginManager();
|
|
||||||
healthBarPluginEnabled = pluginManager.getPlugin("HealthBar") != null;
|
|
||||||
|
|
||||||
//Init Permission Tools
|
//Init Permission Tools
|
||||||
permissionTools = new PermissionTools(this);
|
permissionTools = new PermissionTools(this);
|
||||||
|
|
||||||
@ -166,14 +160,6 @@ public class mcMMO implements McMMOApi {
|
|||||||
//Init TextComponentFactory
|
//Init TextComponentFactory
|
||||||
textComponentFactory = new TextComponentFactory(this);
|
textComponentFactory = new TextComponentFactory(this);
|
||||||
|
|
||||||
if (healthBarPluginEnabled) {
|
|
||||||
getLogger().info("HealthBar plugin found, mcMMO's healthbars are automatically disabled.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pluginManager.getPlugin("NoCheatPlus") != null && pluginManager.getPlugin("CompatNoCheatPlus") == null) {
|
|
||||||
getLogger().warning("NoCheatPlus plugin found, but CompatNoCheatPlus was not found!");
|
|
||||||
getLogger().warning("mcMMO will not work properly alongside NoCheatPlus without CompatNoCheatPlus");
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Strange design...
|
//TODO: Strange design...
|
||||||
databaseManagerFactory = new DatabaseManagerFactory(this);
|
databaseManagerFactory = new DatabaseManagerFactory(this);
|
||||||
@ -242,7 +228,7 @@ public class mcMMO implements McMMOApi {
|
|||||||
chatManager = new ChatManager(this);
|
chatManager = new ChatManager(this);
|
||||||
|
|
||||||
//Init Mob Health Bar Manager
|
//Init Mob Health Bar Manager
|
||||||
mobHealthBarManager = new MobHealthBarManager(this);
|
bukkitMobHealthBarManager = new BukkitMobHealthBarManager(this);
|
||||||
|
|
||||||
//Init Event Manager
|
//Init Event Manager
|
||||||
eventManager = new EventManager(this);
|
eventManager = new EventManager(this);
|
||||||
@ -457,10 +443,6 @@ public class mcMMO implements McMMOApi {
|
|||||||
return configManager.getConfigScoreboard();
|
return configManager.getConfigScoreboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHealthBarPluginEnabled() {
|
|
||||||
return healthBarPluginEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConfigManager getConfigManager() {
|
public ConfigManager getConfigManager() {
|
||||||
return configManager;
|
return configManager;
|
||||||
}
|
}
|
||||||
@ -697,10 +679,6 @@ public class mcMMO implements McMMOApi {
|
|||||||
return chatManager;
|
return chatManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MobHealthBarManager getMobHealthBarManager() {
|
|
||||||
return mobHealthBarManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EventManager getEventManager() {
|
public EventManager getEventManager() {
|
||||||
return eventManager;
|
return eventManager;
|
||||||
}
|
}
|
||||||
@ -757,6 +735,7 @@ public class mcMMO implements McMMOApi {
|
|||||||
return permissionTools;
|
return permissionTools;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated // This needs to be removed...
|
||||||
public WorldGuardUtils getWorldGuardUtils() {
|
public WorldGuardUtils getWorldGuardUtils() {
|
||||||
return worldGuardUtils;
|
return worldGuardUtils;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public final class PartyManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player target = mcMMOTarget.getPlayer();
|
Player target = mcMMOTarget.getNative();
|
||||||
|
|
||||||
if (player.equals(target)) {
|
if (player.equals(target)) {
|
||||||
player.sendMessage(pluginRef.getLocaleManager().getString("Party.Teleport.Self"));
|
player.sendMessage(pluginRef.getLocaleManager().getString("Party.Teleport.Self"));
|
||||||
@ -140,7 +140,7 @@ public final class PartyManager {
|
|||||||
* @return true if the party was joined successfully, false otherwise
|
* @return true if the party was joined successfully, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean changeOrJoinParty(BukkitMMOPlayer mcMMOPlayer, String newPartyName) {
|
public boolean changeOrJoinParty(BukkitMMOPlayer mcMMOPlayer, String newPartyName) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
|
|
||||||
if (mcMMOPlayer.inParty()) {
|
if (mcMMOPlayer.inParty()) {
|
||||||
Party oldParty = mcMMOPlayer.getParty();
|
Party oldParty = mcMMOPlayer.getParty();
|
||||||
@ -223,7 +223,7 @@ public final class PartyManager {
|
|||||||
Party party = mcMMOPlayer.getParty();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
double range = pluginRef.getPartyXPShareSettings().getPartyShareRange();
|
double range = pluginRef.getPartyXPShareSettings().getPartyShareRange();
|
||||||
|
|
||||||
for (Player member : party.getOnlineMembers()) {
|
for (Player member : party.getOnlineMembers()) {
|
||||||
@ -241,7 +241,7 @@ public final class PartyManager {
|
|||||||
Party party = mcMMOPlayer.getParty();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
if (party != null) {
|
if (party != null) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
double range = pluginRef.getPartyXPShareSettings().getPartyShareRange();
|
double range = pluginRef.getPartyXPShareSettings().getPartyShareRange();
|
||||||
|
|
||||||
for (Player member : party.getVisibleMembers(player)) {
|
for (Player member : party.getVisibleMembers(player)) {
|
||||||
@ -421,7 +421,7 @@ public final class PartyManager {
|
|||||||
* @param mcMMOPlayer The player to remove
|
* @param mcMMOPlayer The player to remove
|
||||||
*/
|
*/
|
||||||
public void removeFromParty(BukkitMMOPlayer mcMMOPlayer) {
|
public void removeFromParty(BukkitMMOPlayer mcMMOPlayer) {
|
||||||
removeFromParty(mcMMOPlayer.getPlayer(), mcMMOPlayer.getParty());
|
removeFromParty(mcMMOPlayer.getNative(), mcMMOPlayer.getParty());
|
||||||
processPartyLeaving(mcMMOPlayer);
|
processPartyLeaving(mcMMOPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ public final class PartyManager {
|
|||||||
* @param password The password for this party, null if there was no password
|
* @param password The password for this party, null if there was no password
|
||||||
*/
|
*/
|
||||||
public void createParty(BukkitMMOPlayer mcMMOPlayer, String partyName, String password) {
|
public void createParty(BukkitMMOPlayer mcMMOPlayer, String partyName, String password) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
|
|
||||||
Party party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName.replace(".", ""), password, pluginRef);
|
Party party = new Party(new PartyLeader(player.getUniqueId(), player.getName()), partyName.replace(".", ""), password, pluginRef);
|
||||||
|
|
||||||
@ -512,7 +512,7 @@ public final class PartyManager {
|
|||||||
|
|
||||||
// Check if the party still exists, it might have been disbanded
|
// Check if the party still exists, it might have been disbanded
|
||||||
if (!parties.contains(invite)) {
|
if (!parties.contains(invite)) {
|
||||||
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Party.Disband");
|
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(), NotificationType.PARTY_MESSAGE, "Party.Disband");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,13 +520,13 @@ public final class PartyManager {
|
|||||||
* Don't let players join a full party
|
* Don't let players join a full party
|
||||||
*/
|
*/
|
||||||
if (pluginRef.getConfigManager().getConfigParty().isPartySizeCapped() && invite.getMembers().size() >= pluginRef.getConfigManager().getConfigParty().getPartySizeLimit()) {
|
if (pluginRef.getConfigManager().getConfigParty().isPartySizeCapped() && invite.getMembers().size() >= pluginRef.getConfigManager().getConfigParty().getPartySizeLimit()) {
|
||||||
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(),
|
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(),
|
||||||
NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull.InviteAccept",
|
NotificationType.PARTY_MESSAGE, "Commands.Party.PartyFull.InviteAccept",
|
||||||
invite.getName(), String.valueOf(pluginRef.getConfigManager().getConfigParty().getPartySizeLimit()));
|
invite.getName(), String.valueOf(pluginRef.getConfigManager().getConfigParty().getPartySizeLimit()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.PARTY_MESSAGE, "Commands.Party.Invite.Accepted", invite.getName());
|
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(), NotificationType.PARTY_MESSAGE, "Commands.Party.Invite.Accepted", invite.getName());
|
||||||
mcMMOPlayer.removePartyInvite();
|
mcMMOPlayer.removePartyInvite();
|
||||||
addToParty(mcMMOPlayer, invite);
|
addToParty(mcMMOPlayer, invite);
|
||||||
}
|
}
|
||||||
@ -538,7 +538,7 @@ public final class PartyManager {
|
|||||||
*/
|
*/
|
||||||
public void acceptAllianceInvite(BukkitMMOPlayer mcMMOPlayer) {
|
public void acceptAllianceInvite(BukkitMMOPlayer mcMMOPlayer) {
|
||||||
Party invite = mcMMOPlayer.getPartyAllianceInvite();
|
Party invite = mcMMOPlayer.getPartyAllianceInvite();
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
|
|
||||||
// Check if the party still exists, it might have been disbanded
|
// Check if the party still exists, it might have been disbanded
|
||||||
if (!parties.contains(invite)) {
|
if (!parties.contains(invite)) {
|
||||||
@ -593,7 +593,7 @@ public final class PartyManager {
|
|||||||
* @param party The party
|
* @param party The party
|
||||||
*/
|
*/
|
||||||
public void addToParty(BukkitMMOPlayer mcMMOPlayer, Party party) {
|
public void addToParty(BukkitMMOPlayer mcMMOPlayer, Party party) {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
String playerName = player.getName();
|
String playerName = player.getName();
|
||||||
|
|
||||||
informPartyMembersJoin(party, playerName);
|
informPartyMembersJoin(party, playerName);
|
||||||
@ -647,7 +647,7 @@ public final class PartyManager {
|
|||||||
public boolean canInvite(BukkitMMOPlayer mcMMOPlayer) {
|
public boolean canInvite(BukkitMMOPlayer mcMMOPlayer) {
|
||||||
Party party = mcMMOPlayer.getParty();
|
Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
return !party.isLocked() || party.getLeader().getUniqueId().equals(mcMMOPlayer.getPlayer().getUniqueId());
|
return !party.isLocked() || party.getLeader().getUniqueId().equals(mcMMOPlayer.getNative().getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +43,7 @@ public final class ShareHandler {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nearMembers.add(mcMMOPlayer.getPlayer());
|
nearMembers.add(mcMMOPlayer.getNative());
|
||||||
|
|
||||||
int partySize = nearMembers.size();
|
int partySize = nearMembers.size();
|
||||||
double shareBonus = Math.min(pluginRef.getPartyXPShareSettings().getPartyShareXPBonusBase()
|
double shareBonus = Math.min(pluginRef.getPartyXPShareSettings().getPartyShareXPBonusBase()
|
||||||
@ -97,7 +97,7 @@ public final class ShareHandler {
|
|||||||
Player winningPlayer = null;
|
Player winningPlayer = null;
|
||||||
ItemStack newStack = itemStack.clone();
|
ItemStack newStack = itemStack.clone();
|
||||||
|
|
||||||
nearMembers.add(mcMMOPlayer.getPlayer());
|
nearMembers.add(mcMMOPlayer.getNative());
|
||||||
int partySize = nearMembers.size();
|
int partySize = nearMembers.size();
|
||||||
|
|
||||||
drop.remove();
|
drop.remove();
|
||||||
|
@ -23,7 +23,7 @@ public class ChimaeraWingWarmup extends BukkitRunnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void checkChimaeraWingTeleport() {
|
private void checkChimaeraWingTeleport() {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation();
|
Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation();
|
||||||
ChimaeraWing chimaeraWing = new ChimaeraWing(pluginRef, mcMMOPlayer);
|
ChimaeraWing chimaeraWing = new ChimaeraWing(pluginRef, mcMMOPlayer);
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@ public class TeleportationWarmup extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Player teleportingPlayer = mcMMOPlayer.getPlayer();
|
Player teleportingPlayer = mcMMOPlayer.getNative();
|
||||||
Player targetPlayer = mcMMOTarget.getPlayer();
|
Player targetPlayer = mcMMOTarget.getNative();
|
||||||
Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation();
|
Location previousLocation = mcMMOPlayer.getTeleportCommenceLocation();
|
||||||
Location newLocation = mcMMOPlayer.getPlayer().getLocation();
|
Location newLocation = mcMMOPlayer.getNative().getLocation();
|
||||||
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
long recentlyHurt = mcMMOPlayer.getRecentlyHurt();
|
||||||
|
|
||||||
mcMMOPlayer.setTeleportCommenceLocation(null);
|
mcMMOPlayer.setTeleportCommenceLocation(null);
|
||||||
|
@ -19,13 +19,13 @@ public class AbilityCooldownTask extends BukkitRunnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!mcMMOPlayer.getPlayer().isOnline() || mcMMOPlayer.getSuperAbilityInformed(superAbilityType)) {
|
if (!mcMMOPlayer.getNative().isOnline() || mcMMOPlayer.getSuperAbilityInformed(superAbilityType)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMOPlayer.setAbilityInformed(superAbilityType, true);
|
mcMMOPlayer.setAbilityInformed(superAbilityType, true);
|
||||||
|
|
||||||
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.ABILITY_REFRESHED, pluginRef.getSkillTools().getSuperAbilityRefreshedLocaleKey(superAbilityType));
|
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(), NotificationType.ABILITY_REFRESHED, pluginRef.getSkillTools().getSuperAbilityRefreshedLocaleKey(superAbilityType));
|
||||||
//mcMMOPlayer.getPlayer().sendMessage(ability.getAbilityRefresh());
|
//mcMMOPlayer.getPlayer().sendMessage(ability.getAbilityRefresh());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class AbilityDisableTask extends BukkitRunnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
|
|
||||||
switch (superAbilityType) {
|
switch (superAbilityType) {
|
||||||
case SUPER_BREAKER:
|
case SUPER_BREAKER:
|
||||||
|
@ -26,7 +26,7 @@ public class ToolLowerTask extends BukkitRunnable {
|
|||||||
mcMMOPlayer.setToolPreparationMode(tool, false);
|
mcMMOPlayer.setToolPreparationMode(tool, false);
|
||||||
|
|
||||||
if (pluginRef.getConfigManager().getConfigNotifications().isSuperAbilityToolMessage()) {
|
if (pluginRef.getConfigManager().getConfigNotifications().isSuperAbilityToolMessage()) {
|
||||||
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getPlayer(), NotificationType.TOOL, tool.getLowerTool());
|
pluginRef.getNotificationManager().sendPlayerInformation(mcMMOPlayer.getNative(), NotificationType.TOOL, tool.getLowerTool());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ public abstract class SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Player getPlayer() {
|
||||||
return mcMMOPlayer.getPlayer();
|
return mcMMOPlayer.getNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSkillLevel() {
|
public int getSkillLevel() {
|
||||||
|
@ -349,7 +349,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if(mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Plants processed: "+brokenPlants.size());
|
mcMMOPlayer.getNative().sendMessage("Plants processed: "+brokenPlants.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reward XP
|
//Reward XP
|
||||||
@ -400,8 +400,8 @@ public class HerbalismManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mcMMOPlayer.isDebugMode()) {
|
if(mcMMOPlayer.isDebugMode()) {
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Chorus Plants checked for XP: "+brokenPlants.size());
|
mcMMOPlayer.getNative().sendMessage("Chorus Plants checked for XP: "+brokenPlants.size());
|
||||||
mcMMOPlayer.getPlayer().sendMessage("Valid Chorus Plant XP Gains: "+blocksGivingXP);
|
mcMMOPlayer.getNative().sendMessage("Valid Chorus Plant XP Gains: "+blocksGivingXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reward XP
|
//Reward XP
|
||||||
|
@ -20,7 +20,7 @@ public final class ChimaeraWing {
|
|||||||
public ChimaeraWing(mcMMO pluginRef, BukkitMMOPlayer mcMMOPlayer) {
|
public ChimaeraWing(mcMMO pluginRef, BukkitMMOPlayer mcMMOPlayer) {
|
||||||
this.pluginRef = pluginRef;
|
this.pluginRef = pluginRef;
|
||||||
this.mcMMOPlayer = mcMMOPlayer;
|
this.mcMMOPlayer = mcMMOPlayer;
|
||||||
this.player = mcMMOPlayer.getPlayer();
|
this.player = mcMMOPlayer.getNative();
|
||||||
this.location = player.getLocation();
|
this.location = player.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ public final class ChimaeraWing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void chimaeraExecuteTeleport() {
|
public void chimaeraExecuteTeleport() {
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
|
|
||||||
if (pluginRef.getConfigManager().getConfigItems().doesChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
if (pluginRef.getConfigManager().getConfigItems().doesChimaeraUseBedSpawn() && player.getBedSpawnLocation() != null) {
|
||||||
player.teleport(player.getBedSpawnLocation());
|
player.teleport(player.getBedSpawnLocation());
|
||||||
|
@ -69,7 +69,7 @@ public final class CommandTools {
|
|||||||
*/
|
*/
|
||||||
public boolean checkPlayerExistence(CommandSender sender, String playerName, BukkitMMOPlayer mcMMOPlayer) {
|
public boolean checkPlayerExistence(CommandSender sender, String playerName, BukkitMMOPlayer mcMMOPlayer) {
|
||||||
if (mcMMOPlayer != null) {
|
if (mcMMOPlayer != null) {
|
||||||
if (hidden(sender, mcMMOPlayer.getPlayer(), false)) {
|
if (hidden(sender, mcMMOPlayer.getNative(), false)) {
|
||||||
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Offline"));
|
sender.sendMessage(pluginRef.getLocaleManager().getString("Commands.Offline"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -156,9 +156,9 @@ public class ExperienceBarWrapper {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
private void createBossBar() {
|
private void createBossBar() {
|
||||||
bossBar = mcMMOPlayer.getPlayer().getServer().createBossBar(title,
|
bossBar = mcMMOPlayer.getNative().getServer().createBossBar(title,
|
||||||
pluginRef.getConfigManager().getConfigLeveling().getXPBarColor(primarySkillType),
|
pluginRef.getConfigManager().getConfigLeveling().getXPBarColor(primarySkillType),
|
||||||
pluginRef.getConfigManager().getConfigLeveling().getXPBarStyle(primarySkillType));
|
pluginRef.getConfigManager().getConfigLeveling().getXPBarStyle(primarySkillType));
|
||||||
bossBar.addPlayer(mcMMOPlayer.getPlayer());
|
bossBar.addPlayer(mcMMOPlayer.getNative());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ public class NotificationManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TextComponent levelUpTextComponent = pluginRef.getTextComponentFactory().getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel);
|
TextComponent levelUpTextComponent = pluginRef.getTextComponentFactory().getNotificationLevelUpTextComponent(skillName, levelsGained, newLevel);
|
||||||
McMMOPlayerNotificationEvent customEvent = pluginRef.getEventManager().createAndCallNotificationEvent(mcMMOPlayer.getPlayer(), NotificationType.LEVEL_UP_MESSAGE, levelUpTextComponent);
|
McMMOPlayerNotificationEvent customEvent = pluginRef.getEventManager().createAndCallNotificationEvent(mcMMOPlayer.getNative(), NotificationType.LEVEL_UP_MESSAGE, levelUpTextComponent);
|
||||||
|
|
||||||
sendNotification(customEvent);
|
sendNotification(customEvent);
|
||||||
}
|
}
|
||||||
@ -189,10 +189,10 @@ public class NotificationManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
//CHAT MESSAGE
|
//CHAT MESSAGE
|
||||||
mcMMOPlayer.getPlayer().spigot().sendMessage(pluginRef.getTextComponentFactory().getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getPlayer(), subSkillType));
|
mcMMOPlayer.getNative().spigot().sendMessage(pluginRef.getTextComponentFactory().getSubSkillUnlockedNotificationComponents(mcMMOPlayer.getNative(), subSkillType));
|
||||||
|
|
||||||
//Unlock Sound Effect
|
//Unlock Sound Effect
|
||||||
pluginRef.getSoundManager().sendCategorizedSound(mcMMOPlayer.getPlayer(), mcMMOPlayer.getPlayer().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
pluginRef.getSoundManager().sendCategorizedSound(mcMMOPlayer.getNative(), mcMMOPlayer.getNative().getLocation(), SoundType.SKILL_UNLOCKED, SoundCategory.MASTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +30,7 @@ public final class UserManager {
|
|||||||
* @param mcMMOPlayer the player profile to start tracking
|
* @param mcMMOPlayer the player profile to start tracking
|
||||||
*/
|
*/
|
||||||
public void track(BukkitMMOPlayer mcMMOPlayer) {
|
public void track(BukkitMMOPlayer mcMMOPlayer) {
|
||||||
mcMMOPlayer.getPlayer().setMetadata(MetadataConstants.PLAYER_DATA_METAKEY, new FixedMetadataValue(pluginRef, mcMMOPlayer));
|
mcMMOPlayer.getNative().setMetadata(MetadataConstants.PLAYER_DATA_METAKEY, new FixedMetadataValue(pluginRef, mcMMOPlayer));
|
||||||
|
|
||||||
if(playerDataSet == null)
|
if(playerDataSet == null)
|
||||||
playerDataSet = new HashSet<>();
|
playerDataSet = new HashSet<>();
|
||||||
|
@ -245,7 +245,7 @@ public class ScoreboardManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = mcMMOPlayer.getPlayer();
|
Player player = mcMMOPlayer.getNative();
|
||||||
int power = mcMMOPlayer.getPowerLevel();
|
int power = mcMMOPlayer.getPowerLevel();
|
||||||
|
|
||||||
mainObjective.getScore(playerName).setScore(power);
|
mainObjective.getScore(playerName).setScore(power);
|
||||||
|
@ -11,7 +11,6 @@ import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
|||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.mcmmo.api.data.MMOPlayer;
|
|
||||||
import com.gmail.nossr50.runnables.skills.AwardCombatXpTask;
|
import com.gmail.nossr50.runnables.skills.AwardCombatXpTask;
|
||||||
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
import com.gmail.nossr50.skills.acrobatics.AcrobaticsManager;
|
||||||
import com.gmail.nossr50.skills.archery.ArcheryManager;
|
import com.gmail.nossr50.skills.archery.ArcheryManager;
|
||||||
@ -739,7 +738,7 @@ public final class CombatTools {
|
|||||||
XPGainReason xpGainReason;
|
XPGainReason xpGainReason;
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player) {
|
||||||
if (!pluginRef.getConfigManager().getConfigExperience().isPvpXPEnabled() || pluginRef.getPartyManager().inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
|
if (!pluginRef.getConfigManager().getConfigExperience().isPvpXPEnabled() || pluginRef.getPartyManager().inSameParty(mcMMOPlayer.getNative(), (Player) target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class RankTools {
|
|||||||
*/
|
*/
|
||||||
public void executeSkillUnlockNotifications(BukkitMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel) {
|
public void executeSkillUnlockNotifications(BukkitMMOPlayer mcMMOPlayer, PrimarySkillType primarySkillType, int newLevel) {
|
||||||
for (SubSkillType subSkillType : pluginRef.getSkillTools().getSkillAbilities(primarySkillType)) {
|
for (SubSkillType subSkillType : pluginRef.getSkillTools().getSkillAbilities(primarySkillType)) {
|
||||||
int playerRankInSkill = getRank(mcMMOPlayer.getPlayer(), subSkillType);
|
int playerRankInSkill = getRank(mcMMOPlayer.getNative(), subSkillType);
|
||||||
|
|
||||||
HashMap<Integer, Integer> innerMap = subSkillRanks.get(subSkillType.toString());
|
HashMap<Integer, Integer> innerMap = subSkillRanks.get(subSkillType.toString());
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ public class RankTools {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
//Don't send notifications if the player lacks the permission node
|
//Don't send notifications if the player lacks the permission node
|
||||||
if(!pluginRef.getPermissionTools().isSubSkillEnabled(mcMMOPlayer.getPlayer(), subSkillType))
|
if(!pluginRef.getPermissionTools().isSubSkillEnabled(mcMMOPlayer.getNative(), subSkillType))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//The players level is the exact level requirement for this skill
|
//The players level is the exact level requirement for this skill
|
||||||
|
@ -280,7 +280,7 @@ public class SkillTools {
|
|||||||
* @return how long an ability should last in seconds
|
* @return how long an ability should last in seconds
|
||||||
*/
|
*/
|
||||||
public int calculateAbilityLengthPerks(BukkitMMOPlayer mcMMOPlayer, PrimarySkillType skill, SuperAbilityType superAbilityType) {
|
public int calculateAbilityLengthPerks(BukkitMMOPlayer mcMMOPlayer, PrimarySkillType skill, SuperAbilityType superAbilityType) {
|
||||||
return getEnduranceLength(mcMMOPlayer.getPlayer()) + calculateAbilityLength(mcMMOPlayer, skill, superAbilityType);
|
return getEnduranceLength(mcMMOPlayer.getNative()) + calculateAbilityLength(mcMMOPlayer, skill, superAbilityType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEnduranceLength(Player player) {
|
public int getEnduranceLength(Player player) {
|
||||||
|
Loading…
Reference in New Issue
Block a user