Introduced Brigadier Command System. More Formatting Coming in next commit.
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.massivecraft.factions.missions;
|
||||
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.cmd.CommandContext;
|
||||
import com.massivecraft.factions.cmd.CommandRequirements;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
@@ -12,28 +15,24 @@ public class CmdMissions extends FCommand {
|
||||
this.aliases.add("objectives");
|
||||
this.aliases.add("objective");
|
||||
|
||||
this.permission = Permission.MISSIONS.node;
|
||||
|
||||
this.disableOnLock = true;
|
||||
this.disableOnSpam = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeAdmin = false;
|
||||
this.requirements = new CommandRequirements.Builder(Permission.MISSIONS)
|
||||
.memberOnly()
|
||||
.playerOnly()
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (myFaction == null) {
|
||||
public void perform(CommandContext context) {
|
||||
if (context.faction == null) {
|
||||
return;
|
||||
}
|
||||
final MissionGUI missionsGUI = new MissionGUI(p, fme);
|
||||
final MissionGUI missionsGUI = new MissionGUI(FactionsPlugin.getInstance(), context.fPlayer);
|
||||
missionsGUI.build();
|
||||
fme.getPlayer().openInventory(missionsGUI.getInventory());
|
||||
context.player.openInventory(missionsGUI.getInventory());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_MISSION_DESCRIPTION;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.massivecraft.factions.missions;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.util.FactionGUI;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
@@ -20,12 +20,12 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MissionGUI implements FactionGUI {
|
||||
private P plugin;
|
||||
private FactionsPlugin plugin;
|
||||
private FPlayer fPlayer;
|
||||
private Inventory inventory;
|
||||
private Map<Integer, String> slots;
|
||||
|
||||
public MissionGUI(P plugin, FPlayer fPlayer) {
|
||||
public MissionGUI(FactionsPlugin plugin, FPlayer fPlayer) {
|
||||
this.slots = new HashMap<>();
|
||||
this.plugin = plugin;
|
||||
this.fPlayer = fPlayer;
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.massivecraft.factions.missions;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.FPlayers;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.FactionsPlugin;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -19,9 +19,9 @@ import java.util.stream.Collectors;
|
||||
|
||||
public class MissionHandler implements Listener {
|
||||
|
||||
private P plugin;
|
||||
private FactionsPlugin plugin;
|
||||
|
||||
public MissionHandler(P plugin) {
|
||||
public MissionHandler(FactionsPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class MissionHandler implements Listener {
|
||||
return;
|
||||
}
|
||||
for (String command : section.getConfigurationSection("Reward").getStringList("Commands")) {
|
||||
P.p.getServer().dispatchCommand(P.p.getServer().getConsoleSender(), command.replace("%faction%", fPlayer.getFaction().getTag()));
|
||||
FactionsPlugin.getInstance().getServer().dispatchCommand(FactionsPlugin.getInstance().getServer().getConsoleSender(), command.replace("%faction%", fPlayer.getFaction().getTag()));
|
||||
}
|
||||
fPlayer.getFaction().getMissions().remove(mission.getName());
|
||||
fPlayer.getFaction().msg(TL.MISSION_MISSION_FINISHED, plugin.color(section.getString("Name")));
|
||||
|
||||
Reference in New Issue
Block a user