Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.

Commit

Permalink
rename '/heh ignore' to '/heh mute' #7
Browse files Browse the repository at this point in the history
  • Loading branch information
cyilin committed Jun 5, 2016
1 parent 0a64fe0 commit 5b4050a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
10 changes: 5 additions & 5 deletions src/main/java/cat/nyaa/HamsterEcoHelper/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import cat.nyaa.HamsterEcoHelper.auction.AuctionCommands;
import cat.nyaa.HamsterEcoHelper.market.MarketCommands;
import cat.nyaa.HamsterEcoHelper.requisition.RequisitionCommands;
import cat.nyaa.HamsterEcoHelper.utils.Ignore;
import cat.nyaa.HamsterEcoHelper.utils.Mute;
import cat.nyaa.HamsterEcoHelper.utils.Message;
import org.bukkit.Material;
import org.bukkit.command.Command;
Expand Down Expand Up @@ -193,14 +193,14 @@ public static void version(CommandSender sender, Arguments args, HamsterEcoHelpe
msg(sender, "manual.license", ver, au);
}

@SubCommand(value = "ignore", permission = "heh.ignore")
@SubCommand(value = "mute", permission = "heh.mute")
public static void ignore(CommandSender sender, Arguments args, HamsterEcoHelper plugin) {
Ignore.add(asPlayer(sender));
Mute.add(asPlayer(sender));
}

@SubCommand(value = "unignore", permission = "heh.ignore")
@SubCommand(value = "unmute", permission = "heh.mute")
public static void unignore(CommandSender sender, Arguments args, HamsterEcoHelper plugin) {
Ignore.remove(asPlayer(sender));
Mute.remove(asPlayer(sender));
}

public static Player asPlayer(CommandSender target) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cat/nyaa/HamsterEcoHelper/HamsterEcoHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import cat.nyaa.HamsterEcoHelper.requisition.RequisitionManager;
import cat.nyaa.HamsterEcoHelper.utils.Database;
import cat.nyaa.HamsterEcoHelper.utils.EconomyUtil;
import cat.nyaa.HamsterEcoHelper.utils.Ignore;
import cat.nyaa.HamsterEcoHelper.utils.Mute;
import org.bukkit.plugin.java.JavaPlugin;

import java.util.List;
Expand Down Expand Up @@ -44,7 +44,7 @@ public void onEnable() {
MarketManager.init(this);
eventHandler = new Events(this);
enableComplete = true;
Ignore.init();
Mute.init();
} catch (Exception ex) {
ex.printStackTrace();
logger.severe(I18n.get("internal.error.enable_fail"));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cat/nyaa/HamsterEcoHelper/utils/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Message send(Player p) {
}

public Message broadcast() {
List<UUID> list = Ignore.getList();
List<UUID> list = Mute.getList();
if (list.isEmpty()) {
Bukkit.getServer().spigot().broadcast(inner);
} else {
Expand All @@ -79,7 +79,7 @@ public Message broadcast() {
}

public Message broadcast(String permission) {
List<UUID> list = Ignore.getList();
List<UUID> list = Mute.getList();
for (Player player : Bukkit.getOnlinePlayers()) {
if (!list.contains(player.getUniqueId()) && player.hasPermission(permission)) {
this.send(player);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
package cat.nyaa.HamsterEcoHelper.utils;

import cat.nyaa.HamsterEcoHelper.HamsterEcoHelper;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class Ignore {
private static List<UUID> ignoreList;
public class Mute {
private static List<UUID> list;

public static void init() {
ignoreList = new ArrayList<>();
list = new ArrayList<>();
}

public static void add(Player player) {
if (!ignoreList.contains(player.getUniqueId())) {
ignoreList.add(player.getUniqueId());
if (!list.contains(player.getUniqueId())) {
list.add(player.getUniqueId());
}
}

public static void remove(Player player) {
if (ignoreList.contains(player.getUniqueId())) {
ignoreList.remove(player.getUniqueId());
if (list.contains(player.getUniqueId())) {
list.remove(player.getUniqueId());
}
}

public static List<UUID> getList() {
List<UUID> tmp = new ArrayList<>();
for (UUID p : ignoreList) {
for (UUID p : list) {
if (Bukkit.getOfflinePlayer(p).isOnline()) {
tmp.add(p);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ permissions:
heh.bid: true
heh.retrieve: true
heh.command: true
heh.ignore: true
heh.mute: true
heh.admin:
description: Permission node for operators
default: op
Expand Down

0 comments on commit 5b4050a

Please sign in to comment.