-
-
Save Deaygo/da33438f4a58f1b2d544 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NerdMessage { | |
private NerdMessageAPI api = null; | |
public NerdMessageAPI getAPI() { | |
if (api == null) { | |
api = NerdMessageAPI(this); | |
} | |
return api; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nu.nerd.nerdmessage; | |
import java.util.List; | |
public class NerdMessageAPI { | |
NerdMessage plugin = null; | |
public NerdMessageAPI(NerdMessage plugin) { | |
this.plugin = plugin | |
} | |
public static boolean isIgnoredBy(String player, String check) { | |
NMUser p = plugin.getUser(player); | |
NMUser c = plugin.getUser(check); | |
if (p == null || c == null) { | |
return false; | |
} | |
return p.isIgnoringPlayer(check.toLowerCase()) | |
} | |
public static boolean isIgnoredBy(Player player, String check) { | |
return isIgnoredBy(player.getName(), check); | |
} | |
public static boolean isIgnoredBy(Player player, Player check) { | |
return isIgnoredBy(player.getName(), check.getName()); | |
} | |
public static void ignore(String for, String ignore) { | |
Player forplayer = plugin.getServer().getPlayerExact(for); | |
if (forplayer == null) { | |
return; | |
} | |
NMUser f = plugin.getOrCreateUser(for); | |
f.addIgnoredPlayer(ignore.toLowerCase()); | |
} | |
public static ignore(Player for, String ignore) { | |
ignore(for.getName(), ignore); | |
} | |
public static ignore(Player for, Player ignore) { | |
ignore(for.getName(), ignore.getName()); | |
} | |
public static void unignore(String for, String ignore) { | |
Player forplayer = plugin.getServer().getPlayerExact(for); | |
if (forplayer == null) { | |
return; | |
} | |
NMUser f = plugin.getUser(for); | |
if (f != null) { | |
f.addIgnoredPlayer(ignore.toLowerCase()); | |
} | |
} | |
public static void unignore(Player for, String ignore) { | |
unignore(for.getName(), ignore); | |
} | |
public static void unignore(Player for, Player ignore) { | |
unignore(for.getName(), ignore.getName()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment