mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-12-22 04:37:46 +01:00
Final Bug Fixes
This commit is contained in:
parent
4db1a93436
commit
ba1251bbe2
@ -24,7 +24,6 @@ import net.Indyuce.mmocore.comp.region.WorldGuardRegionHandler;
|
|||||||
import net.Indyuce.mmocore.comp.region.pvpmode.PvPModeListener;
|
import net.Indyuce.mmocore.comp.region.pvpmode.PvPModeListener;
|
||||||
import net.Indyuce.mmocore.comp.vault.VaultEconomy;
|
import net.Indyuce.mmocore.comp.vault.VaultEconomy;
|
||||||
import net.Indyuce.mmocore.comp.vault.VaultMMOLoader;
|
import net.Indyuce.mmocore.comp.vault.VaultMMOLoader;
|
||||||
import net.Indyuce.mmocore.gui.api.packets.InventoryPacketListener;
|
|
||||||
import net.Indyuce.mmocore.guild.GuildModule;
|
import net.Indyuce.mmocore.guild.GuildModule;
|
||||||
import net.Indyuce.mmocore.guild.GuildModuleType;
|
import net.Indyuce.mmocore.guild.GuildModuleType;
|
||||||
import net.Indyuce.mmocore.guild.GuildRelationHandler;
|
import net.Indyuce.mmocore.guild.GuildRelationHandler;
|
||||||
@ -264,9 +263,6 @@ public class MMOCore extends JavaPlugin {
|
|||||||
// load guild data after loading player data
|
// load guild data after loading player data
|
||||||
dataProvider.getGuildManager().load();
|
dataProvider.getGuildManager().load();
|
||||||
|
|
||||||
//TODO: Remove
|
|
||||||
new InventoryPacketListener();
|
|
||||||
|
|
||||||
// Toggleable Commands
|
// Toggleable Commands
|
||||||
ToggleableCommand.register();
|
ToggleableCommand.register();
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class AttributesCommand extends RegisteredCommand {
|
|||||||
PlayerData data = PlayerData.get((Player) sender);
|
PlayerData data = PlayerData.get((Player) sender);
|
||||||
MMOCommandEvent event = new MMOCommandEvent(data, "attributes");
|
MMOCommandEvent event = new MMOCommandEvent(data, "attributes");
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(!event.isCancelled()) InventoryManager.ATTRIBUTE_VIEW.newInventory(data).open();
|
if(!event.isCancelled()) InventoryManager.ATTRIBUTE_VIEW.generate(data,null).open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,9 +32,9 @@ public class ClassCommand extends RegisteredCommand {
|
|||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(event.isCancelled()) return true;
|
if(event.isCancelled()) return true;
|
||||||
if (data.getProfess().getSubclasses().stream().anyMatch(sub -> sub.getLevel() <= data.getLevel()))
|
if (data.getProfess().getSubclasses().stream().anyMatch(sub -> sub.getLevel() <= data.getLevel()))
|
||||||
InventoryManager.SUBCLASS_SELECT.newInventory(data).open();
|
InventoryManager.SUBCLASS_SELECT.generate(data,null).open();
|
||||||
else
|
else
|
||||||
InventoryManager.CLASS_SELECT.generate(data).open();
|
InventoryManager.CLASS_SELECT.generate(data,null).open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class FriendsCommand extends RegisteredCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryManager.FRIEND_LIST.newInventory(data).open();
|
InventoryManager.FRIEND_LIST.generate(data,null).open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,9 @@ public class GuildCommand extends RegisteredCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.inGuild())
|
if (data.inGuild())
|
||||||
InventoryManager.GUILD_VIEW.newInventory(data).open();
|
InventoryManager.GUILD_VIEW.generate(data, null).open();
|
||||||
else
|
else
|
||||||
InventoryManager.GUILD_CREATION.newInventory(data).open();
|
InventoryManager.GUILD_CREATION.generate(data, null).open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,9 +74,9 @@ public class PartyCommand extends RegisteredCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (data.getParty() != null)
|
if (data.getParty() != null)
|
||||||
InventoryManager.PARTY_VIEW.newInventory(data).open();
|
InventoryManager.PARTY_VIEW.generate(data,null).open();
|
||||||
else
|
else
|
||||||
InventoryManager.PARTY_CREATION.newInventory(data).open();
|
InventoryManager.PARTY_CREATION.generate(data,null).open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class PlayerStatsCommand extends RegisteredCommand {
|
|||||||
PlayerData data = PlayerData.get((Player) sender);
|
PlayerData data = PlayerData.get((Player) sender);
|
||||||
MMOCommandEvent event = new MMOCommandEvent(data, "profile");
|
MMOCommandEvent event = new MMOCommandEvent(data, "profile");
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if (!event.isCancelled()) InventoryManager.PLAYER_STATS.generate(data).open();
|
if (!event.isCancelled()) InventoryManager.PLAYER_STATS.generate(data, null).open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public class QuestsCommand extends RegisteredCommand {
|
|||||||
PlayerData data = PlayerData.get((Player) sender);
|
PlayerData data = PlayerData.get((Player) sender);
|
||||||
MMOCommandEvent event = new MMOCommandEvent(data, "quests");
|
MMOCommandEvent event = new MMOCommandEvent(data, "quests");
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(!event.isCancelled()) InventoryManager.QUEST_LIST.newInventory(data).open();
|
if(!event.isCancelled()) InventoryManager.QUEST_LIST.generate(data,null).open();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ public class SkillTreesCommand extends RegisteredCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (data.getProfess().getSkillTrees().size() != 0) {
|
if (data.getProfess().getSkillTrees().size() != 0) {
|
||||||
InventoryManager.TREE_VIEW.generate(data).open();
|
InventoryManager.TREE_VIEW.generate(data, null).open();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("no-skill-tree").send(player);
|
MMOCore.plugin.configManager.getSimpleMessage("no-skill-tree").send(player);
|
||||||
@ -60,7 +60,7 @@ public class SkillTreesCommand extends RegisteredCommand {
|
|||||||
.filter(skillTree -> UtilityMethods.ymlName(skillTree.getId()).equals(UtilityMethods.ymlName(args[0])))
|
.filter(skillTree -> UtilityMethods.ymlName(skillTree.getId()).equals(UtilityMethods.ymlName(args[0])))
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
.size() != 0) {
|
.size() != 0) {
|
||||||
InventoryManager.SPECIFIC_TREE_VIEW.get(UtilityMethods.ymlName(args[0])).generate(data).open();
|
InventoryManager.SPECIFIC_TREE_VIEW.get(UtilityMethods.ymlName(args[0])).generate(data, null).open();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage(ChatColor.RED + "Your class does not have a skill tree with id: " + args[0]);
|
sender.sendMessage(ChatColor.RED + "Your class does not have a skill tree with id: " + args[0]);
|
||||||
|
@ -31,7 +31,7 @@ public class SkillsCommand extends RegisteredCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryManager.SKILL_LIST.newInventory(data).open();
|
InventoryManager.SKILL_LIST.generate(data,null).open();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -11,18 +11,18 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class WaypointsCommand extends RegisteredCommand {
|
public class WaypointsCommand extends RegisteredCommand {
|
||||||
public WaypointsCommand(ConfigurationSection config) {
|
public WaypointsCommand(ConfigurationSection config) {
|
||||||
super(config, ToggleableCommand.WAYPOINTS);
|
super(config, ToggleableCommand.WAYPOINTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if (sender instanceof Player && sender.hasPermission("mmocore.waypoints")) {
|
if (sender instanceof Player && sender.hasPermission("mmocore.waypoints")) {
|
||||||
PlayerData data = PlayerData.get((Player) sender);
|
PlayerData data = PlayerData.get((Player) sender);
|
||||||
MMOCommandEvent event = new MMOCommandEvent(data, "waypoints");
|
MMOCommandEvent event = new MMOCommandEvent(data, "waypoints");
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(!event.isCancelled()) InventoryManager.WAYPOINTS.generate(data).open();
|
if (!event.isCancelled()) InventoryManager.WAYPOINTS.generate(data, null).open();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,24 +11,24 @@ import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
|||||||
import io.lumine.mythic.lib.command.api.Parameter;
|
import io.lumine.mythic.lib.command.api.Parameter;
|
||||||
|
|
||||||
public class OpenCommandTreeNode extends CommandTreeNode {
|
public class OpenCommandTreeNode extends CommandTreeNode {
|
||||||
public OpenCommandTreeNode(CommandTreeNode parent) {
|
public OpenCommandTreeNode(CommandTreeNode parent) {
|
||||||
super(parent, "open");
|
super(parent, "open");
|
||||||
|
|
||||||
addParameter(Parameter.PLAYER);
|
addParameter(Parameter.PLAYER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(CommandSender sender, String[] args) {
|
public CommandResult execute(CommandSender sender, String[] args) {
|
||||||
if (args.length < 3)
|
if (args.length < 3)
|
||||||
return CommandResult.THROW_USAGE;
|
return CommandResult.THROW_USAGE;
|
||||||
|
|
||||||
Player player = Bukkit.getPlayer(args[2]);
|
Player player = Bukkit.getPlayer(args[2]);
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
sender.sendMessage(ChatColor.RED + "Could not find player " + args[2]);
|
sender.sendMessage(ChatColor.RED + "Could not find player " + args[2]);
|
||||||
return CommandResult.FAILURE;
|
return CommandResult.FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryManager.WAYPOINTS.generate(PlayerData.get(player)).open();
|
InventoryManager.WAYPOINTS.generate(PlayerData.get(player), null).open();
|
||||||
return CommandResult.SUCCESS;
|
return CommandResult.SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ public class ForceClassProfileDataModule implements ProfileDataModule, Listener
|
|||||||
}
|
}
|
||||||
|
|
||||||
final PlayerData playerData = PlayerData.get(event.getPlayerData().getPlayer());
|
final PlayerData playerData = PlayerData.get(event.getPlayerData().getPlayer());
|
||||||
InventoryManager.CLASS_SELECT.generate(playerData, () -> event.validate(this)).open();
|
InventoryManager.CLASS_SELECT.generate(playerData, () -> event.validate(this), null).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,8 +62,7 @@ public class ForceClassProfileDataModule implements ProfileDataModule, Listener
|
|||||||
if (!event.hasProfileEvent()) {
|
if (!event.hasProfileEvent()) {
|
||||||
Validate.isTrue(MythicLib.plugin.getProfileMode() == ProfileMode.PROXY, "Listened to a data load event with no profile event attached but proxy-based profiles are disabled");
|
Validate.isTrue(MythicLib.plugin.getProfileMode() == ProfileMode.PROXY, "Listened to a data load event with no profile event attached but proxy-based profiles are disabled");
|
||||||
if (playerData.getProfess().equals(MMOCore.plugin.classManager.getDefaultClass()))
|
if (playerData.getProfess().equals(MMOCore.plugin.classManager.getDefaultClass()))
|
||||||
InventoryManager.CLASS_SELECT.generate(playerData, () -> {
|
InventoryManager.CLASS_SELECT.generate(playerData, null).open();
|
||||||
}).open();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ public class ForceClassProfileDataModule implements ProfileDataModule, Listener
|
|||||||
|
|
||||||
// Validate if necessary
|
// Validate if necessary
|
||||||
if (playerData.getProfess().equals(MMOCore.plugin.classManager.getDefaultClass()))
|
if (playerData.getProfess().equals(MMOCore.plugin.classManager.getDefaultClass()))
|
||||||
InventoryManager.CLASS_SELECT.generate(playerData, () -> event1.validate(this)).open();
|
InventoryManager.CLASS_SELECT.generate(playerData, () -> event1.validate(this), null).open();
|
||||||
else event1.validate(this);
|
else event1.validate(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,10 +42,10 @@ public class ClassSelect extends EditableInventory<PlayerData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GeneratedInventory generate(PlayerData playerData, @Nullable GeneratedInventory generatedInventory) {
|
public GeneratedInventory generate(PlayerData playerData, @Nullable GeneratedInventory generatedInventory) {
|
||||||
return generate(playerData, null, null);
|
return generate(playerData, ()->{}, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeneratedInventory generate(PlayerData playerData, @Nullable GeneratedInventory generatedInventory, @Nullable Runnable profileRunnable) {
|
public GeneratedInventory generate(PlayerData playerData, @Nullable Runnable profileRunnable, @Nullable GeneratedInventory generatedInventory) {
|
||||||
return new ProfessSelectionInventory(playerData, this, profileRunnable);
|
return new ProfessSelectionInventory(playerData, this, profileRunnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import net.Indyuce.mmocore.party.AbstractParty;
|
|||||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
import net.Indyuce.mmocore.player.stats.StatInfo;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
@ -125,7 +126,7 @@ public class PlayerStats extends EditableInventory<PlayerData> {
|
|||||||
final net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.target.getStats();
|
final net.Indyuce.mmocore.api.player.stats.PlayerStats stats = inv.target.getStats();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String apply(Player player, String str) {
|
public String apply(OfflinePlayer player, String str) {
|
||||||
String explored = str;
|
String explored = str;
|
||||||
// Internal placeholders
|
// Internal placeholders
|
||||||
while (explored.contains("{") && explored.substring(explored.indexOf("{")).contains("}")) {
|
while (explored.contains("{") && explored.substring(explored.indexOf("{")).contains("}")) {
|
||||||
|
@ -60,11 +60,11 @@ public class WaypointViewer extends EditableInventory<PlayerData> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GeneratedInventory generate(PlayerData data, @Nullable GeneratedInventory generatedInventory) {
|
public GeneratedInventory generate(PlayerData data, @Nullable GeneratedInventory generatedInventory) {
|
||||||
return newInventory(data, null, null);
|
return generate(data, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GeneratedInventory newInventory(PlayerData data, Waypoint waypoint, @Nullable GeneratedInventory generatedInventory) {
|
public GeneratedInventory generate(PlayerData data, Waypoint waypoint, @Nullable GeneratedInventory prev) {
|
||||||
return new WaypointViewerInventory(data, this, waypoint);
|
return new WaypointViewerInventory(data, this, waypoint, prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WaypointItem extends SimpleItem<WaypointViewerInventory> {
|
public class WaypointItem extends SimpleItem<WaypointViewerInventory> {
|
||||||
@ -182,8 +182,8 @@ public class WaypointViewer extends EditableInventory<PlayerData> {
|
|||||||
|
|
||||||
private int page;
|
private int page;
|
||||||
|
|
||||||
public WaypointViewerInventory(PlayerData playerData, EditableInventory editable, Waypoint current) {
|
public WaypointViewerInventory(PlayerData playerData, EditableInventory editable, Waypoint current, @Nullable GeneratedInventory prev) {
|
||||||
super(playerData, editable);
|
super(playerData, editable, prev);
|
||||||
|
|
||||||
this.current = current;
|
this.current = current;
|
||||||
if (current != null)
|
if (current != null)
|
||||||
|
@ -10,7 +10,7 @@ import com.comphenix.protocol.ProtocolLibrary;
|
|||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||||
|
/*
|
||||||
public class InventoryPacketListener {
|
public class InventoryPacketListener {
|
||||||
|
|
||||||
|
|
||||||
@ -100,10 +100,10 @@ public class InventoryPacketListener {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
super.write(ctx,packetObj,promise);
|
super.write(ctx,packetObj,promise);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,8 +71,8 @@ public class EditableFriendList extends EditableInventory<PlayerData> {
|
|||||||
|
|
||||||
|
|
||||||
public static class OfflineFriendItem extends InventoryItem<FriendListInventory> {
|
public static class OfflineFriendItem extends InventoryItem<FriendListInventory> {
|
||||||
public OfflineFriendItem(FriendItem parent, ConfigurationSection config) {
|
public OfflineFriendItem(ConfigurationSection config) {
|
||||||
super(parent, config);
|
super(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -98,8 +98,8 @@ public class EditableFriendList extends EditableInventory<PlayerData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class OnlineFriendItem extends SimpleItem<FriendListInventory> {
|
public static class OnlineFriendItem extends SimpleItem<FriendListInventory> {
|
||||||
public OnlineFriendItem(FriendItem parent, ConfigurationSection config) {
|
public OnlineFriendItem(ConfigurationSection config) {
|
||||||
super(parent, config);
|
super(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -138,8 +138,8 @@ public class EditableFriendList extends EditableInventory<PlayerData> {
|
|||||||
Validate.notNull(config.contains("online"), "Could not load online config");
|
Validate.notNull(config.contains("online"), "Could not load online config");
|
||||||
Validate.notNull(config.contains("offline"), "Could not load offline config");
|
Validate.notNull(config.contains("offline"), "Could not load offline config");
|
||||||
|
|
||||||
online = new OnlineFriendItem(this, config.getConfigurationSection("online"));
|
online = new OnlineFriendItem(config.getConfigurationSection("online"));
|
||||||
offline = new OfflineFriendItem(this, config.getConfigurationSection("offline"));
|
offline = new OfflineFriendItem(config.getConfigurationSection("offline"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -95,7 +95,7 @@ public class EditableGuildView extends EditableInventory<PlayerData> {
|
|||||||
private final MemberDisplayItem member;
|
private final MemberDisplayItem member;
|
||||||
|
|
||||||
public MemberItem(ConfigurationSection config) {
|
public MemberItem(ConfigurationSection config) {
|
||||||
super(Material.BARRIER, config);
|
super(config, Material.BARRIER);
|
||||||
|
|
||||||
Validate.notNull(config.contains("empty"), "Could not load empty config");
|
Validate.notNull(config.contains("empty"), "Could not load empty config");
|
||||||
Validate.notNull(config.contains("member"), "Could not load member config");
|
Validate.notNull(config.contains("member"), "Could not load member config");
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package net.Indyuce.mmocore.guild.provided;
|
package net.Indyuce.mmocore.guild.provided;
|
||||||
|
|
||||||
|
import io.lumine.mythic.lib.data.PlayerProvider;
|
||||||
|
import io.lumine.mythic.lib.gui.framework.PluginInventory;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
import net.Indyuce.mmocore.api.ConfigMessage;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
@ -63,7 +65,7 @@ public class Guild implements AbstractGuild {
|
|||||||
public void removeMember(UUID uuid, boolean disband) {
|
public void removeMember(UUID uuid, boolean disband) {
|
||||||
PlayerData data = PlayerData.get(uuid);
|
PlayerData data = PlayerData.get(uuid);
|
||||||
if (data != null && data.isOnline() && data.getPlayer().getOpenInventory() != null && data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditableGuildView.GuildViewInventory)
|
if (data != null && data.isOnline() && data.getPlayer().getOpenInventory() != null && data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditableGuildView.GuildViewInventory)
|
||||||
InventoryManager.GUILD_CREATION.newInventory(data).open();
|
InventoryManager.GUILD_CREATION.generate(data, null).open();
|
||||||
|
|
||||||
if (!disband)
|
if (!disband)
|
||||||
members.remove(uuid);
|
members.remove(uuid);
|
||||||
@ -103,7 +105,7 @@ public class Guild implements AbstractGuild {
|
|||||||
for (UUID uuid : members) {
|
for (UUID uuid : members) {
|
||||||
PlayerData member = PlayerData.get(uuid);
|
PlayerData member = PlayerData.get(uuid);
|
||||||
if (member != null && member.isOnline() && member.getPlayer().getOpenInventory() != null && member.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditableGuildView.GuildViewInventory)
|
if (member != null && member.isOnline() && member.getPlayer().getOpenInventory() != null && member.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditableGuildView.GuildViewInventory)
|
||||||
((PluginInventory) member.getPlayer().getOpenInventory().getTopInventory().getHolder()).open();
|
((PluginInventory<PlayerData>) member.getPlayer().getOpenInventory().getTopInventory().getHolder()).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,6 @@ public class GuildInvite extends Request {
|
|||||||
);
|
);
|
||||||
|
|
||||||
guild.addMember(getTarget().getUniqueId());
|
guild.addMember(getTarget().getUniqueId());
|
||||||
InventoryManager.GUILD_VIEW.newInventory(getTarget()).open();
|
InventoryManager.GUILD_VIEW.generate(getTarget(), null).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -19,7 +19,7 @@ import java.util.logging.Level;
|
|||||||
public class RestrictionManager implements MMOCoreManager {
|
public class RestrictionManager implements MMOCoreManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Using {@link ItemType#getDisplayedItem()} instead of an ItemType as
|
* Using {@link ItemType#display()} instead of an ItemType as
|
||||||
* map key to utilize the HashMap O(1) time complexity of the
|
* map key to utilize the HashMap O(1) time complexity of the
|
||||||
* get function instead of iterating through the key set.
|
* get function instead of iterating through the key set.
|
||||||
*/
|
*/
|
||||||
@ -51,12 +51,12 @@ public class RestrictionManager implements MMOCoreManager {
|
|||||||
try {
|
try {
|
||||||
perms.postLoad();
|
perms.postLoad();
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
MMOCore.log(Level.WARNING, "Could not post-load perm set '" + perms.getTool().getDisplayedItem() + "': " + exception.getMessage());
|
MMOCore.log(Level.WARNING, "Could not post-load perm set '" + perms.getTool().display() + "': " + exception.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register(ToolPermissions perms) {
|
public void register(ToolPermissions perms) {
|
||||||
map.put(perms.getTool().getDisplayedItem(), perms);
|
map.put(perms.getTool().display(), perms);
|
||||||
|
|
||||||
if (perms.isDefault()) {
|
if (perms.isDefault()) {
|
||||||
Validate.isTrue(defaultPermissions == null, "There is already a default tool permission set");
|
Validate.isTrue(defaultPermissions == null, "There is already a default tool permission set");
|
||||||
@ -69,12 +69,12 @@ public class RestrictionManager implements MMOCoreManager {
|
|||||||
*
|
*
|
||||||
* @param item The item used to break a block
|
* @param item The item used to break a block
|
||||||
* @return A list of all the blocks an item is allowed to break.
|
* @return A list of all the blocks an item is allowed to break.
|
||||||
* If it was not registered earlier, it returns the default permission
|
* If it was not registered earlier, it returns the default permission
|
||||||
* set. If there is no default permission set, returns null
|
* set. If there is no default permission set, returns null
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
public ToolPermissions getPermissions(ItemStack item) {
|
public ToolPermissions getPermissions(ItemStack item) {
|
||||||
String mapKey = ItemType.fromItemStack(item).getDisplayedItem();
|
String mapKey = ItemType.fromItemStack(item).display();
|
||||||
ToolPermissions found = map.get(mapKey);
|
ToolPermissions found = map.get(mapKey);
|
||||||
return found == null ? defaultPermissions : found;
|
return found == null ? defaultPermissions : found;
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ public class RestrictionManager implements MMOCoreManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Either parent if provided or default tool permission set if this is
|
* @return Either parent if provided or default tool permission set if this is
|
||||||
* not the default set already, or null otherwise.
|
* not the default set already, or null otherwise.
|
||||||
*/
|
*/
|
||||||
public ToolPermissions getParent() {
|
public ToolPermissions getParent() {
|
||||||
return parent != null ? parent : defaultSet ? null : defaultPermissions;
|
return parent != null ? parent : defaultSet ? null : defaultPermissions;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package net.Indyuce.mmocore.party.provided;
|
package net.Indyuce.mmocore.party.provided;
|
||||||
|
|
||||||
|
import io.lumine.mythic.lib.gui.framework.PluginInventory;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.gui.social.party.EditablePartyView;
|
import net.Indyuce.mmocore.gui.social.party.EditablePartyView;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
@ -107,7 +108,7 @@ public class Party implements AbstractParty {
|
|||||||
public void removeMember(PlayerData data, boolean notify) {
|
public void removeMember(PlayerData data, boolean notify) {
|
||||||
if (data.isOnline() && data.getPlayer().getOpenInventory() != null
|
if (data.isOnline() && data.getPlayer().getOpenInventory() != null
|
||||||
&& data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditablePartyView.PartyViewInventory)
|
&& data.getPlayer().getOpenInventory().getTopInventory().getHolder() instanceof EditablePartyView.PartyViewInventory)
|
||||||
InventoryManager.PARTY_CREATION.newInventory(data).open();
|
InventoryManager.PARTY_CREATION.generate(data,null).open();
|
||||||
|
|
||||||
members.remove(data);
|
members.remove(data);
|
||||||
|
|
||||||
|
@ -38,6 +38,6 @@ public class PartyInvite extends Request {
|
|||||||
if (party.getOwner().isOnline())
|
if (party.getOwner().isOnline())
|
||||||
MMOCore.plugin.configManager.getSimpleMessage("party-joined", "owner", party.getOwner().getPlayer().getName()).send(getTarget().getPlayer());
|
MMOCore.plugin.configManager.getSimpleMessage("party-joined", "owner", party.getOwner().getPlayer().getName()).send(getTarget().getPlayer());
|
||||||
party.addMember(getTarget());
|
party.addMember(getTarget());
|
||||||
InventoryManager.PARTY_VIEW.newInventory(getTarget()).open();
|
InventoryManager.PARTY_VIEW.generate(getTarget(), null).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package net.Indyuce.mmocore.skill;
|
package net.Indyuce.mmocore.skill;
|
||||||
|
|
||||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||||
|
import io.lumine.mythic.lib.gui.framework.item.Placeholders;
|
||||||
import io.lumine.mythic.lib.player.cooldown.CooldownObject;
|
import io.lumine.mythic.lib.player.cooldown.CooldownObject;
|
||||||
import io.lumine.mythic.lib.player.modifier.ModifierSource;
|
import io.lumine.mythic.lib.player.modifier.ModifierSource;
|
||||||
import io.lumine.mythic.lib.player.skill.PassiveSkill;
|
import io.lumine.mythic.lib.player.skill.PassiveSkill;
|
||||||
|
@ -3,6 +3,7 @@ package net.Indyuce.mmocore.skill.cast.listener;
|
|||||||
import io.lumine.mythic.lib.UtilityMethods;
|
import io.lumine.mythic.lib.UtilityMethods;
|
||||||
import io.lumine.mythic.lib.api.event.skill.PlayerCastSkillEvent;
|
import io.lumine.mythic.lib.api.event.skill.PlayerCastSkillEvent;
|
||||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||||
|
import io.lumine.mythic.lib.gui.framework.item.Placeholders;
|
||||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||||
import io.lumine.mythic.lib.skill.trigger.TriggerMetadata;
|
import io.lumine.mythic.lib.skill.trigger.TriggerMetadata;
|
||||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||||
|
@ -3,6 +3,7 @@ package net.Indyuce.mmocore.listener;
|
|||||||
|
|
||||||
import io.lumine.mythic.lib.UtilityMethods;
|
import io.lumine.mythic.lib.UtilityMethods;
|
||||||
import io.lumine.mythic.lib.api.event.PlayerAttackEvent;
|
import io.lumine.mythic.lib.api.event.PlayerAttackEvent;
|
||||||
|
import io.lumine.mythic.lib.gui.framework.PluginInventory;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent;
|
import net.Indyuce.mmocore.api.event.PlayerResourceUpdateEvent;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
@ -20,24 +21,6 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
|||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
/**
|
|
||||||
* Register custom inventory clicks
|
|
||||||
*/
|
|
||||||
@EventHandler
|
|
||||||
public void registerInventoryClicks(InventoryClickEvent event) {
|
|
||||||
if (event.getInventory().getHolder() instanceof PluginInventory)
|
|
||||||
((PluginInventory) event.getInventory().getHolder()).whenClicked(new InventoryClickEvent(event.getRawSlot(), event.getCurrentItem(), event.getClick(), event, event.getInventory(), (PluginInventory) event.getInventory().getHolder()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register custom inventory close effect
|
|
||||||
*/
|
|
||||||
@EventHandler
|
|
||||||
public void registerInventoryCloses(InventoryCloseEvent event) {
|
|
||||||
if (event.getInventory().getHolder() instanceof PluginInventory)
|
|
||||||
((PluginInventory) event.getInventory().getHolder()).whenClosed(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the player's combat log data every time he hits an entity, or
|
* Updates the player's combat log data every time he hits an entity, or
|
||||||
* gets hit by an entity or a projectile sent by another entity
|
* gets hit by an entity or a projectile sent by another entity
|
||||||
|
@ -42,7 +42,7 @@ public class WaypointsListener implements Listener {
|
|||||||
|
|
||||||
if (waypoint.hasOption(WaypointOption.ENABLE_MENU)) {
|
if (waypoint.hasOption(WaypointOption.ENABLE_MENU)) {
|
||||||
player.setSneaking(false);
|
player.setSneaking(false);
|
||||||
InventoryManager.WAYPOINTS.newInventory(data, waypoint).open();
|
InventoryManager.WAYPOINTS.generate(data, waypoint, null).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,6 @@ public class PlayerProfileCheck implements Listener {
|
|||||||
if (event.getRightClicked().getType() != EntityType.PLAYER || !event.getPlayer().isSneaking() || !MythicLib.plugin.getEntities().canTarget(event.getPlayer(), event.getRightClicked(), InteractionType.SUPPORT_ACTION))
|
if (event.getRightClicked().getType() != EntityType.PLAYER || !event.getPlayer().isSneaking() || !MythicLib.plugin.getEntities().canTarget(event.getPlayer(), event.getRightClicked(), InteractionType.SUPPORT_ACTION))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
InventoryManager.PLAYER_STATS.generate(PlayerData.get((Player) event.getRightClicked()), PlayerData.get(event.getPlayer())).open();
|
InventoryManager.PLAYER_STATS.generate(PlayerData.get((Player) event.getRightClicked()), PlayerData.get(event.getPlayer()), null).open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user