New Check System Implemented!
Massive Overhaul
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
package com.massivecraft.factions.cmd;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.struct.Permission;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdCheck extends FCommand {
|
||||
|
||||
public CmdCheck() {
|
||||
this.aliases.add("check");
|
||||
|
||||
this.requiredArgs.add("minutes");
|
||||
|
||||
this.permission = Permission.CHECK.node;
|
||||
|
||||
this.disableOnLock = true;
|
||||
this.disableOnSpam = false;
|
||||
|
||||
this.senderMustBePlayer = true;
|
||||
this.senderMustBeMember = true;
|
||||
this.senderMustBeModerator = false;
|
||||
this.senderMustBeColeader = false;
|
||||
this.senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void perform() {
|
||||
if (!Conf.useCheckSystem) {
|
||||
msg(TL.GENERIC_DISABLED);
|
||||
return;
|
||||
}
|
||||
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.CHECK);
|
||||
if ((access == Access.DENY || (access == Access.UNDEFINED && !assertMinRole(Role.LEADER))) && !fme.isAdminBypassing()) {
|
||||
fme.msg(TL.GENERIC_NOPERMISSION, "check");
|
||||
return;
|
||||
}
|
||||
int minutes = this.argAsInt(0);
|
||||
if (minutes <= 0) {
|
||||
msg(TL.COMMAND_CHECK_INVALID_NUMBER);
|
||||
} else {
|
||||
myFaction.setCheckNotifier(minutes);
|
||||
msg(TL.COMMAND_CHECK_SUCCESSFUL.format(minutes));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_CHECK_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.massivecraft.factions.cmd;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.cmd.alts.CmdAlts;
|
||||
import com.massivecraft.factions.cmd.check.CmdCheck;
|
||||
import com.massivecraft.factions.cmd.check.CmdWeeWoo;
|
||||
import com.massivecraft.factions.cmd.chest.CmdChest;
|
||||
import com.massivecraft.factions.cmd.claim.*;
|
||||
import com.massivecraft.factions.cmd.econ.CmdMoney;
|
||||
@@ -136,6 +138,7 @@ public class FCmdRoot extends FCommand {
|
||||
public CmdShop cmdShop = new CmdShop();
|
||||
public CmdMissions cmdMissions = new CmdMissions();
|
||||
public CmdCheck cmdCheck = new CmdCheck();
|
||||
public CmdWeeWoo cmdWeeWoo = new CmdWeeWoo();
|
||||
|
||||
|
||||
public FCmdRoot() {
|
||||
@@ -258,6 +261,7 @@ public class FCmdRoot extends FCommand {
|
||||
|
||||
if (Conf.useCheckSystem) {
|
||||
this.addSubCommand(this.cmdCheck);
|
||||
this.addSubCommand(this.cmdWeeWoo);
|
||||
}
|
||||
|
||||
if (P.p.getConfig().getBoolean("Missions-Enabled")) {
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.massivecraft.factions.cmd.check;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.util.FactionGUI;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
public class CheckHistoryFrame implements FactionGUI {
|
||||
private P plugin;
|
||||
private Faction faction;
|
||||
private Inventory inventory;
|
||||
private SimpleDateFormat simpleDateFormat;
|
||||
|
||||
public CheckHistoryFrame(P plugin, Faction faction) {
|
||||
this.simpleDateFormat = new SimpleDateFormat(Conf.dateFormat);
|
||||
this.plugin = plugin;
|
||||
this.faction = faction;
|
||||
this.inventory = plugin.getServer().createInventory(this, 54, TL.CHECK_HISTORY_GUI_TITLE.toString());
|
||||
}
|
||||
|
||||
public void onClick(int slot, ClickType action) {
|
||||
}
|
||||
|
||||
public void build() {
|
||||
int currentSlot = 0;
|
||||
for (Map.Entry<Long, String> entry : Lists.reverse(new ArrayList<>(faction.getChecks().entrySet()))) {
|
||||
if (currentSlot >= 54) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack itemStack = new ItemStack(XMaterial.MAGENTA_STAINED_GLASS_PANE.parseItem());
|
||||
if (entry.getValue().startsWith("U")) {
|
||||
itemStack.setDurability((short) 2);
|
||||
MaterialData data = itemStack.getData();
|
||||
data.setData(DyeColor.MAGENTA.getWoolData());
|
||||
itemStack.setData(data);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(TL.CHECK_WALLS_CHECKED_GUI_ICON.toString());
|
||||
itemMeta.setLore(Arrays.asList(TL.CHECK_TIME_LORE_LINE.format(simpleDateFormat.format(new Date(entry.getKey()))), TL.CHECK_PLAYER_LORE_LINE.format(entry.getValue().substring(1))));
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
} else if (entry.getValue().startsWith("Y")) {
|
||||
itemStack.setDurability((short) 2);
|
||||
MaterialData data = itemStack.getData();
|
||||
data.setData(DyeColor.MAGENTA.getWoolData());
|
||||
itemStack.setData(data);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(TL.CHECK_BUFFERS_CHECKED_GUI_ICON.toString());
|
||||
itemMeta.setLore(Arrays.asList(TL.CHECK_TIME_LORE_LINE.format(simpleDateFormat.format(new Date(entry.getKey()))), TL.CHECK_PLAYER_LORE_LINE.format(entry.getValue().substring(1))));
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
} else if (entry.getValue().startsWith("J")) {
|
||||
itemStack.setDurability((short) 0);
|
||||
MaterialData data = itemStack.getData();
|
||||
data.setData(DyeColor.WHITE.getWoolData());
|
||||
itemStack.setData(data);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(TL.CHECK_WALLS_UNCHECKED_GUI_ICON.toString());
|
||||
itemMeta.setLore(Collections.singletonList(TL.CHECK_TIME_LORE_LINE.format(simpleDateFormat.format(new Date(entry.getKey())))));
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
} else if (entry.getValue().startsWith("H")) {
|
||||
itemStack.setDurability((short) 0);
|
||||
MaterialData data = itemStack.getData();
|
||||
data.setData(DyeColor.WHITE.getWoolData());
|
||||
itemStack.setData(data);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(TL.CHECK_BUFFERS_UNCHECKED_GUI_ICON.toString());
|
||||
itemMeta.setLore(Collections.singletonList(TL.CHECK_TIME_LORE_LINE.format(simpleDateFormat.format(new Date(entry.getKey())))));
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
}
|
||||
inventory.setItem(currentSlot, itemStack);
|
||||
++currentSlot;
|
||||
}
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package com.massivecraft.factions.cmd.check;
|
||||
|
||||
import com.massivecraft.factions.FPlayer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.util.FactionGUI;
|
||||
import com.massivecraft.factions.util.XMaterial;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class CheckSettingsFrame implements InventoryHolder, FactionGUI {
|
||||
private P plugin;
|
||||
private FPlayer fPlayer;
|
||||
private Inventory inventory;
|
||||
|
||||
public CheckSettingsFrame(P plugin, FPlayer fPlayer) {
|
||||
this.plugin = plugin;
|
||||
this.fPlayer = fPlayer;
|
||||
this.inventory = plugin.getServer().createInventory(this, plugin.getConfig().getInt("f-check.gui-rows") * 9, TL.CHECK_SETTINGS_GUI_TITLE.toString());
|
||||
}
|
||||
|
||||
public void onClick(int slot, ClickType action) {
|
||||
Faction faction = this.fPlayer.getFaction();
|
||||
if (slot == P.p.getConfig().getInt("f-check.wall-check.slot")) {
|
||||
faction.setWallCheckMinutes(getNext(faction.getWallCheckMinutes()));
|
||||
} else {
|
||||
if (slot == P.p.getConfig().getInt("f-check.history.slot")) {
|
||||
CheckHistoryFrame checkHistoryFrame = new CheckHistoryFrame(plugin, fPlayer.getFaction());
|
||||
checkHistoryFrame.build();
|
||||
fPlayer.getPlayer().openInventory(checkHistoryFrame.getInventory());
|
||||
return;
|
||||
}
|
||||
if (slot == P.p.getConfig().getInt("f-check.buffer-check.slot")) {
|
||||
faction.setBufferCheckMinutes(getNext(faction.getBufferCheckMinutes()));
|
||||
}
|
||||
}
|
||||
build();
|
||||
fPlayer.getPlayer().openInventory(inventory);
|
||||
}
|
||||
|
||||
public void build() {
|
||||
Faction faction = fPlayer.getFaction();
|
||||
ItemStack wallsStack = XMaterial.matchXMaterial(P.p.getConfig().getString("f-check.wall-check.Type")).parseItem();
|
||||
ItemMeta wallsMeta = wallsStack.getItemMeta();
|
||||
wallsMeta.setDisplayName(TL.CHECK_WALL_CHECK_GUI_ICON.toString());
|
||||
wallsMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getWallCheckMinutes()))));
|
||||
wallsStack.setItemMeta(wallsMeta);
|
||||
inventory.setItem(P.p.getConfig().getInt("f-check.wall-check.slot"), wallsStack);
|
||||
ItemStack bufferStack = XMaterial.matchXMaterial(P.p.getConfig().getString("f-check.buffer-check.Type")).parseItem();
|
||||
ItemMeta bufferMeta = bufferStack.getItemMeta();
|
||||
bufferMeta.setDisplayName(TL.CHECK_BUFFER_CHECK_GUI_ICON.toString());
|
||||
bufferMeta.setLore(Collections.singletonList(TL.CHECK_CHECK_LORE_LINE.format(getFormatted(faction.getBufferCheckMinutes()))));
|
||||
bufferStack.setItemMeta(bufferMeta);
|
||||
inventory.setItem(P.p.getConfig().getInt("f-check.buffer-check.slot"), bufferStack);
|
||||
ItemStack historyStack = XMaterial.matchXMaterial(P.p.getConfig().getString("f-check.history.Type")).parseItem();
|
||||
ItemMeta historyMeta = historyStack.getItemMeta();
|
||||
historyMeta.setDisplayName(TL.CHECK_HISTORY_GUI_ICON.toString());
|
||||
historyStack.setItemMeta(historyMeta);
|
||||
inventory.setItem(P.p.getConfig().getInt("f-check.history.slot"), historyStack);
|
||||
}
|
||||
|
||||
public Inventory getInventory() {
|
||||
return this.inventory;
|
||||
}
|
||||
|
||||
private int getNext(int current) {
|
||||
switch (current) {
|
||||
case 0: {
|
||||
return 3;
|
||||
}
|
||||
case 3: {
|
||||
return 5;
|
||||
}
|
||||
case 5: {
|
||||
return 10;
|
||||
}
|
||||
case 10: {
|
||||
return 15;
|
||||
}
|
||||
case 15: {
|
||||
return 30;
|
||||
}
|
||||
case 30: {
|
||||
return 0;
|
||||
}
|
||||
default: {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getFormatted(int minutes) {
|
||||
if (minutes == 0) {
|
||||
return "Offline";
|
||||
}
|
||||
return minutes + " Minutes";
|
||||
}
|
||||
|
||||
public String color(String message){
|
||||
return ChatColor.translateAlternateColorCodes('&', message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.massivecraft.factions.cmd.check;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
public class CheckTask implements Runnable {
|
||||
private SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Conf.dateFormat);
|
||||
private static List<String> wallChecks = new CopyOnWriteArrayList<>();
|
||||
private static List<String> bufferChecks = new CopyOnWriteArrayList<>();
|
||||
private P plugin;
|
||||
private int minute;
|
||||
|
||||
public CheckTask(P plugin, int minute) {
|
||||
this.plugin = plugin;
|
||||
this.minute = minute;
|
||||
}
|
||||
|
||||
public static void cleanupTask() {
|
||||
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||
if (!faction.isNormal()) {
|
||||
continue;
|
||||
}
|
||||
List<Long> remove = new ArrayList<>();
|
||||
int i = 0;
|
||||
for (Long key : Lists.reverse(new ArrayList<>(faction.getChecks().keySet()))) {
|
||||
if (i >= 54) {
|
||||
remove.add(key);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
remove.forEach(r -> faction.getChecks().remove(r));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||
if (!faction.isNormal()) {
|
||||
continue;
|
||||
}
|
||||
if (faction.getWallCheckMinutes() != minute) {
|
||||
continue;
|
||||
}
|
||||
long CurrentTime = currentTime;
|
||||
if (CheckTask.wallChecks.contains(faction.getId())) {
|
||||
plugin.getServer().getScheduler().runTask(plugin, () -> faction.getChecks().put(CurrentTime, "J"));
|
||||
} else {
|
||||
CheckTask.wallChecks.add(faction.getId());
|
||||
}
|
||||
faction.msg(TL.CHECK_WALLS_CHECK);
|
||||
}
|
||||
|
||||
|
||||
++currentTime;
|
||||
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||
if (!faction.isNormal()) {
|
||||
continue;
|
||||
}
|
||||
if (faction.getBufferCheckMinutes() != minute) {
|
||||
continue;
|
||||
}
|
||||
if (CheckTask.bufferChecks.contains(faction.getId())) {
|
||||
Faction faction2 = null;
|
||||
long CurrentTime2 = 0;
|
||||
plugin.getServer().getScheduler().runTask(plugin, () -> {
|
||||
if (faction2 != null) {
|
||||
faction2.getChecks().put(CurrentTime2, "H");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
CheckTask.bufferChecks.add(faction.getId());
|
||||
}
|
||||
faction.msg(TL.CHECK_BUFFERS_CHECK);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean wallCheck(String factionId) {
|
||||
return CheckTask.wallChecks.remove(factionId);
|
||||
}
|
||||
|
||||
public static boolean bufferCheck(String factionId) {
|
||||
return CheckTask.bufferChecks.remove(factionId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
114
src/main/java/com/massivecraft/factions/cmd/check/CmdCheck.java
Normal file
114
src/main/java/com/massivecraft/factions/cmd/check/CmdCheck.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.massivecraft.factions.cmd.check;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.struct.Role;
|
||||
import com.massivecraft.factions.zcore.fperms.Access;
|
||||
import com.massivecraft.factions.zcore.fperms.PermissableAction;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class CmdCheck extends FCommand {
|
||||
private SimpleDateFormat simpleDateFormat;
|
||||
|
||||
public CmdCheck() {
|
||||
this.simpleDateFormat = new SimpleDateFormat(Conf.dateFormat);
|
||||
this.aliases.add("check");
|
||||
this.requiredArgs.add("walls/buffers/settings/leaderboard");
|
||||
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
|
||||
public void perform() {
|
||||
if (myFaction == null || !myFaction.isNormal()) {
|
||||
return;
|
||||
}
|
||||
String subCommand = argAsString(0, null);
|
||||
Access access = myFaction.getAccess(fme, PermissableAction.CHECK);
|
||||
if (access != Access.ALLOW && fme.getRole() != Role.LEADER) {
|
||||
fme.msg(TL.GENERIC_NOPERMISSION, "check");
|
||||
return;
|
||||
}
|
||||
long currentTime = System.currentTimeMillis();
|
||||
if (subCommand.equalsIgnoreCase("leaderboard")) {
|
||||
msg(TL.CHECK_LEADERBOARD_HEADER);
|
||||
Map<UUID, Integer> players = new HashMap<>();
|
||||
for (Map.Entry<UUID, Integer> entry : myFaction.getPlayerWallCheckCount().entrySet()) {
|
||||
players.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
for (Map.Entry<UUID, Integer> entry : myFaction.getPlayerBufferCheckCount().entrySet()) {
|
||||
if (players.containsKey(entry.getKey())) {
|
||||
players.replace(entry.getKey(), players.get(entry.getKey()) + entry.getValue());
|
||||
} else {
|
||||
players.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
List<Map.Entry<UUID, Integer>> entryList = players.entrySet().stream().sorted(Comparator.comparingInt(Map.Entry::getValue)).collect(Collectors.toList());
|
||||
for (int max = (entryList.size() > 10) ? 10 : entryList.size(), current = 0; current < max; ++current) {
|
||||
Map.Entry<UUID, Integer> entry = entryList.get(current);
|
||||
OfflinePlayer offlinePlayer = p.getServer().getOfflinePlayer(entry.getKey());
|
||||
msg(TL.CHECK_LEADERBOARD_LINE.format(current + 1, offlinePlayer.getName(), entry.getValue(), myFaction.getPlayerBufferCheckCount().getOrDefault(entry.getKey(), 0), myFaction.getPlayerWallCheckCount().getOrDefault(entry.getKey(), 0)));
|
||||
}
|
||||
if (entryList.isEmpty()) {
|
||||
msg(TL.CHECK_LEADERBOARD_NO_DATA);
|
||||
}
|
||||
} else if (subCommand.equalsIgnoreCase("walls")) {
|
||||
if (!CheckTask.wallCheck(myFaction.getId())) {
|
||||
if (myFaction.getChecks().isEmpty()) {
|
||||
msg(TL.CHECK_NO_CHECKS);
|
||||
return;
|
||||
}
|
||||
msg(TL.CHECK_ALREADY_CHECKED);
|
||||
} else {
|
||||
int current = myFaction.getPlayerWallCheckCount().getOrDefault(me.getUniqueId(), 0);
|
||||
if (current == 0) {
|
||||
myFaction.getPlayerWallCheckCount().put(me.getUniqueId(), 1);
|
||||
} else {
|
||||
myFaction.getPlayerWallCheckCount().replace(me.getUniqueId(), current + 1);
|
||||
}
|
||||
myFaction.getChecks().put(currentTime, "U" + fme.getNameAndTag());
|
||||
msg(TL.CHECK_WALLS_MARKED_CHECKED);
|
||||
}
|
||||
} else if (subCommand.equalsIgnoreCase("buffers")) {
|
||||
if (!CheckTask.bufferCheck(myFaction.getId())) {
|
||||
if (myFaction.getChecks().isEmpty()) {
|
||||
msg(TL.CHECK_NO_CHECKS);
|
||||
return;
|
||||
}
|
||||
msg(TL.CHECK_ALREADY_CHECKED);
|
||||
} else {
|
||||
int current = myFaction.getPlayerBufferCheckCount().getOrDefault(me.getUniqueId(), 0);
|
||||
if (current == 0) {
|
||||
myFaction.getPlayerBufferCheckCount().put(me.getUniqueId(), 1);
|
||||
} else {
|
||||
myFaction.getPlayerBufferCheckCount().replace(me.getUniqueId(), current + 1);
|
||||
}
|
||||
myFaction.getChecks().put(System.currentTimeMillis(), "Y" + fme.getNameAndTag());
|
||||
msg(TL.CHECK_BUFFERS_MARKED_CHECKED);
|
||||
}
|
||||
} else if (subCommand.equalsIgnoreCase("settings")) {
|
||||
if (!fme.getRole().isAtLeast(Role.COLEADER)) {
|
||||
msg(TL.CHECK_MUST_BE_ATLEAST_COLEADER);
|
||||
return;
|
||||
}
|
||||
CheckSettingsFrame checkGUI = new CheckSettingsFrame(p, fme);
|
||||
checkGUI.build();
|
||||
fme.getPlayer().openInventory(checkGUI.getInventory());
|
||||
}
|
||||
}
|
||||
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_CHECK_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.massivecraft.factions.cmd.check;
|
||||
|
||||
import com.massivecraft.factions.cmd.FCommand;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class CmdWeeWoo extends FCommand {
|
||||
public CmdWeeWoo() {
|
||||
this.aliases.add("weewoo");
|
||||
this.requiredArgs.add("start/stop");
|
||||
|
||||
this.disableOnLock = true;
|
||||
|
||||
senderMustBePlayer = true;
|
||||
senderMustBeMember = true;
|
||||
senderMustBeModerator = false;
|
||||
senderMustBeColeader = false;
|
||||
senderMustBeAdmin = false;
|
||||
}
|
||||
|
||||
public void perform() {
|
||||
if (myFaction == null || !myFaction.isNormal()) {
|
||||
return;
|
||||
}
|
||||
String argument = argAsString(0);
|
||||
boolean weewoo = myFaction.isWeeWoo();
|
||||
if (argument.equalsIgnoreCase("start")) {
|
||||
if (weewoo) {
|
||||
msg(TL.COMMAND_WEEWOO_ALREADY_STARTED);
|
||||
return;
|
||||
}
|
||||
myFaction.setWeeWoo(true);
|
||||
msg(TL.COMMAND_WEEWOO_STARTED, fme.getNameAndTag());
|
||||
|
||||
} else if (argument.equalsIgnoreCase("stop")) {
|
||||
if (!weewoo) {
|
||||
msg(TL.COMMAND_WEEWOO_ALREADY_STOPPED);
|
||||
return;
|
||||
}
|
||||
myFaction.setWeeWoo(false);
|
||||
msg(TL.COMMAND_WEEWOO_STOPPED, fme.getNameAndTag());
|
||||
} else {
|
||||
msg("/f weewoo <start/stop>");
|
||||
}
|
||||
}
|
||||
|
||||
public TL getUsageTranslation() {
|
||||
return TL.COMMAND_WEEWOO_DESCRIPTION;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.massivecraft.factions.cmd.check;
|
||||
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Factions;
|
||||
import com.massivecraft.factions.P;
|
||||
import com.massivecraft.factions.zcore.util.TL;
|
||||
|
||||
public class WeeWooTask implements Runnable {
|
||||
|
||||
private P plugin;
|
||||
|
||||
public WeeWooTask(P plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Faction faction : Factions.getInstance().getAllFactions()) {
|
||||
if (!faction.isWeeWoo()) {
|
||||
continue;
|
||||
}
|
||||
faction.msg(TL.WEE_WOO_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user