Initial Commit

This commit is contained in:
Ghoti 2020-01-17 17:49:26 -06:00
commit 49a29a7420
60 changed files with 6513 additions and 0 deletions

32
.classpath Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/bin/
/target/

23
.project Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>FPChatX</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding/src=UTF-8

View File

@ -0,0 +1,13 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

117
dependency-reduced-pom.xml Normal file
View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>FPChatX</groupId>
<artifactId>FPChatX</artifactId>
<version>1.0.0-BETA</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<source>1.7</source>
<artifactSet>
<includes>
<include>org.apache.commons*:*</include>
</includes>
</artifactSet>
<relocations />
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.15-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>bungeecord-config</artifactId>
<groupId>net.md-5</groupId>
</exclusion>
<exclusion>
<artifactId>bungeecord-event</artifactId>
<groupId>net.md-5</groupId>
</exclusion>
<exclusion>
<artifactId>bungeecord-protocol</artifactId>
<groupId>net.md-5</groupId>
</exclusion>
<exclusion>
<artifactId>netty-transport-native-unix-common</artifactId>
<groupId>io.netty</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

105
pom.xml Normal file
View File

@ -0,0 +1,105 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>FPChatX</groupId>
<artifactId>FPChatX</artifactId>
<version>1.0.0-BETA</version>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<source>1.7</source>
<artifactSet>
<includes>
<include>org.apache.commons*:*</include>
</includes>
</artifactSet>
<relocations>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.15.1-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.15-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.10.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,242 @@
package com.fpghoti.fpchatx;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import com.fpghoti.fpchatx.badge.BadgeList;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.chat.ShoutChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.command.commands.BadgeClearCommand;
import com.fpghoti.fpchatx.command.commands.BadgeEquipCommand;
import com.fpghoti.fpchatx.command.commands.BadgeListCommand;
import com.fpghoti.fpchatx.command.commands.BlacklistCommand;
import com.fpghoti.fpchatx.command.commands.DeleteCommand;
import com.fpghoti.fpchatx.command.commands.JoinCommand;
import com.fpghoti.fpchatx.command.commands.TalkCommand;
import com.fpghoti.fpchatx.command.commands.GiveBadgeCommand;
import com.fpghoti.fpchatx.command.commands.HelpCommand;
import com.fpghoti.fpchatx.command.commands.HushCommand;
import com.fpghoti.fpchatx.command.commands.IgnoreCommand;
import com.fpghoti.fpchatx.command.commands.IgnoreListCommand;
import com.fpghoti.fpchatx.command.commands.KickCommand;
import com.fpghoti.fpchatx.command.commands.LeaveCommand;
import com.fpghoti.fpchatx.command.commands.ChannelsCommand;
import com.fpghoti.fpchatx.command.commands.CreateCommand;
import com.fpghoti.fpchatx.command.commands.MessageCommand;
import com.fpghoti.fpchatx.command.commands.ReloadCommand;
import com.fpghoti.fpchatx.command.commands.ReplyCommand;
import com.fpghoti.fpchatx.command.commands.RevokeBadgeCommand;
import com.fpghoti.fpchatx.command.commands.ShoutCommand;
import com.fpghoti.fpchatx.command.commands.ShoutToggleCommand;
import com.fpghoti.fpchatx.command.commands.SpyCommand;
import com.fpghoti.fpchatx.command.commands.UnHushCommand;
import com.fpghoti.fpchatx.command.commands.UnignoreCommand;
import com.fpghoti.fpchatx.command.commands.WhoCommand;
import com.fpghoti.fpchatx.config.MainConfig;
import com.fpghoti.fpchatx.config.PlayerCache;
import com.fpghoti.fpchatx.listener.PlayerListener;
import com.fpghoti.fpchatx.mysql.MySQLConnection;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.VaultUtil;
public class FPChat extends JavaPlugin {
private static Logger log = Logger.getLogger("Minecraft");
private static Logger chatLog = Logger.getLogger("FPChat");
private MainConfig config;
private MySQLConnection sql;
private static FPChat plugin;
private int mysqlTimer = 1140;
private BukkitTask refresh = null;
private PlayerListener listener = null;
private PlayerCache cache;
public void onEnable() {
plugin = this;
VaultUtil vault = new VaultUtil(this);
vault.setupChat();
vault.setupEconomy();
vault.setupPermissions();
config = new MainConfig(this);
if(config.mySQLEnabled()) {
sql = new MySQLConnection(this);
sql.generate();
startTimers();
}
registerEvents();
registerCommands();
PluginDescriptionFile desc = getDescription();
ChatChannel.loadChannels();
ChatChannel.setShout(new ShoutChannel(this));
ChatChannel.setDefault(config.getDefaultChannel());
BadgeList.setupBadges();
for(int i : BadgeList.badgelist.keySet()) {
BadgeList.badgelist.put(i, BadgeList.badgelist.get(i).replace("&", "§"));
}
cache = new PlayerCache(this);
for(Player bp : Bukkit.getOnlinePlayers()){
FPlayer.getPlayer(bp);
}
log(Level.INFO, desc.getName() + " version " + desc.getVersion() + " enabled.");
}
public void onDisable() {
for(FPlayer p : FPlayer.getPlayers()) {
p.cleanup();
}
if(config.mySQLEnabled()) {
sql.disconnect();
}
}
public void reload() {
Commands.blockCommands();
if(listener != null) {
listener.disable();
}
if(refresh != null) {
refresh.cancel();
}
sql.disconnect();
for(FPlayer p : FPlayer.getPlayers()) {
p.cleanup();
}
BadgeList.purge();
FPlayer.purge();
config = new MainConfig(this);
if(config.mySQLEnabled()) {
sql = new MySQLConnection(this);
sql.generate();
startTimers();
}
ChatChannel.loadChannels();
ChatChannel.setShout(new ShoutChannel(this));
ChatChannel.setDefault(config.getDefaultChannel());
BadgeList.setupBadges();
for(int i : BadgeList.badgelist.keySet()) {
BadgeList.badgelist.put(i, BadgeList.badgelist.get(i).replace("&", "§"));
}
cache = new PlayerCache(this);
for(Player bp : Bukkit.getOnlinePlayers()){
FPlayer.getPlayer(bp);
}
if(listener != null) {
listener.enable();
}
Commands.allowCommands();
log(Level.INFO, "FPChatX reloaded.");
}
private void registerEvents() {
this.listener = new PlayerListener();
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(listener, this);
}
private void registerCommands() {
Commands.register(new ReloadCommand(this));
Commands.register(new ShoutCommand(this));
Commands.register(new ShoutToggleCommand(this));
Commands.register(new MessageCommand(this));
Commands.register(new ReplyCommand(this));
Commands.register(new IgnoreCommand(this));
Commands.register(new UnignoreCommand(this));
Commands.register(new IgnoreListCommand(this));
Commands.register(new BadgeListCommand(this));
Commands.register(new BadgeEquipCommand(this));
Commands.register(new BadgeClearCommand(this));
Commands.register(new SpyCommand(this));
Commands.register(new ChannelsCommand(this));
Commands.register(new WhoCommand(this));
Commands.register(new TalkCommand(this));
Commands.register(new JoinCommand(this));
Commands.register(new LeaveCommand(this));;
Commands.register(new CreateCommand(this));
Commands.register(new DeleteCommand(this));
Commands.register(new HushCommand(this));
Commands.register(new UnHushCommand(this));
Commands.register(new KickCommand(this));
Commands.register(new BlacklistCommand(this));
Commands.register(new HelpCommand(this));
Commands.register(new RevokeBadgeCommand(this));
Commands.register(new GiveBadgeCommand(this));
}
public MainConfig getMainConfig() {
return this.config;
}
public PlayerCache getPlayerCache() {
return this.cache;
}
public MySQLConnection getMySQLConnection() {
return this.sql;
}
public void log(Level level, String msg) {
log.log(level, "[FPChatX] " + msg.replaceAll("§[0-9A-FK-OR]", ""));
}
public void logChat(String msg) {
chatLog.info(msg.replaceAll("§[0-9A-FK-OR]", ""));
}
public static FPChat getPlugin(){
return plugin;
}
public static String logo() {
return "" + ChatColor.DARK_RED + "[" + ChatColor.GREEN + ChatColor.BOLD + "FPChatX" + ChatColor.RESET + ChatColor.DARK_RED + "]" + ChatColor.RESET ;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
return Commands.performCommand(sender, command, label, args);
}
public void startTimers() {
refresh = new BukkitRunnable(){
public void run() {
if(config.shoutCooldownEnabled()) { //shout cooldown
for(FPlayer p : FPlayer.getPlayers()) {
if(p != null) {
int time = p.getShoutCooldown();
if(time > 0){
p.setShoutCooldown(time - 1);
}
}
}
}
if(config.mySQLEnabled()){ // mysql auto reconnect
if(mysqlTimer >= 1200){
sql.reconnect();
mysqlTimer = 0;
}else{
mysqlTimer++;
}
}
}
}.runTaskTimerAsynchronously(this, 1*20, 1*20);
}
}

View File

@ -0,0 +1,49 @@
package com.fpghoti.fpchatx.badge;
import java.util.UUID;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class BadgeGetter {
public static Integer[] getBadges(FPlayer p){
UUID id = p.getUniqueId();
String uuid = id.toString();
Integer badge1 = 0, badge2 = 0, badge3 = 0;
Util.connect();
if(!FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getChatFeatureTable())){
BadgeSet.createPlayer(p);
}
badge1 = (Integer) FPChat.getPlugin().getMySQLConnection().get("badge_slot1", "player_uuid", "=", uuid, FPChat.getPlugin().getMainConfig().getChatFeatureTable());
badge2 = (Integer)FPChat.getPlugin().getMySQLConnection().get("badge_slot2", "player_uuid", "=", uuid, FPChat.getPlugin().getMainConfig().getChatFeatureTable());
badge3 = (Integer)FPChat.getPlugin().getMySQLConnection().get("badge_slot3", "player_uuid", "=", uuid, FPChat.getPlugin().getMainConfig().getChatFeatureTable());
Integer[] badges = {badge1, badge2, badge3};
return badges;
}
public static Boolean hasBadge(FPlayer p, int id){
if(id == 0) {
return true;
}
return p.hasPermission("fpchat.badge" + BadgeList.badgeperm.get(id)) || p.isSynced(id);
}
public static Boolean canUseSlot(FPlayer p, int slotid){
if(slotid == 1){
return p.hasPermission("fpchat.slot1");
}else if(slotid == 2){
if(hasBadge(p,33) || hasBadge(p,34) || hasBadge(p,35) || hasBadge(p,52)){
return true;
}
return p.hasPermission("fpchat.slot2");
}else if(slotid == 3){
if(hasBadge(p,53)){
return true;
}
return p.hasPermission("fpchat.slot3");
}
return false;
}
}

View File

@ -0,0 +1,324 @@
package com.fpghoti.fpchatx.badge;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.bukkit.ChatColor;
import com.fpghoti.fpchatx.player.FPlayer;
public class BadgeList {
public static HashMap<Integer, String> badgelist = new LinkedHashMap<>();
public static HashMap<Integer, String> badgename = new LinkedHashMap<>();
public static HashMap<Integer, String> badgeperm = new LinkedHashMap<>();
public static HashMap<FPlayer, Integer> pageInstance = new HashMap<>();
public static void purge() {
badgelist = new LinkedHashMap<>();
badgename = new LinkedHashMap<>();
badgeperm = new LinkedHashMap<>();
pageInstance = new HashMap<>();
}
public static void badgeList(FPlayer p , int page){
p.sendMessage("");
p.sendMessage(ChatColor.RED + "HOW TO USE:" + ChatColor.YELLOW + " You can equip badges with " + ChatColor.DARK_AQUA + "/equip slot# badge#" + ChatColor.YELLOW +". To unequip all badges, use " + ChatColor.DARK_AQUA + "/badgesclear" + ChatColor.YELLOW + ".");
p.sendMessage(ChatColor.AQUA + "------------------- Your Badges -------------------");
p.sendMessage("");
int eventnum = 0;
//for(Integer item : badgelist.keySet()){
for(int i = 0; i < badgelist.size(); i++){
eventnum = eventnum + 1;
}
double dp = (float)eventnum / 10.0;
int pagenum = (int)Math.ceil(dp);
if(page <= pagenum && page > 0){
pageInstance.put(p,0);
int pageten = (page * 10)- 10;
for(Integer entry : badgelist.keySet()){
if(pageInstance.get(p) == pageten || pageInstance.get(p) == pageten + 1 || pageInstance.get(p) == pageten + 2 || pageInstance.get(p) == pageten + 3 || pageInstance.get(p) == pageten + 4 || pageInstance.get(p) == pageten + 5 || pageInstance.get(p) == pageten + 6 || pageInstance.get(p) == pageten + 7 || pageInstance.get(p) == pageten + 8 || pageInstance.get(p) == pageten + 9){
if(entry == 0){
}else if(p.hasPermission("fpchat.badge" + badgeperm.get(entry)) || p.isSynced(entry)){
p.sendMessage(badgelist.get(entry) + ChatColor.GOLD + " Badge #" + entry + ": " + ChatColor.GREEN + " - " + badgename.get(entry) + ChatColor.GOLD + " - UNLOCKED");
}else{
p.sendMessage(badgelist.get(entry) + ChatColor.GOLD + " Badge #" + entry + ": " + ChatColor.GREEN + " - " + badgename.get(entry) + ChatColor.RED + " - LOCKED");
}
}
pageInstance.put(p,(pageInstance.get(p)+1));
}
p.sendMessage(ChatColor.AQUA + "");
p.sendMessage(ChatColor.YELLOW + "Page " + Integer.toString(page) + " of " + Integer.toString(pagenum));
p.sendMessage(ChatColor.AQUA + "---------------------------------------------------");
pageInstance.remove(p);
}
}
public static void setupBadges(){
//DO NOT CHANGE ANY OF THE BADGEID NUMBERS. THIS WILL REALLY SCREW UP PEOPLES BADGE PERMISSIONS IN GAME. I WILL SOON ADD SOMETHING FOR PEOPLE TO MORE EASILY SEE THEIR UNLOCKED BADGES
//These are the designs used in game of each badge
badgelist.put(0, "");
badgelist.put(1, "&6{✮}");
badgelist.put(2, "&b{&7❂&b}");
badgelist.put(3, "&c[]");
badgelist.put(4, "&8{&9Ⓜ&8}");
badgelist.put(5, "&b(✌)");
badgelist.put(6, "&3{☹}");
badgelist.put(7, "&4<&8➳&4>");
badgelist.put(8, "&a(รɦṁ)");
badgelist.put(9, "&e[Ⓒ]");
badgelist.put(10, "&8[&f☠&8]");
badgelist.put(11, "&b{&f☃&b}");
badgelist.put(12, "&d{&6❀&d}");
badgelist.put(13, "&e<&a☣&e>");
badgelist.put(14, "&5(&3☔&5)");
badgelist.put(15, "&a{☎}");
badgelist.put(16, "&7{&b♫&7}");
badgelist.put(17, "&e<&6⚡&e>");
badgelist.put(18, "&3(&c⍤&3)");
badgelist.put(19, "&f[&c♛&f]");
badgelist.put(20, "&b[&a✦&b]");
badgelist.put(21, "&e[&7♜&e]");
badgelist.put(22, "&6[&7⚒&6]");
badgelist.put(23, "&3[&7❖&3]");
badgelist.put(24, "&2[&7⧈&2]");
badgelist.put(25, "&5(&d⚉&5)");
badgelist.put(26, "&1[&4β&1]");
badgelist.put(27, "&b{&3&lᴮᵀ&b}");
badgelist.put(28, "&c{&b&lᴴᴮᵀ&c}");
badgelist.put(29, "&8{&6&lᴮ&a&lᵒ&6&lᵒ&8}");
badgelist.put(30, "&3<&eᵒᵒᶠ&3>");
badgelist.put(31, "&b&l{&f&l✔&b&l}");
badgelist.put(32, "&a||");
badgelist.put(33, "&1⦅&b&lx2&r&1⦆");
badgelist.put(34, "&a«&2&lx2&r&a»");
badgelist.put(35, "&e⦉&6x2&e⦊");
badgelist.put(36, "&6&cⰀ&6﴿");
badgelist.put(37, "&7﴿");
badgelist.put(38, "&7⌈&f◉&d⩐&f◉&7⌉");
badgelist.put(39, "&8[&7༗&8]");
badgelist.put(40, "&8[&bⒺ➀&8]");
badgelist.put(41, "&8[&eⒺ➁&8]");
badgelist.put(42, "&8[&2Ⓔ➂&8]");
badgelist.put(43, "&8[&6Ⓔ&c➃&8]");
badgelist.put(44, "&8[&bⒺ&a➄&8]");
badgelist.put(45, "&8[&cⒺ&b➅&8]");
badgelist.put(46, "&5{&dɪᴘ&5}");
badgelist.put(47, "&5{&4&eɪ&9ᴘ&a⁺&5}");
badgelist.put(48, "&6{&b&c⁺&a⁺&6}");
badgelist.put(49, "&3{&bᴛᴘ&3}");
badgelist.put(50, "&6{&eᴘʟᴀᴛ&6}");
badgelist.put(51, "&8{&7ᴛɪ&8}");
badgelist.put(52, "&c⦉&4x2&c⦊");
badgelist.put(53, "&b⦅&1&lx3&r&b⦆");
badgelist.put(54, "&8[&5✥&8]");
badgelist.put(55, "&8{&bⒶ&8}");
badgelist.put(56, "&8{&3ᴼᴾ&8}");
badgelist.put(57, "&8{&4&l♔&8}");
badgelist.put(58, "&7{&9☯&7}");
badgelist.put(59, "&f⟦&6&o&l&8&f⟧");
badgelist.put(60, "&6ヽ( •_)ᕗ");
badgelist.put(61, "&c⦇&6☕&c⦈");
badgelist.put(62, "&b&l⦍&c&l&b&l⦐");
badgelist.put(63, "&a⦇&e⧔⧕&d⦈");
badgelist.put(64, "&2[&c❒&2]");
badgelist.put(65, "&4{&e▼&4}");
badgelist.put(66, "&e{&d☞&e}");
badgelist.put(67, "&f<&7✄&f>");
badgelist.put(68, "&5⸨&d◕‿‿◕&5⸩");
badgelist.put(69, "&d⌇&4❤&d⌇");
badgelist.put(70, "&6ʕ•ᴥ•ʔ");
badgelist.put(71, "&f<&9☆彡&f>");
badgelist.put(72, "&a(&5✿&a}");
badgelist.put(73, "&a&k!&e&k!&c&k!&b&k!&c&k!&e&k!&a&k!&r");
badgelist.put(74, "&a[&f[&6Ⱑ&f]&a]");
badgelist.put(75, "&4]&8⸮&4[");
badgelist.put(76, "&0【&7&l〆&r&0】");
badgelist.put(77, "&9[&2⸙&9]");
badgelist.put(78, "&8⸠⨷⸡");
badgelist.put(79, "&a⦑&4⚐&9⚑&a⦒");
badgelist.put(80, "p");
// These are the badge names listed in the badge menu.
// See notes here for possible badge uses
badgename.put(0, "Empty"); //Represents an empty badge slot. Equipping removes whatever badge is in that slot.
badgename.put(1, "Gold Star"); //We have given these to people who win contests or in game events we have
badgename.put(2, "Silver Star"); //We've used this as a voting reward in the past
badgename.put(3, "Original Player"); //I've tried to reserve this one but people started giving it out, but we can still give this to old donors.
badgename.put(4, "Staff"); //Staff only
badgename.put(5, "Peace"); //Sell in-game or on the donor shop
badgename.put(6, "Boo-hoo"); //Obtainable by easter egg in one of the spawn vaults
badgename.put(7, "Hunter"); //Sell in-game or on the donor shop
badgename.put(8, "Shmeckle"); //Sell in-game or on the donor shop
badgename.put(9, "Copyright"); //Sell in-game or on the donor shop
badgename.put(10, "Skull"); //Sell in-game or on the donor shop
badgename.put(11, "Snowman"); //Sell in-game or on the donor shop
badgename.put(12, "Flower"); //Sell in-game or on the donor shop
badgename.put(13, "Radioactive"); //Sell in-game or on the donor shop
badgename.put(14, "Rainy"); //Sell in-game or on the donor shop
badgename.put(15, "Telephone"); //Sell in-game or on the donor shop
badgename.put(16, "Music"); //Sell in-game or on the donor shop
badgename.put(17, "Lightning"); //Sell in-game or on the donor shop
badgename.put(18, "Wow"); //Sell in-game or on the donor shop
badgename.put(19, "Monarch"); //Give to old creative donor with Monarch
badgename.put(20, "Baron"); //Give to old creative donor with Baron
badgename.put(21, "Artificer"); // Give to old creative donor with Artificer
badgename.put(22, "Craftsman"); // Give to old creative donor with Craftsman
badgename.put(23, "Journeyman"); // Give to old creative donor with Journeyman
badgename.put(24, "Carpenter"); // Give to old creative donor with Carpenter
badgename.put(25, "Pig"); //Sell in-game or on the donor shop
badgename.put(26, "Beta"); // Reserve for contests or special gift from staff
badgename.put(27, "Build Team"); // Reserve for Build team
badgename.put(28, "Head Builder"); // May not have any use anymore, but not really something for players
badgename.put(29, "Boo"); //Sell in-game or on the donor shop (OR give to players at Halloween)
badgename.put(30, "OOF!"); //Obtainable easteregg
badgename.put(31, "Trusted / Verified Player"); //Give to trusted/ex staff/ build team
badgename.put(32, "Professional Player"); //Can make a reward for parkour. We've associated this badge with an achievement in the past
badgename.put(33, "x2 Slots (Blue)"); // Anyone with this badge can equip a badge to a second slot
badgename.put(34, "x2 Slots (Green)"); // Same as #33 but green
badgename.put(35, "x2 Slots (Yellow)"); // same as #33 and #34 but yellow
badgename.put(36, "Gilded Crest"); //I've typically only given this one to staff
badgename.put(37, "Silver Crest"); //Sell in-game or on the donor shop
badgename.put(38, "Derp"); //Sell in-game or on the donor shop
badgename.put(39, "Hawk-Eye");//Sell in-game or on the donor shop
badgename.put(40, "Expert Level 1"); // Survival can make unlockable with rank progression
badgename.put(41, "Expert Level 2"); // Survival can make unlockable with rank progression
badgename.put(42, "Expert Level 3"); // Survival can make unlockable with rank progression
badgename.put(43, "Expert Level 4"); // Survival can make unlockable with rank progression
badgename.put(44, "Expert Level 5"); // Survival can make unlockable with rank progression
badgename.put(45, "Expert Level 6"); // Survival can make unlockable with rank progression
badgename.put(46, "VIP"); // Give to old main donors
badgename.put(47, "VIP+"); // Give to old main donors
badgename.put(48, "VIP++"); // Give to old main donors
badgename.put(49, "Topaz"); // Give to old main donors
badgename.put(50, "Platinum"); // Give to old main donors
badgename.put(51, "Titanium"); // Give to old main donors
badgename.put(52, "x2 Slots (Red)"); // Same as #33, #34, and #35 but red
badgename.put(53, "x3 Slots (Blue)"); // Anyone with this badge can equip 3 badges
badgename.put(54, "Architect"); //Can make unlockable on creative
badgename.put(55, "Admin"); // Reserved for staff
badgename.put(56, "Operator"); // Reserved for staff
badgename.put(57, "Owner"); // I wonder who this is for
badgename.put(58, "PvP Legend"); // Can give to old PvP donors and maybe even kitpvp donors
badgename.put(59, "Gold OG"); // Can give to old donors who had some of the higher ranks
badgename.put(60, "Dab"); //Sell in-game or on the donor shop
badgename.put(61, "Coffee"); //Sell in-game or on the donor shop
badgename.put(62, "F"); //Sell in-game or on the donor shop
badgename.put(63, "Candy"); //Sell in-game or on the donor shop
badgename.put(64, "Box"); //Sell in-game or on the donor shop
badgename.put(65, "Pizza"); //Sell in-game or on the donor shop
badgename.put(66, "Pointer"); //Sell in-game or on the donor shop
badgename.put(67, "Scissors"); //Sell in-game or on the donor shop
badgename.put(68, "Grin");//Sell in-game or on the donor shop
badgename.put(69, "Heart"); //Can give away for Valentine's day
badgename.put(70, "Bear");//Sell in-game or on the donor shop
badgename.put(71, "Comet");//Sell in-game or on the donor shop
badgename.put(72, "Tropical Flower");//Sell in-game or on the donor shop
badgename.put(73, "Magic");//Sell in-game or on the donor shop
badgename.put(74, "Sealed");//Sell in-game or on the donor shop
badgename.put(75, "Backwards");//Sell in-game or on the donor shop
badgename.put(76, "Dagger");//Sell in-game or on the donor shop
badgename.put(77, "Leaf");//Sell in-game or on the donor shop
badgename.put(78, "Starship");//Sell in-game or on the donor shop
badgename.put(79, "Flags");//Sell in-game or on the donor shop
badgename.put(80, "Stunned");//Sell in-game or on the donor shop
// BADGE PERMS
// These are the specific perm for each badge. They go like this:
// fpchat.badge.<badgeperm> I.E fpchat.badge.goldstar
// See notes above for badges use ideas
badgeperm.put(0, "");
badgeperm.put(1, ".goldstar");
badgeperm.put(2, ".silverstar");
badgeperm.put(3, ".og");
badgeperm.put(4, ".staff");
badgeperm.put(5, ".peace");
badgeperm.put(6, ".boohoo");
badgeperm.put(7, ".hunter");
badgeperm.put(8, ".shmeckle");
badgeperm.put(9, ".copyright");
badgeperm.put(10, ".skull");
badgeperm.put(11, ".snowman");
badgeperm.put(12, ".flower");
badgeperm.put(13, ".radioactive");
badgeperm.put(14, ".rainy");
badgeperm.put(15, ".telephone");
badgeperm.put(16, ".music");
badgeperm.put(17, ".lightning");
badgeperm.put(18, ".wow");
badgeperm.put(19, ".monarch");
badgeperm.put(20, ".baron");
badgeperm.put(21, ".artificer");
badgeperm.put(22, ".craftsman");
badgeperm.put(23, ".journeyman");
badgeperm.put(24, ".carpenter");
badgeperm.put(25, ".pig");
badgeperm.put(26, ".fpn");
badgeperm.put(27, ".bt");
badgeperm.put(28, ".hbt");
badgeperm.put(29, ".boo");
badgeperm.put(30, ".oof");
badgeperm.put(31, ".verified");
badgeperm.put(32, ".pro");
badgeperm.put(33, ".2blue");
badgeperm.put(34, ".2green");
badgeperm.put(35, ".2yellow");
badgeperm.put(36, ".gildedcrest");
badgeperm.put(37, ".silvercrest");
badgeperm.put(38, ".derp");
badgeperm.put(39, ".hawkeye");
badgeperm.put(40, ".expert1");
badgeperm.put(41, ".expert2");
badgeperm.put(42, ".expert3");
badgeperm.put(43, ".expert4");
badgeperm.put(44, ".expert5");
badgeperm.put(45, ".expert6");
badgeperm.put(46, ".vip");
badgeperm.put(47, ".vip+");
badgeperm.put(48, ".vip++");
badgeperm.put(49, ".topaz");
badgeperm.put(50, ".platinum");
badgeperm.put(51, ".titanium");
badgeperm.put(52, ".2red");
badgeperm.put(53, ".3blue");
badgeperm.put(54, ".architect");
badgeperm.put(55, ".admin");
badgeperm.put(56, ".operator");
badgeperm.put(57, ".owner");
badgeperm.put(58, ".pvplegend");
badgeperm.put(59, ".goldog");
badgeperm.put(60, ".dab");
badgeperm.put(61, ".coffee");
badgeperm.put(62, ".f");
badgeperm.put(63, ".candy");
badgeperm.put(64, ".box");
badgeperm.put(65, ".pizza");
badgeperm.put(66, ".pointer");
badgeperm.put(67, ".scissors");
badgeperm.put(68, ".grin");
badgeperm.put(69, ".heart");
badgeperm.put(70, ".bear");
badgeperm.put(71, ".comet");
badgeperm.put(72, ".tropicalflower");
badgeperm.put(73, ".magic");
badgeperm.put(74, ".sealed");
badgeperm.put(75, ".backwards");
badgeperm.put(76, ".dagger");
badgeperm.put(77, ".leaf");
badgeperm.put(78, ".starship");
badgeperm.put(79, ".flags");
badgeperm.put(80, ".stunned");
}
}

View File

@ -0,0 +1,32 @@
package com.fpghoti.fpchatx.badge;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class BadgeSet {
public static void setBadge(FPlayer p, int slot, int badgeId){
if(slot > 3){
slot = 3;
}else if(slot < 1){
slot = 1;
}
String uuid = p.getUniqueId().toString();
Util.connect();
if(!FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getChatFeatureTable())){
createPlayer(p);
}
FPChat.getPlugin().getMySQLConnection().set("badge_slot" + String.valueOf(slot), badgeId, "player_uuid", "=", uuid, FPChat.getPlugin().getMainConfig().getChatFeatureTable());
BadgeGetter.getBadges(p);
}
public static void createPlayer(FPlayer p){
String uuid = p.getUniqueId().toString();
Util.connect();
if(!FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getChatFeatureTable())){
FPChat.getPlugin().getMySQLConnection().insertInto("player_uuid, badge_slot1, badge_slot2, badge_slot3", " '" + uuid + "', '0', '0', '0' ", FPChat.getPlugin().getMainConfig().getChatFeatureTable());
}
}
}

View File

@ -0,0 +1,46 @@
package com.fpghoti.fpchatx.badge;
import java.util.UUID;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class SyncGetter {
public static void syncBadges(FPlayer p, boolean create){
UUID id = p.getUniqueId();
String uuid = id.toString();
Util.connect();
if(create && !FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable())){
SyncSet.createPlayer(p);
}
String raw = (String) FPChat.getPlugin().getMySQLConnection().get("badges", "player_uuid", "=", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable());
if(raw != null && raw.length() > 0 && raw.charAt(0) == ','){
raw = raw.substring(1);
}
if(raw != null && !raw.equals("")) {
String list[] = Util.stripLast(raw).split(",");
for(String item : list) {
if(!item.equals("")) {
Integer badgeId = Integer.parseInt(item);
p.addSyncedBadge(badgeId);
}
}
}
}
public static Boolean syncExists(FPlayer p){
Boolean check = false;
if(p == null) {
return false;
}
String uuid = p.getUniqueId().toString();
Util.connect();
if(FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable())){
check = true;
}
return check;
}
}

View File

@ -0,0 +1,126 @@
package com.fpghoti.fpchatx.badge;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class SyncSet {
public static void update(FPlayer p) {
update(p, true);
}
public static void update(FPlayer p, boolean create){
String uuid = p.getUniqueId().toString();
Util.connect();
if(create && !FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable())){
createPlayer(p);
}
SyncGetter.syncBadges(p, false);
String nl = "";
String nl2 = "";
String permstring = getBadgeString(p);
String[] permids = permstring.split(",");
for(String item : permids){
if(Util.isDigit(item)) {
int id = Integer.parseInt(item);
if(!p.isSynced(id)){
nl = nl + item + ",";
}
}
}
for(int id : p.syncedList()){
String item = Integer.toString(id);
nl2 = nl2 + item + ",";
}
nl = nl + nl2;
FPChat.getPlugin().getMySQLConnection().set("badges", nl, "player_uuid", "=", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable());
SyncGetter.syncBadges(p,false);
}
public static void revoke(FPlayer p) {
revoke(p,true);
}
public static void revoke(FPlayer p, boolean create) {
String uuid = p.getUniqueId().toString();
Util.connect();
if(create && !FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable())){
createPlayer(p);
}
SyncGetter.syncBadges(p, false);
String nl = "";
FPChat.getPlugin().getMySQLConnection().set("badges", nl, "player_uuid", "=", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable());
SyncGetter.syncBadges(p, false);
}
public static void revoke(FPlayer p, int badgeId){
revoke(p, badgeId, true);
}
public static void revoke(FPlayer p, int badgeId, boolean create){
String uuid = p.getUniqueId().toString();
Util.connect();
if(create && !FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable())){
createPlayer(p);
}
SyncGetter.syncBadges(p, false);
String nl = "";
String nl2 = "";
for(String item : revokeBadgeString(p, badgeId).split(",")){
if(Util.isDigit(item)) {
int id = Integer.parseInt(item);
if(p.isSynced(id)){
nl = nl + item + ",";
}
}
}
for(int id : p.syncedList()){
String item = Integer.toString(id);
if(id != badgeId){
nl2 = nl2 + item + ",";
}
}
nl = nl + nl2;
FPChat.getPlugin().getMySQLConnection().set("badges", nl, "player_uuid", "=", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable());
SyncGetter.syncBadges(p, false);
}
public static String getBadgeString(FPlayer p){
String list = "";
for(int i = 1; i < BadgeList.badgeperm.size(); i++){
if(p.hasPermission("fpchat.badge" + BadgeList.badgeperm.get(i))){
String add = Integer.toString(i) + ",";
list = list + add;
}else if(p.getBadgeQueue().contains(i)) {
String add = Integer.toString(i) + ",";
list = list + add;
p.unqueueBadge(i);
}
}
return list;
}
public static String revokeBadgeString(FPlayer p, int badgeId){
String list = "";
for(int i = 1; i < BadgeList.badgeperm.size(); i++){
if(p.hasPermission("fpchat.badge" + BadgeList.badgeperm.get(i))){
if(i != badgeId){
String add = Integer.toString(i) + ",";
list = list + add;
}
}
}
return list;
}
public static void createPlayer(FPlayer p){
String uuid = p.getUniqueId().toString();
Util.connect();
if(!FPChat.getPlugin().getMySQLConnection().itemExists("player_uuid", uuid, FPChat.getPlugin().getMainConfig().getPermSyncTable())){
FPChat.getPlugin().getMySQLConnection().insertInto("player_uuid, badges", " '" + uuid + "', '' ", FPChat.getPlugin().getMainConfig().getPermSyncTable());
}
}
}

View File

@ -0,0 +1,344 @@
package com.fpghoti.fpchatx.chat;
import java.io.File;
import java.util.ArrayList;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.badge.BadgeList;
import com.fpghoti.fpchatx.config.ChannelFile;
import com.fpghoti.fpchatx.customcodes.BubbleCode;
import com.fpghoti.fpchatx.customcodes.Codify;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public abstract class ChatChannel {
private static ChatChannel defaultChannel = null;
private static ArrayList<StandardChannel> channels;
private static ArrayList<TempChannel> tempchannels;
private static ChatChannel shout;
private static final String[] reserved = {"shout"};
private static ArrayList<String> loadChannelNames() {
ArrayList<String> cnames = new ArrayList<String>();
for(File f : ChannelFile.getChannelFiles()) {
String fname = f.getName();
cnames.add(fname.substring(0, fname.length()-4));
}
return cnames;
}
public static StandardChannel loadChannel(String channelname) {
if(ChannelFile.channelExists(channelname)) {
return makeChannel(channelname);
}
return null;
}
public static StandardChannel makeChannel(String channelname) {
ChannelFile file = new ChannelFile(FPChat.getPlugin(), channelname);
StandardChannel c = new StandardChannel(FPChat.getPlugin(), file);
return c;
}
public static TempChannel makeTempChannel(FPlayer owner, String channelname) {
TempChannel t = new TempChannel(FPChat.getPlugin(), owner, channelname);
t.setShortcut(channelname);
tempchannels.add(t);
return t;
}
public static void setShout(ShoutChannel shoutchannel) {
shout = shoutchannel;
}
public static void deleteChannel(String channelname) {
ChatChannel c = getChannel(channelname);
boolean temp = false;
if(c == null) {
c = getTempChannel(channelname);
temp = true;
}
if(c != null) {
String cname = c.getName();
for(FPlayer pl : c.getPlayers()) {
pl.leaveChannel(cname);
FPlayer.dualMsg(pl, ChatColor.YELLOW + "The channel you were in " + ChatColor.WHITE + c.getName() + ChatColor.YELLOW + " was deleted.");
}
tempchannels.remove(c);
channels.remove(c);
if(!temp) {
File cdir = new File(FPChat.getPlugin().getDataFolder() + File.separator + "channels");
cdir.mkdirs();
File configFile = new File(cdir, cname + ".yml");
if(configFile.delete()) {
FPChat.getPlugin().log(Level.INFO, "Channel file for " + cname + " successfully deleted.");
} else {
FPChat.getPlugin().log(Level.SEVERE, "======================================================");
FPChat.getPlugin().log(Level.SEVERE, "| ------------------ FPCHATX ERROR ----------------- |");
FPChat.getPlugin().log(Level.SEVERE, "======================================================");
FPChat.getPlugin().log(Level.SEVERE, "| Channel not properly removed. File deletion error. |");
FPChat.getPlugin().log(Level.SEVERE, "| ---------- Check the file and try again. --------- |");
FPChat.getPlugin().log(Level.SEVERE, "======================================================");
return;
}
}else {
FPChat.getPlugin().log(Level.INFO, "Temp Channel " + cname + " was deleted.");
}
}
}
public static ChatChannel getDefault() {
return defaultChannel;
}
public static void setDefault(String channel) {
defaultChannel = getChannel(channel);
}
public static ArrayList<ChatChannel> getChannels(){
ArrayList<ChatChannel> c = new ArrayList<ChatChannel>();
for(StandardChannel ch : channels) {
c.add(ch);
}
for(TempChannel ch : tempchannels) {
c.add(ch);
}
return c;
}
public static ChatChannel getChannel(String name) {
for(ChatChannel c : channels) {
if(c.getName().equalsIgnoreCase(name)) {
return c;
}
}
return null;
}
public static ChatChannel getTempChannel(String name) {
for(ChatChannel c : tempchannels) {
if(c.getName().equalsIgnoreCase(name)) {
return c;
}
}
return null;
}
public static void loadChannels() {
shout = (ChatChannel)(new ShoutChannel(FPChat.getPlugin()));
channels = new ArrayList<StandardChannel>();
tempchannels = new ArrayList<TempChannel>();
for(String c : loadChannelNames()) {
StandardChannel chan = loadChannel(c);
if(chan != null) {
channels.add(chan);
}
}
}
public static ChatChannel getShout() {
return shout;
}
public static boolean channelExists(String name) {
for(ChatChannel c : getChannels()) {
if(c.getName().equalsIgnoreCase(name)) {
return true;
}
}
return false;
}
public static boolean isReserved(String name) {
if(channelExists(name)) {
return true;
}
for(String s : reserved) {
if(s.equalsIgnoreCase(name)) {
return true;
}
}
return false;
}
public static void addChannel(StandardChannel channel) {
channels.add(channel);
}
protected FPChat plugin;
protected String name;
protected String shortcut;
protected String chatFormat;
protected String distinguishedChatFormat;
protected boolean isWhitelisted;
protected ArrayList<UUID> whitelist;
protected ArrayList<UUID> banned;
public ChatChannel(FPChat plugin) {
this.plugin = plugin;
this.isWhitelisted = false;
this.whitelist = new ArrayList<UUID>();
}
public void makeDefault() {
ChatChannel.defaultChannel = this;
}
public abstract boolean isTemp();
public abstract boolean isDefault();
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public abstract void kick(FPlayer p);
public abstract void setShortcut(String shortcut);
public String getShortcut() {
return this.shortcut;
}
public abstract void setChatFormat(String chatFormat);
public String getChatFormat() {
return this.chatFormat.replace("{channel}", name);
}
public abstract void setDistinguishedChatFormat(String chatFormat);
public String getDistinguishedChatFormat() {
return this.distinguishedChatFormat.replace("{channel}", name);
}
public abstract void enableWhitelist();
public abstract void disableWhitelist();
public boolean whitelistEnabled() {
return this.isWhitelisted;
}
public void whitelistAdd(OfflinePlayer p) {
whitelistAdd(p.getUniqueId());
}
public void whitelistAdd(Player p) {
whitelistAdd(p.getUniqueId());
}
public void whitelistAdd(FPlayer p) {
whitelistAdd(p.getUniqueId());
}
public abstract void whitelistAdd(UUID uuid);
public void whitelistRemove(OfflinePlayer p) {
whitelistRemove(p.getUniqueId());
}
public void whitelistRemove(Player p) {
whitelistRemove(p.getUniqueId());
}
public void whitelistRemove(FPlayer p) {
whitelistRemove(p.getUniqueId());
}
public abstract void whitelistRemove(UUID uuid);
public abstract boolean isWhitelisted(FPlayer p);
public void log(String str) {
plugin.log(Level.INFO, str);
}
public abstract void enableRadius();
public abstract void disableRadius();
public abstract boolean hasRadius();
public abstract void setRadius(int radius);
public abstract int getRadius();
public boolean isBanned(FPlayer p) {
return banned.contains(p.getUniqueId());
}
public abstract void addBanned(FPlayer p);
public abstract ArrayList<FPlayer> getPlayers();
public abstract void removeBanned(FPlayer p);
public ArrayList<UUID> getBanned(){
return this.banned;
}
public int playerCount() {
int count = 0;
for(FPlayer p : FPlayer.getPlayers()) {
if(p.getChannels().contains(name) || p.getTempChannels().contains(name)) {
count++;
}
}
return count;
}
public String format(FPlayer p, String msg) {
String finalMessage = "";
String slot3 = "", slot2 = "", slot1 = "";
String stf = "";
if (Permission.canUseColor(p)) {
msg = msg.replaceAll("&([0-9a-fk-or])", "§$1");
} else {
msg = msg.replaceAll("§[0-9a-fk-or]", "");
}
String header = PrepareChat.swapPlaceholders(p, this, msg);
if(Permission.isStaff(p)){
stf = FPChat.getPlugin().getMainConfig().getStaffBadge();
}
if(plugin.getMainConfig().mySQLEnabled()){
Integer[] badges = p.getBadges();
slot1 = BadgeList.badgelist.get(badges[0]);
slot2 = BadgeList.badgelist.get(badges[1]);
slot3 = BadgeList.badgelist.get(badges[2]);
}
String filler = "";
if(plugin.getMainConfig().chatFilterEnabled()){
filler = "word ";
}
if(Permission.canUseColor(p)){
String last = ChatFilter.filter(filler + msg);
last = BubbleCode.bubblecode(Permission.canBubbleCode(p), Codify.changeFormatSign(last));
finalMessage = stf + slot3 + slot2 + slot1 + header + last;
}else{
String newmsg = ChatColor.stripColor(ChatColor.translateAlternateColorCodes('§', ChatFilter.filter(filler + msg)));
finalMessage = stf + slot3 + slot2 + slot1 + Codify.removeBubbles(header + newmsg);
}
return finalMessage;
}
public abstract void sendMessage(String msg, FPlayer from);
public void delete() {
ChatChannel.deleteChannel(name);
}
}

View File

@ -0,0 +1,87 @@
package com.fpghoti.fpchatx.chat;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import com.fpghoti.fpchatx.FPChat;
public class ChatFilter {
public static ArrayList<String> filtered = null;
//CHAT FILTER
public static String filter(String sentence){ // THIS FUNCTION TAKES THE RAW CHAT MESSAGE AND SENDS EACH
String msg = sentence; // INDIVIDUAL WORD INTO THE FILTER WORD FUNCTION BELOW
if(FPChat.getPlugin().getMainConfig().chatFilterEnabled()){
msg = "";
int i = 0;
for(String s : sentence.split(" ")){
if(i != 0){
msg = msg + filterWord(s) + " ";
}
i++;
}
}
return msg;
}
public static String filterWord(String word){ // THIS TAKES THE WORD, LOWERCASES IT,
String wordp = ""; // AND REPLACES CHARACTERS "1" and "!" with "i", "5" with "s", "6" with "g", and
if(FPChat.getPlugin().getMainConfig().chatFilterEnabled()){ // "3" with "e". It then compares it to the list of
String word2 = word.toLowerCase(); // Naughty words and replaces it with "Frank" or "bleep" if a match is found
String color = ChatColor.getLastColors(word2);
if(word2.length() >= 2 && word2.charAt(word2.length() -1) == '!'){
for(int i = 0; i < word2.length() -1; i++ ){
wordp += word2.charAt(i);
}
word2 = wordp;
}
wordp = "";
for(int i = 0; i < word2.length(); i++ ){
if(word2.charAt(i) != '!'){
wordp += word2.charAt(i);
}else{
wordp += 'i';
}
}
word2 = wordp;
word2 = ChatColor.translateAlternateColorCodes('§', word2);
word2 = ChatColor.translateAlternateColorCodes('&', word2);
word2 = ChatColor.stripColor(word2);
word2 = word2.replaceAll("\\p{Punct}+", "").replaceAll("1", "i").replaceAll("5", "s").replaceAll("6", "g").replaceAll("3", "e");
if(filtered == null) {
filtered = new ArrayList<String>();
for(String s : FPChat.getPlugin().getMainConfig().getNaughtyWords().split(",")) {
filtered.add(s);
}
}
for(String item : filtered){
if(ChatColor.stripColor(word2).equalsIgnoreCase(item) || ChatColor.stripColor(word2).equalsIgnoreCase(item + "s")){
if (word2.length() > 2) {
if(word2.substring(word2.length() - 3).equalsIgnoreCase("ing")){
word = "bleeping";
if(FPChat.getPlugin().getMainConfig().frankModeEnabled()){
word = "Franking";
}
}else{
word = "bleep";
if(FPChat.getPlugin().getMainConfig().frankModeEnabled()){
word = "Frank";
}
}
}
}
word = color + word;
}
word2 = null;
}
return word;
}
// By the end of the loop, the sentence is reconstructed with the naughty words replaced
}

View File

@ -0,0 +1,84 @@
package com.fpghoti.fpchatx.chat;
import org.bukkit.Bukkit;
import org.bukkit.World;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.customcodes.BubbleCode;
import com.fpghoti.fpchatx.customcodes.Codify;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.VaultUtil;
public class PrepareChat {
public static String swapPlaceholders(FPlayer p, ChatChannel channel, String msg) {
return swapPlaceholders(p,channel,msg,"", false);
}
public static String swapPlaceholders(FPlayer p, String recipient, String msg, boolean in) {
return swapPlaceholders(p,null,msg,recipient,in);
}
public static String swapPlaceholders(FPlayer p, String msg) {
return swapPlaceholders(p,null,msg,"",false);
}
private static String swapPlaceholders(FPlayer p, ChatChannel channel, String msg, String recipient, boolean in) {
if(!p.isOnline()) {
return "";
}
Player sender = Bukkit.getPlayer(p.getUniqueId());
String prefix = "";
String suffix = "";
String group = "";
String groupPrefix = "";
String groupSuffix = "";
World world = sender.getWorld();
prefix = VaultUtil.chat.getPlayerPrefix(sender);
prefix = BubbleCode.bubblecode(Permission.canBubbleCode(p), Codify.changeFormatSign(prefix)).replaceAll("&([0-9A-FK-OR])", "§$1").replace("&", "§");
suffix = VaultUtil.chat.getPlayerSuffix(sender);
suffix = BubbleCode.bubblecode(Permission.canBubbleCode(p), Codify.changeFormatSign(suffix)).replaceAll("&([0-9A-FK-OR])", "§$1").replace("&", "§");
group = VaultUtil.permission.getPrimaryGroup(sender);
groupPrefix = VaultUtil.chat.getGroupPrefix(world, group).replace("&", "§");
groupSuffix = VaultUtil.chat.getGroupSuffix(world, group).replace("&", "§");
String displayName = sender.getDisplayName();
displayName = BubbleCode.bubblecode(Permission.canBubbleCode(p), Codify.changeFormatSign(displayName)).replaceAll("&([0-9A-FK-OR])", "§$1").replace("&", "§");
String format = "";
if(channel != null) {
if(Permission.isDistinguished(p)) {
format = channel.getDistinguishedChatFormat();
}else {
format = channel.getChatFormat();
}
}else {
if(recipient.equals("")) {
format = FPChat.getPlugin().getMainConfig().getShoutFormat();
}else {
if(in) {
format = FPChat.getPlugin().getMainConfig().getInMsgFormat();
}else {
format = FPChat.getPlugin().getMainConfig().getOutMsgFormat();
}
}
}
format = format.replaceAll("&([0-9a-fk-or])", "§$1");
format = format.replace("{prefix}", prefix);
format = format.replace("{prefix}", prefix);
format = format.replace("{suffix}", suffix);
format = format.replace("{group}", group);
format = format.replace("{groupprefix}", groupPrefix);
format = format.replace("{groupSuffix}", groupSuffix);
if (channel != null) {
format = format.replace("{shortcut}", channel.getShortcut());
format = format.replace("{name}", channel.getName());
}
format = format.replace("{player}", displayName);
format = format.replace("{recipient}", recipient);
format = format.replace("{world}", world.getName());
return format;
}
}

View File

@ -0,0 +1,158 @@
package com.fpghoti.fpchatx.chat;
import java.util.ArrayList;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.player.FPlayer;
public class ShoutChannel extends ChatChannel{
/*
* This is the shout channel
*
* Shout is intended to act as a streamlined alternative
* to setting up a StandardChannel with the radius disabled.
*
* It also provides the ability to restrict global message sending
* to a cooldown.
*
* It also allows for a separate mute (hush) to be enforced.
*
* Players can opt out of seeing shout.
*
* Many functions here will do nothing. Shout extends ChatChannel
* for the sake of treating shouts as a form of chat message.
*/
public ShoutChannel(FPChat plugin) {
super(plugin);
this.name = "Shout";
this.shortcut = "Shout";
this.chatFormat = plugin.getMainConfig().getShoutFormat();
this.distinguishedChatFormat = plugin.getMainConfig().getDistinguishedShout();
}
@Override
public boolean isTemp() {
// Shout will always be a registered channel while the plugin is enabled.
return false;
}
@Override
public boolean isDefault() {
// Shout can only be spoken in by use of command, so cannot be default.
return false;
}
@Override
public void kick(FPlayer p) {
// No real reason to use this. It will hush the player if called.
// Leaving the shout channel is impossible. Standard channel should
// be used if the ability to leave is required.
p.hush();
}
@Override
public void setShortcut(String shortcut) {
// Shout has a dedicated command, so a shortcut is not needed.
}
@Override
public void setChatFormat(String chatFormat) {
this.chatFormat = plugin.getMainConfig().getShoutFormat();
}
@Override
public void setDistinguishedChatFormat(String chatFormat) {
this.distinguishedChatFormat = plugin.getMainConfig().getDistinguishedShout();
}
@Override
public void enableWhitelist() {
return;
}
@Override
public void disableWhitelist() {
return;
}
@Override
public void whitelistAdd(UUID uuid) {
return;
}
@Override
public void whitelistRemove(UUID uuid) {
return;
}
@Override
public boolean isWhitelisted(FPlayer p) {
return false;
}
@Override
public void enableRadius() {
return;
}
@Override
public void disableRadius() {
return;
}
@Override
public boolean hasRadius() {
return false;
}
@Override
public void setRadius(int radius) {
return;
}
@Override
public int getRadius() {
return 0;
}
@Override
public ArrayList<FPlayer> getPlayers(){
return FPlayer.getPlayers();
}
@Override
public void addBanned(FPlayer p) {
// No real reason to use this. It will hush the player if called.
// Leaving the shout channel is impossible. Standard channel should
// be used if the ability to leave is required.
p.hush();
}
@Override
public void removeBanned(FPlayer p) {
// No real reason to use this. It will hush the player if called.
// Leaving the shout channel is impossible. Standard channel should
// be used if the ability to leave is required.
p.unhush();
}
@Override
public void sendMessage(String msg, FPlayer from) {
plugin.log(Level.INFO, "Shout: " + msg);
for(FPlayer p : FPlayer.getPlayers()) {
if(p.isShoutVisible() && !p.isIgnoring(from)) {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&8[&4&lS&r&8]&r") + msg);
}
}
}
}

View File

@ -0,0 +1,358 @@
package com.fpghoti.fpchatx.chat;
import java.io.IOException;
import java.util.ArrayList;
import java.util.UUID;
import java.util.logging.Level;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.config.ChannelFile;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class StandardChannel extends ChatChannel{
private boolean hasRadius;
private int chatRadius;
private String permission;
private ChannelFile file;
public StandardChannel(FPChat plugin, ChannelFile file) {
super(plugin);
this.file = file;
setName(file.getName());
this.hasRadius = file.hasRadius();
this.permission = file.getWhitelistedPermissionNode();
this.banned = new ArrayList<UUID>();
if(!file.getBannedUUIDs().equals("")) {
for(String s : file.getBannedUUIDs().split(",")) {
UUID u = UUID.fromString(s);
banned.add(u);
}
}
this.whitelist = new ArrayList<UUID>();
if(!file.getWhitelistedUUIDs().equals("")) {
for(String s : file.getWhitelistedUUIDs().split(",")) {
UUID u = UUID.fromString(s);
whitelist.add(u);
}
}
this.shortcut = file.getShortcut();
this.distinguishedChatFormat = file.getDistinguishedChatFormat();
this.chatFormat = file.getChatFormat();
this.chatRadius = file.getRadius();
this.isWhitelisted = file.isWhitelisted();
}
@Override
public boolean isTemp() {
return false;
}
@Override
public void enableRadius() {
this.hasRadius = true;
new BukkitRunnable() {
@Override
public void run() {
try {
file.saveHasRadius(true);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void disableRadius() {
this.hasRadius = false;
new BukkitRunnable() {
@Override
public void run() {
try {
file.saveHasRadius(false);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public boolean hasRadius() {
return this.hasRadius;
}
@Override
public void setRadius(int radius) {
this.chatRadius = radius;
new BukkitRunnable() {
@Override
public void run() {
try {
file.saveRadius(radius);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public int getRadius() {
return this.chatRadius;
}
@Override
public boolean isWhitelisted(FPlayer p) {
if(!whitelistEnabled()) {
return true;
}
if(isDefault()){
return true;
}
if(whitelist.contains(p.getUniqueId())) {
return true;
}
if(p.hasPermission(permission)) {
return true;
}
return false;
}
public void setPermission(String perm) {
this.permission = perm;
}
public String getPermission() {
return this.permission;
}
@Override
public boolean isDefault() {
return ChatChannel.getDefault() == this;
}
@Override
public void kick(FPlayer p) {
p.leaveChannel(getName());
}
@Override
public void setShortcut(String shortcut) {
this.shortcut = shortcut;
new BukkitRunnable() {
@Override
public void run() {
try {
file.saveShortcut(shortcut);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void enableWhitelist() {
this.isWhitelisted = true;
new BukkitRunnable() {
@Override
public void run() {
try {
file.saveWhitelist(true);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void disableWhitelist() {
this.isWhitelisted = false;
new BukkitRunnable() {
@Override
public void run() {
try {
file.saveWhitelist(false);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void whitelistAdd(UUID uuid) {
this.whitelist.add(uuid);
ArrayList<UUID> rl = this.whitelist;
new BukkitRunnable() {
@Override
public void run() {
try {
String setting = "";
for(UUID u : rl) {
String su = u.toString();
setting = setting + su + ",";
}
setting = StringUtils.chop(setting);
file.saveWhitelistedUUIDs(setting);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void whitelistRemove(UUID uuid) {
this.whitelist.remove(uuid);
ArrayList<UUID> rl = this.whitelist;
new BukkitRunnable() {
@Override
public void run() {
try {
String setting = "";
for(UUID u : rl) {
String su = u.toString();
setting = setting + su + ",";
}
setting = StringUtils.chop(setting);
file.saveWhitelistedUUIDs(setting);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void setChatFormat(String chatFormat) {
this.chatFormat = chatFormat;
new BukkitRunnable() {
@Override
public void run() {
try {
file.saveChatFormat(chatFormat);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public ArrayList<FPlayer> getPlayers(){
ArrayList<FPlayer> players = new ArrayList<FPlayer>();
for(FPlayer p : FPlayer.getPlayers()) {
if(p.getChannels().contains(name)) {
players.add(p);
}
}
return players;
}
@Override
public void addBanned(FPlayer p) {
this.banned.add(p.getUniqueId());
ArrayList<UUID> rl = this.banned;
new BukkitRunnable() {
@Override
public void run() {
try {
String setting = "";
for(UUID u : rl) {
String su = u.toString();
setting = setting + su + ",";
}
setting = StringUtils.chop(setting);
file.saveBannedUUIDs(setting);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void removeBanned(FPlayer p) {
this.banned.remove(p.getUniqueId());
ArrayList<UUID> rl = this.banned;
new BukkitRunnable() {
@Override
public void run() {
try {
String setting = "";
for(UUID u : rl) {
String su = u.toString();
setting = setting + su + ",";
}
setting = StringUtils.chop(setting);
file.saveBannedUUIDs(setting);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void setDistinguishedChatFormat(String chatFormat) {
this.distinguishedChatFormat = chatFormat;
new BukkitRunnable() {
@Override
public void run() {
try {
file.saveDistinguishedChatFormat(chatFormat);
} catch (IOException e) {
e.printStackTrace();
}
}
}.runTaskAsynchronously(plugin);
}
@Override
public void sendMessage(String msg, FPlayer from) {
Player pf = Util.getEP(from.getName());
plugin.log(Level.INFO, name + ": " + msg);
for(FPlayer p : FPlayer.getPlayers()) {
if(p.getChannels().contains(name) && !p.isIgnoring(from)) {
if(hasRadius) {
Player pp = Util.getEP(p.getName());
if(pp.getWorld() == pf.getWorld()) {
if(pp.getLocation().distance(pf.getLocation()) < chatRadius){
p.sendMessage(msg);
}
}
}else {
p.sendMessage(msg);
}
}
}
}
public void update(ChannelFile file) {
this.file = file;
setName(file.getName());
this.hasRadius = file.hasRadius();
this.permission = file.getWhitelistedPermissionNode();
this.banned = new ArrayList<UUID>();
for(String s : file.getBannedUUIDs().split(",")) {
UUID u = UUID.fromString(s);
banned.add(u);
}
this.shortcut = file.getShortcut();
}
}

View File

@ -0,0 +1,157 @@
package com.fpghoti.fpchatx.chat;
import java.util.ArrayList;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.player.FPlayer;
public class TempChannel extends ChatChannel{
private UUID owner;
public TempChannel(FPChat plugin, FPlayer owner, String name) {
super(plugin);
this.name = name;
this.owner = owner.getUniqueId();
this.chatFormat = plugin.getMainConfig().getTempChannelFormat();
this.distinguishedChatFormat = plugin.getMainConfig().getTempChannelFormat();
this.banned = new ArrayList<UUID>();
}
public FPlayer getOwner() {
OfflinePlayer p = Bukkit.getOfflinePlayer(owner);
return FPlayer.getPlayer(p, !p.isOnline());
}
public boolean isOwner(FPlayer p) {
return p.getUniqueId() == this.owner;
}
public void setOwner(FPlayer p) {
this.owner = p.getUniqueId();
}
@Override
public boolean isTemp() {
return true;
}
@Override
public boolean isWhitelisted(FPlayer p) {
if(!whitelistEnabled()) {
return true;
}
if(whitelist.contains(p.getUniqueId())) {
return true;
}
return false;
}
@Override
public void enableRadius() {
return;
}
@Override
public void disableRadius() {
return;
}
@Override
public boolean hasRadius() {
return false;
}
@Override
public void setRadius(int radius) {
return;
}
@Override
public int getRadius() {
return 0;
}
@Override
public boolean isDefault() {
return false;
}
@Override
public void kick(FPlayer p) {
p.leaveTempChannel(getName());
}
@Override
public void setShortcut(String shortcut) {
this.shortcut = shortcut;
}
@Override
public void enableWhitelist() {
this.isWhitelisted = true;
}
@Override
public void disableWhitelist() {
this.isWhitelisted = false;
}
@Override
public void whitelistAdd(UUID uuid){
this.whitelist.add(uuid);
}
@Override
public void whitelistRemove(UUID uuid) {
this.whitelist.remove(uuid);
}
@Override
public void addBanned(FPlayer p) {
this.banned.add(p.getUniqueId());
}
@Override
public void removeBanned(FPlayer p) {
this.banned.remove(p.getUniqueId());
}
@Override
public void setChatFormat(String chatFormat) {
this.chatFormat = chatFormat;
}
@Override
public void setDistinguishedChatFormat(String chatFormat) {
this.distinguishedChatFormat = chatFormat;
}
@Override
public ArrayList<FPlayer> getPlayers(){
ArrayList<FPlayer> players = new ArrayList<FPlayer>();
for(FPlayer p : FPlayer.getPlayers()) {
if(p.getTempChannels().contains(name)) {
players.add(p);
}
}
return players;
}
@Override
public void sendMessage(String msg, FPlayer from) {
plugin.log(Level.INFO, "[TC] " + name + ": " + msg);
for(FPlayer p : FPlayer.getPlayers()) {
if(p.getTempChannels().contains(name) && !p.isIgnoring(from)) {
p.sendMessage(msg);
}
}
}
}

View File

@ -0,0 +1,139 @@
package com.fpghoti.fpchatx.command;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import com.fpghoti.fpchatx.FPChat;
public abstract class Commands {
private static ArrayList<Commands> commands = new ArrayList<Commands>();
public static void register(Commands cmd) {
commands.add(cmd);
}
public static ArrayList<Commands> getCommands(){
return commands;
}
private static boolean blocked = false;
public static boolean performCommand(CommandSender sender, Command command, String label, String[] args) {
if(blocked) {
return false;
}
String input = label + " ";
for (String s : args) {
input += s + " ";
}
Commands match = null;
String[] trim = null;
StringBuilder lab = new StringBuilder();
for(Commands cmd : commands) {
StringBuilder l = new StringBuilder();
String[] temp = cmd.getArgs(input, l);
if (l.length() > lab.length()) {
lab = l;
match = cmd;
trim = temp;
}
}
if(match != null) {
if (trim == null || (trim.length > 0 && trim[0].equals("?"))) {
sender.sendMessage(ChatColor.RED + "Command:" + ChatColor.YELLOW + " " + match.getName());
sender.sendMessage(ChatColor.RED + "Description:" + ChatColor.YELLOW + " " + match.getDescription());
sender.sendMessage(ChatColor.RED + "Syntax:" + ChatColor.YELLOW + " " + match.getSyntax());
ArrayList<String> notes = match.getMisc();
for (String note : notes) {
sender.sendMessage(ChatColor.YELLOW + note);
}
} else {
match.execute(sender, trim);
}
}
return true;
}
public static void blockCommands() {
blocked = true;
}
public static void allowCommands() {
blocked = false;
}
protected FPChat plugin;
protected String name;
protected String syntax;
protected String description;
protected int minArgs;
protected int maxArgs;
protected ArrayList<String> labels;
protected ArrayList<String> misc;
public Commands(FPChat plugin) {
this.plugin = plugin;
this.labels = new ArrayList<String>();
this.misc = new ArrayList<String>();
}
public String[] getArgs(String input, StringBuilder label) {
boolean found = false;
int count = 0;
for(int i = 0; i < labels.size(); i++) {
String lab = labels.get(i).toLowerCase();
if (input.toLowerCase().matches(lab + "(\\s+.*|\\s*)")) {
if (lab.length() > labels.get(count).length() || !found) {
count = i;
found = true;
}
}
}
if (found) {
label = label.append(labels.get(count));
String[] args = input.substring(label.length()).trim().split(" ");
if (args[0].isEmpty()) {
args = new String[0];
}
if (args.length >= minArgs && args.length <= maxArgs) {
return args;
}
}
return null;
}
public ArrayList<String> getLabels() {
return this.labels;
}
public void setlabels(ArrayList<String> labels) {
this.labels = labels;
}
public String getName() {
return this.name;
}
public String getSyntax() {
return this.syntax;
}
public String getDescription() {
return this.description;
}
public ArrayList<String> getMisc() {
return this.misc;
}
public abstract void execute(CommandSender sender, String[] args);
}

View File

@ -0,0 +1,41 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.badge.BadgeSet;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
public class BadgeClearCommand extends Commands {
public BadgeClearCommand(FPChat plugin) {
super(plugin);
name = "BadgeClear";
description = "Unequips all badges";
syntax = ChatColor.GRAY + "/badgeclear";
minArgs = 0;
maxArgs = 0;
labels.add("fpc badgeclear");
labels.add("fpchat badgeclear");
labels.add("ch badgeclear");
labels.add("badgeclear");
labels.add("badgesclear");
}
@Override
public void execute(CommandSender sender, String[] args) {
if(!(sender instanceof Player)) {
FPlayer.errMsg(null, "This command is for players only.");
return;
}
FPlayer p = FPlayer.getPlayer((Player)sender);
BadgeSet.setBadge(p, 1, 0);
BadgeSet.setBadge(p, 2, 0);
BadgeSet.setBadge(p, 3, 0);
p.sendMessage(FPChat.logo() + ChatColor.YELLOW + " Unequipped all badges!");
}
}

View File

@ -0,0 +1,56 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.badge.BadgeGetter;
import com.fpghoti.fpchatx.badge.BadgeList;
import com.fpghoti.fpchatx.badge.BadgeSet;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class BadgeEquipCommand extends Commands {
public BadgeEquipCommand(FPChat plugin) {
super(plugin);
name = "BadgeEquip";
description = "Equips badges for use in chat";
syntax = ChatColor.GRAY + "/equip " + ChatColor.GOLD + "slot# badge#";
minArgs = 2;
maxArgs = 2;
labels.add("fpc badgeequip");
labels.add("fpchat badgeequip");
labels.add("ch badgeequip");
labels.add("badgeequip");
labels.add("equip");
}
@Override
public void execute(CommandSender sender, String[] args) {
if(!(sender instanceof Player)) {
FPlayer.errMsg(null, "This command is for players only.");
return;
}
FPlayer p = FPlayer.getPlayer((Player)sender);
if(Util.isDigit(args[0]) && Util.isDigit(args[1])){
Integer slot = Integer.parseInt(args[0]), badgeId = Integer.parseInt(args[1]);
if(BadgeGetter.canUseSlot(p, slot)){
if(BadgeList.badgelist.containsKey(badgeId) && BadgeGetter.hasBadge(p, badgeId)){
BadgeSet.setBadge(p, slot, badgeId);
p.updateBadges(slot, badgeId);
p.sendMessage( FPChat.logo() + ChatColor.YELLOW + " You have equipped a badge!");
}else{
p.sendMessage(FPChat.logo() + ChatColor.YELLOW + " You do not have permission to equip this badge!");
}
}else{
p.sendMessage(FPChat.logo() + ChatColor.YELLOW + " You do not have permission to equip a badge in this slot!");
}
}
}
}

View File

@ -0,0 +1,43 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.badge.BadgeList;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class BadgeListCommand extends Commands {
public BadgeListCommand(FPChat plugin) {
super(plugin);
name = "BadgeList";
description = "Pulls up a list of badges you own";
syntax = ChatColor.GRAY + "/badgelist " + ChatColor.GOLD + "[page#]";
minArgs = 0;
maxArgs = 1;
labels.add("fpc badgelist");
labels.add("fpchat badgelist");
labels.add("ch badgelist");
labels.add("badges");
labels.add("badgelist");
}
@Override
public void execute(CommandSender sender, String[] args) {
if(!(sender instanceof Player)) {
FPlayer.errMsg(null, "This command is for players only.");
return;
}
FPlayer p = FPlayer.getPlayer((Player)sender);
if(args.length == 0 || !Util.isDigit(args[0])){
BadgeList.badgeList(p, 1);
}else{
BadgeList.badgeList(p, Integer.parseInt(args[0]));
}
}
}

View File

@ -0,0 +1,115 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.chat.StandardChannel;
import com.fpghoti.fpchatx.chat.TempChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class BlacklistCommand extends Commands {
public BlacklistCommand(FPChat plugin) {
super(plugin);
name = "Blacklist";
description = "Toggles blacklisted status of a player in a specific channel";
syntax = ChatColor.GRAY + "/fpc blacklist " + ChatColor.GOLD + "channel player";
minArgs = 1;
maxArgs = 2;
labels.add("fpc blacklist");
labels.add("fpchat blacklist");
labels.add("ch blacklist");
labels.add("fpc ban");
labels.add("fpchat ban");
labels.add("ch ban");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
if(sender instanceof Player) {
p = FPlayer.getPlayer((Player)sender);
}
ChatChannel c = ChatChannel.getChannel(args[0]);
if(c == null) {
c = ChatChannel.getTempChannel(args[0]);
}
if(c == ChatChannel.getDefault()) {
FPlayer.errMsg(p, "You cannot blacklist a player from the default/fallback channel. If you wish to prevent someone from speaking in default, try muting instead.");
return;
}
if (c != null) {
if (args.length == 1) {
String msg = "There are no blacklisted players in this channel.";
if (!c.getBanned().isEmpty()) {
msg = c.getName() + " Blacklist: ";
for (UUID uuid : c.getBanned()) {
FPlayer bp = FPlayer.getPlayer(Bukkit.getOfflinePlayer(uuid));
String name = ChatColor.RED + bp.getName();
if(bp.isOnline()) {
name = ChatColor.GREEN + bp.getName();
}
msg = msg + name + ChatColor.WHITE + ", ";
}
msg = msg.substring(0, msg.length() - 2);
}
FPlayer.dualMsg(p, msg);
} else {
if( p == null || (Permission.isAdmin(p) || Permission.canBan(p) || (c instanceof TempChannel && ((TempChannel)c).getOwner().equals(p)))) {
FPlayer banned = FPlayer.getPlayer(args[1]);
if(banned == null) {
banned = FPlayer.getOfflinePlayer(args[1]);
}
if(banned != null) {
String name = banned.getName();
if(p == null || !(Permission.isAdmin(banned) || Permission.canBan(banned))) {
if(c.getBanned().contains(banned.getUniqueId())) {
c.removeBanned(banned);
FPlayer.goodMsg(p, ChatColor.YELLOW + name + ChatColor.GREEN + " has been removed from the blacklist of channel " + ChatColor.YELLOW + c.getName() + ChatColor.GREEN + ".");
}else{
if(banned.getChannels().contains(c.getName()) || banned.getTempChannels().contains(c.getName())) {
FPlayer.errMsg(banned, "You have been blacklisted from " + ChatColor.YELLOW + c.getName() + ChatColor.RED + ".");
}
c.addBanned(banned);
c.kick(banned);
FPlayer.goodMsg(p, ChatColor.YELLOW + name + ChatColor.GREEN + " has been blacklisted from " + ChatColor.YELLOW + c.getName() + ChatColor.GREEN + ".");
banned.leaveChannel(c.getName());
if(c instanceof StandardChannel) {
banned.setPrimaryChannel(ChatChannel.getDefault().getName());
}
if(c instanceof TempChannel) {
banned.stopTempSpeak();
banned.setPrimaryTempChannel("");
}
}
} else {
FPlayer.errMsg(p, "Player cannot be removed from the channel.");
}
} else {
FPlayer.errMsg(p, "Cannot find specified player.");
}
} else {
FPlayer.errMsg(p, Permission.noPerm);
}
}
} else {
FPlayer.errMsg(p, "That channel does not exist.");
}
}
}

View File

@ -0,0 +1,75 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.ArrayList;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.chat.StandardChannel;
import com.fpghoti.fpchatx.chat.TempChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
import net.md_5.bungee.api.ChatColor;
public class ChannelsCommand extends Commands {
public ChannelsCommand(FPChat plugin) {
super(plugin);
name = "Channels";
description = "Lists all open channels";
syntax = ChatColor.GRAY + "/fpc channels " + ChatColor.GOLD + "[page#]";
minArgs = 0;
maxArgs = 1;
labels.add("fpc channels");
labels.add("fpchat channels");
labels.add("ch channels");
labels.add("fpc list");
labels.add("fpchat list");
labels.add("ch list");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
if(sender instanceof Player) {
p = FPlayer.getPlayer((Player)sender);
}
int pg = 1;
if (args.length > 0) {
if(Util.isDigit(args[0])) {
pg = Integer.parseInt(args[0]);
}else {
FPlayer.errMsg(p, syntax);
}
}
ArrayList<String> channels = new ArrayList<String>();
for(ChatChannel c : ChatChannel.getChannels()) {
if(p == null || p.canJoin(c)) {
if(c instanceof StandardChannel) {
String s = ChatColor.DARK_GREEN + "Channel: " + ChatColor.GREEN + c.getName();
channels.add(s);
}else if(c instanceof TempChannel) {
String s = ChatColor.DARK_AQUA + "TempChannel: " + ChatColor.AQUA + c.getName();
channels.add(s);
}
}
}
int pageCount = (int) Math.ceil((double) channels.size() / 8);
if (pg > pageCount) {
pg = pageCount;
}
FPlayer.plainMsg(p, ChatColor.GOLD + "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] " + ChatColor.YELLOW + "Open Channels:");
for (int i = 0; i < 8; i++) {
int index = (pg - 1) * 8 + i;
if (index < channels.size()) {
String msg = channels.get(index);
FPlayer.plainMsg(p, msg);
}
}
}
}

View File

@ -0,0 +1,182 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.chat.ChatFilter;
import com.fpghoti.fpchatx.chat.StandardChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class CreateCommand extends Commands {
public CreateCommand(FPChat plugin) {
super(plugin);
name = "Create";
description = "Makes a new channel";
syntax = ChatColor.GRAY + "/fpc create " + ChatColor.GOLD + "<temp> name <flags>";
minArgs = 1;
maxArgs = 2 + validflags.length;
labels.add("fpc create");
labels.add("fpchat create");
labels.add("ch create");
misc.add("Possible Flags:");
misc.add("-w : Create with whitelist enabled");
misc.add("-a : Broadcast alert to all players when channel is made");
misc.add("-p : Set your primary channel to the new channel upon creation");
}
private static String[] validflags = {"-w", "-a", "-p"};
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
if (sender instanceof Player) {
p = FPlayer.getPlayer((Player)sender);
}
boolean canTemp = false;
boolean canStandard = false;
boolean canAlert = false;
boolean isTemp = false;
boolean whitelist = false;
boolean alert = false;
boolean primary = false;
String name;
ArrayList<String> flags = new ArrayList<String>();
ChatChannel channel;
if(p == null) {
canStandard = true;
canAlert = true;
}else {
canTemp = Permission.canMakeTempChannel(p);
canStandard = Permission.canMakeChannel(p);
canAlert = Permission.canAlertMakeChannel(p);
}
if(args[0].equalsIgnoreCase("temp")) {
isTemp = true;
}
if(isTemp && args.length == 1) {
FPlayer.errMsg(p, syntax);
return;
}
if(isTemp && !canTemp) {
if(p == null) {
FPlayer.errMsg(p,"Temporary channels are designed for player use only.");
}else {
FPlayer.errMsg(p, "You do not have permission to create temporary channels.");
}
return;
}
if(!isTemp && !canStandard) {
FPlayer.errMsg(p, "You do not have permission to create permanent channels.");
return;
}
if(isTemp) {
name = args[1];
if(args.length > 2) {
for(int i = 2; i < args.length; i++) {
flags.add(args[i]);
}
}
}else {
name = args[0];
if(args.length > 1) {
for(int i = 1; i < args.length; i++) {
flags.add(args[i]);
}
}
}
if(FPChat.getPlugin().getMainConfig().chatFilterEnabled()) {
if(!ChatFilter.filterWord(name).equals(name)) {
FPlayer.errMsg(p, "This channel name is not allowed on this server.");
return;
}
}
for(String s : flags) {
if(!Util.contains(validflags, s.toLowerCase())) {
FPlayer.errMsg(p, "You tried use an invalid flag.");
return;
}
if(p == null && s.equalsIgnoreCase("-p")) {
FPlayer.errMsg(p, "Console cannot set a primary chat channel.");
return;
}
if(s.equalsIgnoreCase("-w")) {
whitelist = true;
}
if(s.equalsIgnoreCase("-a")) {
alert = true;
}
if(s.equalsIgnoreCase("-p")) {
primary = true;
}
}
if(ChatChannel.isReserved(name)) {
FPlayer.errMsg(p, "This name is unavailable. Please try something else.");
return;
}
if(isTemp) {
channel = ChatChannel.makeTempChannel(p, name);
p.joinChannel(name);
if(primary) {
p.speakingInTemp();
p.setPrimaryTempChannel(name);
}
}else {
channel = ChatChannel.makeChannel(name);
StandardChannel loaded = ChatChannel.loadChannel(name);
if(loaded != null) {
ChatChannel.addChannel(loaded);
}
if(p != null) {
p.joinChannel(name);
if(primary) {
p.stopTempSpeak();
p.setPrimaryChannel(name);
}
}
}
if(whitelist) {
channel.enableWhitelist();
}
if(alert) {
if(canAlert) {
String creator = "CONSOLE";
if(p != null) {
creator = p.getName();
}
for(FPlayer player : FPlayer.getPlayers()) {
FPlayer.plainMsg(player, ChatColor.YELLOW + creator + ChatColor.AQUA + " has created a new channel: " + ChatColor.WHITE + name);
}
}else {
FPlayer.errMsg(p, "You do not have permission to send an alert.");
return;
}
}
FPlayer.goodMsg(p, "Channel created!");
}
}

View File

@ -0,0 +1,76 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.chat.TempChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class DeleteCommand extends Commands {
public DeleteCommand(FPChat plugin) {
super(plugin);
name = "Delete";
description = "Deletes a channel";
syntax = ChatColor.GRAY + "/fpc delete " + ChatColor.GOLD + "channel";
minArgs = 1;
maxArgs = 1;
labels.add("fpc delete");
labels.add("fpchat delete");
labels.add("ch delete");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
if(sender instanceof Player) {
p = FPlayer.getPlayer((Player)sender);
}
ChatChannel c = ChatChannel.getChannel(args[0]);
if(c == null) {
c = ChatChannel.getTempChannel(args[0]);
}
boolean allowed = false;
if(p == null) {
allowed = true;
}else {
if(c instanceof TempChannel) {
TempChannel temp = (TempChannel)c;
if(temp.getOwner().equals(p)) {
allowed = true;
}
}
if(Permission.canDeleteChannel(p)) {
allowed = true;
}
}
if(!allowed) {
FPlayer.errMsg(p, Permission.noPerm);
}
if(c == ChatChannel.getDefault()) {
FPlayer.errMsg(p, "You cannot delete the default/fallback channel. If you wish to delete this channel, try setting a different default channel first.");
return;
}
if (c != null) {
c.delete();
FPlayer.goodMsg(p,"Channel deleted.");
} else {
FPlayer.errMsg(p, "That channel does not exist.");
}
}
}

View File

@ -0,0 +1,60 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.badge.BadgeList;
import com.fpghoti.fpchatx.badge.SyncSet;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class GiveBadgeCommand extends Commands {
public GiveBadgeCommand(FPChat plugin) {
super(plugin);
name = "GiveBadge";
description = "Give player a badge";
syntax = ChatColor.GRAY + "/givebadge " + ChatColor.GOLD + "player badge#";
minArgs = 2;
maxArgs = 2;
labels.add("fpc givebadge");
labels.add("fpchat givebadge");
labels.add("ch givebadge");
labels.add("givebadge");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
Boolean console = true;
if(sender instanceof Player){
console = false;
p = FPlayer.getPlayer((Player) sender);
}
if(console || Permission.isAdmin(p)){
FPlayer toGive = FPlayer.getPlayer(args[0]);
if(toGive == null) {
toGive = FPlayer.getPlayer(args[0]);
}
if(toGive == null) {
FPlayer.errMsg(p,"That player cannot be found.");
return;
}
if(Util.isDigit(args[1]) && BadgeList.badgeperm.containsKey(Integer.parseInt(args[1]))) {
int id = Integer.parseInt(args[1]);
toGive.queueBadgeAdd(id);
SyncSet.update(toGive);
toGive.addSyncedBadge(id);
FPlayer.goodMsg(p, "Badge granted.");
}else {
FPlayer.errMsg(p,"Wrong command usage.");
}
}
}
}

View File

@ -0,0 +1,95 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class HelpCommand extends Commands {
public HelpCommand(FPChat plugin) {
super(plugin);
name = "Help";
description = "Displays the help menu";
syntax = ChatColor.GRAY + "/fpc help " + ChatColor.GOLD + "page#";
minArgs = 0;
maxArgs = 1;
labels.add("fpc help");
labels.add("fpchat help");
labels.add("ch help");
labels.add("fpc");
labels.add("fpchat");
labels.add("ch");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
if(sender instanceof Player) {
p = FPlayer.getPlayer((Player)sender);
}
int pg = 1;
if (args.length > 0) {
if(Util.isDigit(args[0])) {
pg = Integer.parseInt(args[0]);
}else {
FPlayer.errMsg(p, syntax);
}
}
ArrayList<Commands> commands = Commands.getCommands();
int pageCount = (int) Math.ceil((double) commands.size() / 8);
if (pg > pageCount) {
pg = pageCount;
}
FPlayer.plainMsg(p, "");
String name = "";
String ctype = "Normal";
if(Permission.isAdmin(p)) {
name = name + ChatColor.AQUA + "[ADMIN] ";
}else if(Permission.isStaff(p)) {
name = name + ChatColor.BLUE + "[STAFF] ";
}
name = ChatColor.DARK_AQUA + "Player: " + name + ChatColor.GREEN + p.getName();
String cname = p.getPrimaryChannel().getName();
String ccount = Integer.toString(p.getPrimaryChannel().playerCount());
if(p.speakingInTemp() && p.getPrimaryTempChannel() != null) {
ccount = Integer.toString(p.getPrimaryTempChannel().playerCount());
cname = p.getPrimaryTempChannel().getName();
ctype = "Temporary";
}
String primary = ChatColor.DARK_AQUA + "Current Channel: " + ChatColor.GREEN + cname;
ctype = ChatColor.DARK_AQUA + "Channel Type: " + ChatColor.GREEN + ctype;
String online = ChatColor.DARK_AQUA + "Members Online: " + ChatColor.GREEN + ccount;
if(args.length == 0) {
FPlayer.plainMsg(p, ChatColor.GOLD + "[INFO] " + ChatColor.YELLOW + "FPChatX:");
FPlayer.plainMsg(p,name);
FPlayer.plainMsg(p,primary);
FPlayer.plainMsg(p,ctype);
FPlayer.plainMsg(p,online);
FPlayer.plainMsg(p,ChatColor.GRAY + "Use " + ChatColor.WHITE + "/fpc who " + ChatColor.GRAY + "to see who is in this channel.");
FPlayer.plainMsg(p, ChatColor.GRAY + "Use " + ChatColor.WHITE + "/fpc help page# " + ChatColor.GRAY + "for a list of commands.");
return;
}
FPlayer.plainMsg(p, ChatColor.GOLD + "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] " + ChatColor.YELLOW + "FPChatX Commands:");
for (int i = 0; i < 8; i++) {
int index = (pg - 1) * 8 + i;
if (index < commands.size()) {
String msg = ChatColor.GREEN + "- " + commands.get(index).getSyntax();
FPlayer.plainMsg(p, msg);
}
}
}
}

View File

@ -0,0 +1,51 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class HushCommand extends Commands {
public HushCommand(FPChat plugin) {
super(plugin);
name = "Hush";
description = "Prevents a player from shouting";
syntax = ChatColor.GRAY + "/hush " + ChatColor.GOLD + "player";
minArgs = 1;
maxArgs = 1;
labels.add("fpc hush");
labels.add("fpchat hush");
labels.add("ch hush");
labels.add("hush");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
Boolean console = true;
if(sender instanceof Player){
console = false;
p = FPlayer.getPlayer((Player) sender);
}
if(console || Permission.canHush(p)){
FPlayer hush = FPlayer.getPlayer(args[0]);
if(hush == null) {
hush = FPlayer.getPlayer(args[0]);
}
if(hush == null) {
FPlayer.errMsg(p,"That player cannot be found.");
}else{
hush.hush();
FPlayer.dualMsg(hush, "You have been hushed. Your shouts will no longer send.");
FPlayer.goodMsg(p, "Player can no longer use shout.");
}
}
}
}

View File

@ -0,0 +1,64 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class IgnoreCommand extends Commands {
public IgnoreCommand(FPChat plugin) {
super(plugin);
name = "Ignore";
description = "Ignores all messages from a player";
syntax = ChatColor.GRAY + "/ignore " + ChatColor.GOLD + "player";
minArgs = 1;
maxArgs = 1;
labels.add("fpc ignore");
labels.add("fpchat ignore");
labels.add("ch ignore");
labels.add("ignore");
}
@Override
public void execute(CommandSender sender, String[] args) {
if(sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
if(Permission.canIgnore(p)) {
UUID u = plugin.getPlayerCache().getUUID(args[0]);
if(u == null) {
FPlayer.errMsg(p, "Invalid player.");
return;
}
OfflinePlayer o = Bukkit.getOfflinePlayer(u);
if(o != null) {
FPlayer ignored = FPlayer.getPlayer(o, true);
if(p.getIgnored().contains(u)) {
FPlayer.errMsg(p, "This player is already ignored.");
return;
}
boolean result = p.ignore(ignored);
if(result) {
FPlayer.goodMsg(p, "Player ignored.");
}else {
FPlayer.errMsg(p, "This player cannot be ignored.");
}
} else {
FPlayer.errMsg(p, "Invalid player.");
}
}
} else {
FPlayer.errMsg(null, "You must be a player to use ignore.");
}
}
}

View File

@ -0,0 +1,74 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.ArrayList;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class IgnoreListCommand extends Commands {
public IgnoreListCommand(FPChat plugin) {
super(plugin);
name = "Ignore List";
description = "Lists all players you have ignored";
syntax = ChatColor.GRAY + "/ignorelist " + ChatColor.GOLD + "[page#]";
minArgs = 0;
maxArgs = 1;
labels.add("fpc ignorelist");
labels.add("fpchat ignorelist");
labels.add("ch ignorelist");
labels.add("ignorelist");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
int pg = 1;
if (args.length > 0) {
if(Util.isDigit(args[0])) {
pg = Integer.parseInt(args[0]);
}else {
FPlayer.errMsg(p, syntax);
}
}
ArrayList<UUID> players = p.getIgnored();
if(players.size() == 0) {
FPlayer.dualMsg(p, "Your ignore list is currently empty.");
return;
}
int pageCount = (int) Math.ceil((double) players.size() / 8);
if (pg > pageCount) {
pg = pageCount;
}
FPlayer.plainMsg(p, "");
FPlayer.plainMsg(p, ChatColor.GOLD + "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] " + ChatColor.YELLOW + "Ignored Players:");
for (int i = 0; i < 8; i++) {
int index = (pg - 1) * 8 + i;
if (index < players.size()) {
OfflinePlayer o = Bukkit.getOfflinePlayer(players.get(index));
String msg = ChatColor.GREEN + "- " + ChatColor.YELLOW + o.getName();
FPlayer.plainMsg(p, msg);
}
}
}else{
FPlayer.errMsg(null, "This command is for players only.");
}
}
}

View File

@ -0,0 +1,42 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
public class JoinCommand extends Commands {
public JoinCommand(FPChat plugin) {
super(plugin);
name = "Join";
description = "Enters a channel";
syntax = ChatColor.GRAY + "/fpc join " + ChatColor.GOLD + "channel";
minArgs = 1;
maxArgs = 1;
labels.add("fpc join");
labels.add("fpchat join");
labels.add("ch join");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
ChatChannel channel = ChatChannel.getChannel(args[0]);
if(channel == null) {
channel = ChatChannel.getTempChannel(args[0]);
}
if(channel == null) {
FPlayer.errMsg(p, "The channel you are trying to join does not exist.");
return;
}
p.joinChannel(channel.getName());
}
}
}

View File

@ -0,0 +1,84 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.chat.StandardChannel;
import com.fpghoti.fpchatx.chat.TempChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class KickCommand extends Commands {
public KickCommand(FPChat plugin) {
super(plugin);
name = "Kick";
description = "Kicks a player from a channel";
syntax = ChatColor.GRAY + "/fpc kick " + ChatColor.GOLD + "channel player";
minArgs = 2;
maxArgs = 2;
labels.add("fpc kick");
labels.add("fpchat kick");
labels.add("ch kick");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
if(sender instanceof Player) {
p = FPlayer.getPlayer((Player)sender);
}
ChatChannel c = ChatChannel.getChannel(args[0]);
if(c == null) {
c = ChatChannel.getTempChannel(args[0]);
}
if(c == ChatChannel.getDefault()) {
FPlayer.errMsg(p, "You cannot kick a player from the default/fallback channel. If you wish to prevent someone from speaking in default, try muting instead.");
return;
}
if (c != null) {
if( p == null || (Permission.isAdmin(p) || Permission.canBan(p))) {
FPlayer kicked = FPlayer.getPlayer(args[1]);
if(kicked == null) {
kicked = FPlayer.getOfflinePlayer(args[1]);
}
if(kicked != null) {
String name = kicked.getName();
if(p == null || !(Permission.isAdmin(kicked) || Permission.canBan(kicked))) {
if(kicked.getChannels().contains(c.getName())) {
c.kick(kicked);
FPlayer.goodMsg(p, ChatColor.YELLOW + name + ChatColor.GREEN + " has been kicked from " + c.getName());
FPlayer.errMsg(kicked, "You have been kicked from " + ChatColor.YELLOW + c.getName());
kicked.leaveChannel(c.getName());
if(c instanceof StandardChannel) {
kicked.setPrimaryChannel(ChatChannel.getDefault().getName());
}
if(c instanceof TempChannel) {
kicked.stopTempSpeak();
kicked.setPrimaryTempChannel("");
}
}
} else {
FPlayer.errMsg(p, "Player cannot be kicked from the channel.");
}
} else {
FPlayer.errMsg(p, "Cannot find specified player.");
}
} else {
FPlayer.errMsg(p, Permission.noPerm);
}
} else {
FPlayer.errMsg(p, "That channel does not exist.");
}
}
}

View File

@ -0,0 +1,41 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
public class LeaveCommand extends Commands {
public LeaveCommand(FPChat plugin) {
super(plugin);
name = "Leave";
description = "Leaves a channel";
syntax = ChatColor.GRAY + "/fpc leave " + ChatColor.GOLD + "channel";
minArgs = 1;
maxArgs = 1;
labels.add("fpc leave");
labels.add("fpchat leave");
labels.add("ch leave");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
ChatChannel channel = ChatChannel.getChannel(args[0]);
if(channel == null) {
FPlayer.errMsg(p, "The channel you are trying to leave does not exist.");
return;
}
p.leaveChannel(channel.getName());
p.leaveTempChannel(channel.getName());
FPlayer.goodMsg(p, "You left the channel.");
}
}
}

View File

@ -0,0 +1,72 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class MessageCommand extends Commands {
public MessageCommand(FPChat plugin) {
super(plugin);
name = "Message";
description = "Sends a private message to another player";
syntax = ChatColor.GRAY + "/msg " + ChatColor.GOLD + "player message";
minArgs = 2;
maxArgs = 100000;
labels.add("msg");
labels.add("fpc msg");
labels.add("fpchat msg");
labels.add("ch msg");
labels.add("tell");
labels.add("ch tell");
}
@Override
public void execute(CommandSender sender, String[] args) {
if(sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
if(Permission.canPrivateMessage(p)) {
Player tp = Util.getEP(args[0]);
if(tp != null) {
FPlayer target = FPlayer.getPlayer(tp);
String msg ="";
String last = args[args.length - 1];
for(int i = 1; i < args.length - 1; i++) {
msg = msg + args[i] + " ";
}
msg = msg + last;
p.sendPM(target, msg);
}else {
FPlayer.errMsg(p, "Target player is not online.");
}
}else {
FPlayer.errMsg(p, Permission.noPerm);
}
}else {
String msg = ChatColor.GREEN + "PM from CONSOLE: " + ChatColor.GRAY;
String last = args[args.length - 1];
for(int i = 1; i < args.length - 1; i++) {
msg = msg + args[i] + " ";
}
msg = msg + last;
Player target = Util.getEP(args[0]);
if(target == null) {
FPlayer.errMsg(null,"Invalid player.");
}else {
target.sendMessage(msg);
plugin.log(Level.INFO, ChatColor.GREEN + "PM to " + target.getName() + ": " + ChatColor.GRAY + msg);
}
}
}
}

View File

@ -0,0 +1,46 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class ReloadCommand extends Commands {
public ReloadCommand(FPChat plugin) {
super(plugin);
name = "Reload";
description = "Reloads the plugin's configuration and data files.";
syntax = "§7/fpc reload";
minArgs = 0;
maxArgs = 0;
labels.add("fpc reload");
labels.add("fpchat reload");
labels.add("ch reload");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
boolean allowed = true;
if(sender instanceof Player) {
p = FPlayer.getPlayer((Player)sender);
allowed = Permission.isAdmin(p);
}
if(allowed) {
FPlayer.dualMsg(p,"Reloading config files...");
plugin.reload();
FPlayer.goodMsg(p,"Config files reloaded.");
}else {
FPlayer.errMsg(p, Permission.noPerm);
}
}
}

View File

@ -0,0 +1,51 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class ReplyCommand extends Commands {
public ReplyCommand(FPChat plugin) {
super(plugin);
name = "Reply";
description = "Reply to a PM from another player";
syntax = ChatColor.GRAY + "/r " + ChatColor.GOLD + "message";
minArgs = 1;
maxArgs = 10000;
labels.add("reply");
labels.add("fpc reply");
labels.add("fpchat reply");
labels.add("ch reply");
labels.add("r");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
if(Permission.canPrivateMessage(p)) {
FPlayer target = p.getLastMessage();
if(target != null) {
String msg ="";
String last = args[args.length - 1];
for(int i = 0; i < args.length - 1; i++) {
msg = msg + args[i] + " ";
}
msg = msg + last;
p.sendPM(target, msg);
}else {
FPlayer.errMsg(p, "Target player is not online.");
}
}else {
FPlayer.errMsg(p, Permission.noPerm);
}
}
}
}

View File

@ -0,0 +1,78 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.badge.BadgeList;
import com.fpghoti.fpchatx.badge.SyncGetter;
import com.fpghoti.fpchatx.badge.SyncSet;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class RevokeBadgeCommand extends Commands {
public RevokeBadgeCommand(FPChat plugin) {
super(plugin);
name = "RevokeBadge";
description = "Revokes badge from player";
syntax = ChatColor.GRAY + "/revokebadge " + ChatColor.GOLD + "player badge#";
minArgs = 2;
maxArgs = 2;
labels.add("fpc revokebadge");
labels.add("fpchat revokebadge");
labels.add("ch revokebadge");
labels.add("revokebadge");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
Boolean console = true;
if(sender instanceof Player){
console = false;
p = FPlayer.getPlayer((Player) sender);
}
if(console || Permission.isAdmin(p)){
UUID u = plugin.getPlayerCache().getUUID(args[0]);
if(u == null) {
FPlayer.errMsg(null, "Invalid player.");
return;
}
OfflinePlayer o = Bukkit.getOfflinePlayer(u);
if(o != null) {
FPlayer toRevoke = FPlayer.getPlayer(o,true);
if(SyncGetter.syncExists(toRevoke) && (Util.isDigit(args[1]) || args[1].equals("*") )){
if(args[1].equals("*")) {
SyncSet.revoke(toRevoke);
FPlayer.goodMsg(p, "All badges revoked from the specified player.");
}else {
if(Integer.parseInt(args[1]) < BadgeList.badgeperm.size()) {
int id = Integer.parseInt(args[1]);
SyncSet.revoke(toRevoke, id);
toRevoke.removeSyncedBadge(id);
toRevoke.clearUnownedBadges();
FPlayer.goodMsg(p, "Badge revoked from the specified player.");
}else {
FPlayer.errMsg(p, "Invalid badge.");
}
}
}
}else {
FPlayer.errMsg(p, "Invalid player.");
}
}
}
}

View File

@ -0,0 +1,48 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
public class ShoutCommand extends Commands {
public ShoutCommand(FPChat plugin) {
super(plugin);
name = "Shout";
description = "Sends a chat message to every online player";
syntax = ChatColor.GRAY + "/shout " + ChatColor.GOLD + "msg";
minArgs = 0;
maxArgs = 100000;
labels.add("fpc shout");
labels.add("fpchat shout");
labels.add("ch shout");
labels.add("fshout");
labels.add("fyell");
labels.add("shout");
labels.add("yell");
labels.add("y");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
String msg = "";
String last = args[args.length - 1];
for(int i = 0; i < args.length - 1; i++) {
msg = msg + args[i] + " ";
}
msg = msg + last;
p.shout(msg);
}else{
FPlayer.errMsg(null, "This command is for players only.");
}
}
}

View File

@ -0,0 +1,50 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class ShoutToggleCommand extends Commands {
public ShoutToggleCommand(FPChat plugin) {
super(plugin);
name = "ShoutToggle";
description = "Temporarily enables or disables shout";
syntax = ChatColor.GRAY + "/fpc shouttoggle " + ChatColor.GOLD + "channel";
minArgs = 0;
maxArgs = 0;
labels.add("fpc shouttoggle");
labels.add("fpchat shouttoggle");
labels.add("ch shouttoggle");
labels.add("shouttoggle");
labels.add("frankoffshout");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player) sender);
if(Permission.canToggleShout(p)){
if(args.length == 0){
if(!p.isShoutVisible()){
p.showShout();
FPlayer.goodMsg(p,"Now showing shout!");
}else if(p.isShoutVisible()){
p.hideShout();
FPlayer.goodMsg(p,"Now hiding shout!");
}
}
}else{
FPlayer.errMsg(p, "You do not have permission to use this command!");
}
}else{
FPlayer.errMsg(null, "This command is for players only.");
}
}
}

View File

@ -0,0 +1,51 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class SpyCommand extends Commands{
FPChat plugin;
public SpyCommand(FPChat plugin) {
super(plugin);
name = "Spy";
description = "Toggles Spy mode";
syntax = ChatColor.GRAY + "/spy " + ChatColor.GOLD + "on/off";
minArgs = 1;
maxArgs = 1;
labels.add("spy");
labels.add("fpc spy");
labels.add("fpchat spy");
labels.add("ch spy");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player) sender);
if(Permission.canSpy(p)){
if(args.length == 1){
if(args[0].equalsIgnoreCase("true") || args[0].equalsIgnoreCase("on")){
p.enableSpy();
FPlayer.goodMsg(p,"PM Spy Enabled!");
}else if(args[0].equalsIgnoreCase("false") || args[0].equalsIgnoreCase("off")){
p.disableSpy();
FPlayer.goodMsg(p,"PM Spy Disabled!");
}
}
}else{
FPlayer.errMsg(p, "You do not have permission to use this command!");
}
}else{
FPlayer.errMsg(null, "This command is for players only.");
}
}
}

View File

@ -0,0 +1,82 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.HashSet;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.chat.StandardChannel;
import com.fpghoti.fpchatx.chat.TempChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class TalkCommand extends Commands {
public TalkCommand(FPChat plugin) {
super(plugin);
name = "Talk";
description = "Talk in a specific channel";
syntax = ChatColor.GRAY + "/talk " + ChatColor.GOLD + "channel [msg]";
minArgs = 1;
maxArgs = 100000;
labels.add("fpc talk");
labels.add("fpchat talk");
labels.add("ch talk");
labels.add("fpc tk");
labels.add("fpchat tk");
labels.add("ch tk");
labels.add("talk");
labels.add("tk");
misc.add("Helpful alias: /tk");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
ChatChannel channel = ChatChannel.getChannel(args[0]);
if(channel == null) {
channel = ChatChannel.getTempChannel(args[0]);
}
if(channel == null) {
FPlayer.errMsg(p, "The channel you are trying to talk in does not exist.");
return;
}
if(!p.getChannels().contains(channel.getName()) && !p.getTempChannels().contains(channel.getName())) {
FPlayer.errMsg(p, "You are not currently in that channel.");
return;
}
if(args.length == 1) {
if(channel instanceof StandardChannel) {
p.setPrimaryChannel(channel.getName());
p.stopTempSpeak();
}else if(channel instanceof TempChannel) {
p.setPrimaryTempChannel(channel.getName());
p.speakInTemp();
}
FPlayer.dualMsg(p,ChatColor.YELLOW + "Now speaking in " + ChatColor.GREEN + channel.getName() + ChatColor.YELLOW + ".");
}else {
String msg = "";
String last = args[args.length - 1];
for(int i = 1; i < args.length - 1; i++) {
msg = msg + args[i] + " ";
}
msg = msg + last;
p.setTalk(true);
p.setTalkChannel(channel);
Player pl = Util.getEP(p.getName());
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(false, pl, msg, new HashSet<Player>(Bukkit.getOnlinePlayers()));
Bukkit.getPluginManager().callEvent(event);
}
}else{
FPlayer.errMsg(null, "This command is for players only.");
}
}
}

View File

@ -0,0 +1,51 @@
package com.fpghoti.fpchatx.command.commands;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class UnHushCommand extends Commands {
public UnHushCommand(FPChat plugin) {
super(plugin);
name = "UnHush";
description = "Unhushes a player";
syntax = ChatColor.GRAY + "/unhush " + ChatColor.GOLD + "player";
minArgs = 1;
maxArgs = 1;
labels.add("fpc unhush");
labels.add("fpchat unhush");
labels.add("ch unhush");
labels.add("unhush");
}
@Override
public void execute(CommandSender sender, String[] args) {
FPlayer p = null;
Boolean console = true;
if(sender instanceof Player){
console = false;
p = FPlayer.getPlayer((Player) sender);
}
if(console || Permission.canHush(p)){
FPlayer hush = FPlayer.getPlayer(args[0]);
if(hush == null) {
hush = FPlayer.getPlayer(args[0]);
}
if(hush == null) {
FPlayer.errMsg(p,"That player cannot be found.");
}else{
hush.unhush();
FPlayer.dualMsg(hush, "You have been unhushed. Your shouts will now send.");
FPlayer.goodMsg(p, "Player can now use shout.");
}
}
}
}

View File

@ -0,0 +1,52 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.player.FPlayer;
public class UnignoreCommand extends Commands {
public UnignoreCommand(FPChat plugin) {
super(plugin);
name = "Unignore";
description = "Unignores all messages from a player";
syntax = ChatColor.GRAY + "/unignore " + ChatColor.GOLD + "player";
minArgs = 1;
maxArgs = 1;
labels.add("fpc unignore");
labels.add("fpchat unignore");
labels.add("ch unignore");
labels.add("unignore");
}
@Override
public void execute(CommandSender sender, String[] args) {
if(sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
UUID u = plugin.getPlayerCache().getUUID(args[0]);
if(u == null) {
FPlayer.errMsg(p, "Invalid player.");
return;
}
OfflinePlayer o = Bukkit.getOfflinePlayer(u);
if(o != null) {
FPlayer unignored = FPlayer.getPlayer(o, true);
p.unignore(unignored);
FPlayer.goodMsg(p, "Player unignored.");
} else {
FPlayer.errMsg(p, "Invalid player.");
}
} else {
FPlayer.errMsg(null, "You must be a player to use unignore.");
}
}
}

View File

@ -0,0 +1,80 @@
package com.fpghoti.fpchatx.command.commands;
import java.util.ArrayList;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.command.Commands;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.player.FPlayer;
import com.fpghoti.fpchatx.util.Util;
public class WhoCommand extends Commands {
public WhoCommand(FPChat plugin) {
super(plugin);
name = "Who";
description = "Lists all players in your primary channel";
syntax = ChatColor.GRAY + "/fpc who " + ChatColor.GOLD + "[page#]";
minArgs = 0;
maxArgs = 1;
labels.add("fpc who");
labels.add("fpchat who");
labels.add("ch who");
}
@Override
public void execute(CommandSender sender, String[] args) {
if (sender instanceof Player) {
FPlayer p = FPlayer.getPlayer((Player)sender);
ChatChannel c = p.getPrimaryChannel();
if(p.speakingInTemp()) {
c = p.getPrimaryTempChannel();
}
if (c != null) {
int pg = 1;
if (args.length > 0) {
if(Util.isDigit(args[0])) {
pg = Integer.parseInt(args[0]);
}else {
FPlayer.errMsg(p, syntax);
}
}
ArrayList<FPlayer> players = c.getPlayers();
int pageCount = (int) Math.ceil((double) players.size() / 8);
if (pg > pageCount) {
pg = pageCount;
}
FPlayer.plainMsg(p, "");
FPlayer.plainMsg(p, ChatColor.GOLD + "[" + Integer.toString(pg) + "/" + Integer.toString(pageCount) + "] " + ChatColor.YELLOW + "Players in " + ChatColor.WHITE + c.getName() + ChatColor.YELLOW +":");
for (int i = 0; i < 8; i++) {
int index = (pg - 1) * 8 + i;
if (index < players.size()) {
FPlayer member = players.get(index);
String msg = ChatColor.GREEN + "- ";
if(Permission.isAdmin(member)) {
msg = msg + ChatColor.AQUA + "[ADMIN] ";
}else if(Permission.isStaff(member)) {
msg = msg + ChatColor.BLUE + "[STAFF] ";
}
msg = msg + ChatColor.YELLOW + member.getName();
FPlayer.plainMsg(p, msg);
}
}
}
}else{
FPlayer.errMsg(null, "This command is for players only.");
}
}
}

View File

@ -0,0 +1,221 @@
package com.fpghoti.fpchatx.config;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.fpghoti.fpchatx.FPChat;
public class ChannelFile {
private FPChat plugin;
private File configFile;
private FileConfiguration config;
private String filename;
private String channel;
public ChannelFile(FPChat plugin, String channel) {
this.channel = channel;
this.filename = channel + ".yml";
this.plugin = plugin;
File cdir = new File(this.plugin.getDataFolder() + File.separator + "channels");
cdir.mkdirs();
this.configFile = new File(cdir, filename);
this.config = YamlConfiguration.loadConfiguration(configFile);
try {
generate();
} catch (IOException e) {
e.printStackTrace();
}
config = YamlConfiguration.loadConfiguration(configFile);
}
public static ArrayList<File> getChannelFiles(){
ArrayList<File> files = new ArrayList<File>();
File cdir = new File(FPChat.getPlugin().getDataFolder(), "channels");
if(!cdir.exists()) {
cdir.mkdirs();
new ChannelFile(FPChat.getPlugin(), "Default");
}
File[] foundfiles = cdir.listFiles(new FilenameFilter() {
@Override public boolean accept(File dir, String name) {
return name.toLowerCase().endsWith(".yml");
}
});
for(File f : foundfiles) {
files.add(f);
}
return files;
}
public static boolean channelExists(String c) {
File cdir = new File(FPChat.getPlugin().getDataFolder() + File.separator + "channels");
if(!cdir.exists()) {
return false;
}
String fname = c + ".yml";
File file = new File(cdir, fname);
return file.exists();
}
private void generate() throws IOException{
if (config.get("Name")==null) {
config.createSection("Name");
config.set("Name", channel);
}
if (config.get("Shortcut")==null) {
config.createSection("Shortcut");
config.set("Shortcut", channel);
}
if (config.get("ChatFormat")==null) {
config.createSection("ChatFormat");
config.set("ChatFormat", "&8[{prefix}&8]{suffix}{player}&8:&7 ");
}
if (config.get("DistinguishedChatFormat")==null){
config.createSection("DistinguishedChatFormat");
config.set("DistinguishedChatFormat", "&8&l(&r{prefix}&8&l)&r{suffix}{player}&8&l - &r&7");
}
if (config.get("Whitelist")==null) {
config.createSection("Whitelist");
config.set("Whitelist", false);
}
if (config.get("WhitelistedUUIDs")==null) {
config.createSection("WhitelistedUUIDs");
config.set("WhitelistedUUIDs", "");
}
if (config.get("WhitelistedPermissionNode")==null) {
config.createSection("WhitelistedPermissionNode");
config.set("WhitelistedPermissionNode", "fpchat.whitelisted." + channel);
}
if (config.get("HasRadius")==null) {
config.createSection("HasRadius");
config.set("HasRadius", false);
}
if (config.get("Radius")==null) {
config.createSection("Radus");
config.set("Radius", 300);
}
if (config.get("BannedUUIDs")==null) {
config.createSection("BannedUUIDs");
config.set("BannedUUIDs", "");
}
config.save(configFile);
}
public String getName() {
return config.getString("Name");
}
public String getShortcut() {
return config.getString("Shortcut");
}
public void saveShortcut(String shortcut) throws IOException{
if (config.get("Shortcut")==null) {
config.createSection("Shortcut");
}
config.set("Shortcut", shortcut);
config.save(configFile);
}
public String getChatFormat() {
return config.getString("ChatFormat");
}
public void saveChatFormat(String format) throws IOException{
if (config.get("ChatFormat")==null) {
config.createSection("ChatFormat");
}
config.set("ChatFormat", format);
config.save(configFile);
}
public String getDistinguishedChatFormat() {
return config.getString("DistinguishedChatFormat");
}
public void saveDistinguishedChatFormat(String format) throws IOException{
if (config.get("DistinguishedChatFormat")==null) {
config.createSection("DistinguishedChatFormat");
}
config.set("DistinguishedChatFormat", format);
config.save(configFile);
}
public boolean isWhitelisted() {
return config.getBoolean("Whitelist");
}
public void saveWhitelist(boolean whitelisted) throws IOException {
if (config.get("Whitelist")==null) {
config.createSection("Whitelist");
}
config.set("Whitelist", whitelisted);
config.save(configFile);
}
public String getWhitelistedUUIDs() {
return config.getString("WhitelistedUUIDs");
}
public void saveWhitelistedUUIDs(String uuids) throws IOException {
if (config.get("WhitelistedUUIDs")==null) {
config.createSection("WhitelistedUUIDs");
}
config.set("WhitelistedUUIDs", uuids);
config.save(configFile);
}
public String getWhitelistedPermissionNode() {
return config.getString("WhitelistedPermissionNode");
}
public void saveWhitelistedPermissionNode(String perm) throws IOException{
if (config.get("WhitelistedPermissionNode")==null) {
config.createSection("WhitelistedPermissionNode");
}
config.set("WhitelistedPermissionNode", perm);
config.save(configFile);
}
public boolean hasRadius() {
return config.getBoolean("HasRadius");
}
public void saveHasRadius(boolean b) throws IOException {
if (config.get("HasRadius")==null) {
config.createSection("HasRadius");
}
config.set("HasRadius", b);
config.save(configFile);
}
public int getRadius() {
return config.getInt("Radius");
}
public void saveRadius(int radius) throws IOException{
if (config.get("Radius")==null) {
config.createSection("Radius");
}
config.set("Radius", radius);
config.save(configFile);
}
public String getBannedUUIDs() {
return config.getString("BannedUUIDs");
}
public void saveBannedUUIDs(String uuids) throws IOException {
if (config.get("BannedUUIDs")==null) {
config.createSection("BannedUUIDs");
}
config.set("BannedUUIDs", uuids);
config.save(configFile);
}
}

View File

@ -0,0 +1,242 @@
package com.fpghoti.fpchatx.config;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.fpghoti.fpchatx.FPChat;
public class MainConfig {
private FPChat plugin;
private File configFile;
private FileConfiguration config;
public MainConfig(FPChat plugin) {
this.plugin = plugin;
this.configFile = new File(plugin.getDataFolder(), "config.yml");
this.config = YamlConfiguration.loadConfiguration(configFile);
generate();
}
private void generate(){
if (config.get("MySQL")==null) {
config.createSection("MySQL");
config.set("MySQL", false);
}
if (config.get("Host")==null) {
config.createSection("Host");
config.set("Host", "0.0.0.0");
}
if (config.get("Port")==null) {
config.createSection("Port");
config.set("Port", "3306");
}
if (config.get("User")==null) {
config.createSection("User");
config.set("User", "Username");
}
if (config.get("Password")==null) {
config.createSection("Password");
config.set("Password", "blee");
}
if (config.get("Database")==null) {
config.createSection("Database");
config.set("Database", "mydb");
}
if (config.get("Chat-Feature-Table")==null) {
config.createSection("Chat-Feature-Table");
config.set("Chat-Feature-Table", "fpchat");
}
if (config.get("PermSync-Table")==null) {
config.createSection("PermSync-Table");
config.set("PermSync-Table", "fpchatsync");
}
if (config.get("StaffBadgeEnabled")==null) {
config.createSection("StaffBadgeEnabled");
config.set("StaffBadgeEnabled", false);
}
if (config.get("StaffBadge")==null) {
config.createSection("StaffBadge");
config.set("StaffBadge", "&6&l⟪Տ⟫&r");
}
if (config.get("ShoutCooldownEnabled")==null) {
config.createSection("ShoutCooldownEnabled");
config.set("ShoutCooldownEnabled", false);
}
if (config.get("ShoutCooldownSeconds")==null) {
config.createSection("ShoutCooldownSeconds");
config.set("ShoutCooldownSeconds", 45);
}
if (config.get("ShoutFormat")==null) {
config.createSection("ShoutFormat");
config.set("ShoutFormat", "&8[{prefix}&8]{suffix}{player}&8:&f ");
}
if (config.get("In-Message-Format")==null) {
config.createSection("In-Message-Format");
config.set("In-Message-Format", "&3[&a{player} &c -> &aMe&3]&f ");
}
if (config.get("Out-Message-Format")==null) {
config.createSection("Out-Message-Format");
config.set("Out-Message-Format", "&3[&aMe &c -> &a{recipient}&3]&f ");
}
if (config.get("Temp-Channel-Format")==null) {
config.createSection("Temp-Channel-Format");
config.set("Temp-Channel-Format", "&2[&6{channel}&2]&7{player}&2:&e ");
}
if (config.get("Filter")==null){
config.createSection("Filter");
config.set("Filter", false);
}
if (config.get("NaughtyWords")==null){
config.createSection("NaughtyWords");
config.set("NaughtyWords", "word1,word2,word3");
}
if (config.get("FrankMode")==null){
config.createSection("FrankMode");
config.set("FrankMode", false);
}
if (config.get("DistinguishedShout")==null){
config.createSection("DistinguishedShout");
config.set("DistinguishedShout", "&8&l(&r{prefix}&8&l)&r{suffix}{player}&8&l - &r&f");
}
if (config.get("DefaultChannel")==null){
config.createSection("DefaultChannel");
config.set("DefaultChannel", "Default");
}
try {
config.save(configFile);
} catch (IOException e) {
e.printStackTrace();
}
}
public boolean mySQLEnabled() {
return config.getBoolean("MySQL");
}
public String getHost() {
if(mySQLEnabled()) {
return config.getString("Host");
}else {
plugin.getLogger().log(Level.SEVERE, "Null SQL host. Is MySQL disabled?");
return null;
}
}
public String getPort() {
if(mySQLEnabled()) {
return config.getString("Port");
}else {
plugin.getLogger().log(Level.SEVERE, "Null SQL port. Is MySQL disabled?");
return null;
}
}
public String getUser() {
if(mySQLEnabled()) {
return config.getString("User");
}else {
plugin.getLogger().log(Level.SEVERE, "Null SQL user. Is MySQL disabled?");
return null;
}
}
public String getPassword() {
if(mySQLEnabled()) {
return config.getString("Password");
}else {
plugin.getLogger().log(Level.SEVERE, "Null SQL password. Is MySQL disabled?");
return null;
}
}
public String getDatabase() {
if(mySQLEnabled()) {
return config.getString("Database");
}else {
plugin.getLogger().log(Level.SEVERE, "Null SQL database. Is MySQL disabled?");
return null;
}
}
public String getChatFeatureTable() {
if(mySQLEnabled()) {
return config.getString("Chat-Feature-Table");
}else {
plugin.getLogger().log(Level.SEVERE, "Null SQL chat feature table. Is MySQL disabled?");
return null;
}
}
public String getPermSyncTable() {
if(mySQLEnabled()) {
return config.getString("PermSync-Table");
}else {
plugin.getLogger().log(Level.SEVERE, "Null SQL perm sync table. Is MySQL disabled?");
return null;
}
}
public boolean staffBadgeEnabled() {
return config.getBoolean("StaffBadgeEnabled");
}
public String getStaffBadge() {
if(staffBadgeEnabled()) {
return ChatColor.translateAlternateColorCodes('&', config.getString("StaffBadge"));
}
return "";
}
public boolean shoutCooldownEnabled(){
return config.getBoolean("ShoutCooldownEnabled");
}
public int getShoutSeconds(){
return config.getInt("ShoutCooldownSeconds");
}
public String getDefaultChannel() {
return config.getString("DefaultChannel");
}
public String getShoutFormat() {
return config.getString("ShoutFormat");
}
public String getInMsgFormat() {
return config.getString("In-Message-Format");
}
public String getOutMsgFormat() {
return config.getString("Out-Message-Format");
}
public String getTempChannelFormat() {
return config.getString("Temp-Channel-Format");
}
public boolean chatFilterEnabled() {
return config.getBoolean("Filter");
}
public String getNaughtyWords() {
return config.getString("NaughtyWords");
}
public boolean frankModeEnabled() {
return config.getBoolean("FrankMode");
}
public String getDistinguishedShout() {
return config.getString("DistinguishedShout");
}
}

View File

@ -0,0 +1,46 @@
package com.fpghoti.fpchatx.config;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.fpghoti.fpchatx.FPChat;
public class PlayerCache {
private FPChat plugin;
private File configFile;
private FileConfiguration config;
public PlayerCache(FPChat plugin) {
this.plugin = plugin;
configFile = new File(this.plugin.getDataFolder(), "playercache.yml");
this.config = YamlConfiguration.loadConfiguration(configFile);
config = YamlConfiguration.loadConfiguration(configFile); // In case the player had changed their name and the config updated.
}
public UUID getUUID(String name) {
try {
return UUID.fromString(config.getString(name.toLowerCase()));
}catch(IllegalArgumentException ex) {
return null;
}catch(NullPointerException ex) {
return null;
}
}
public void saveUUID(String name, UUID uuid) throws IOException {
name = name.toLowerCase();
if (config.get(name)==null) {
config.createSection(name);
}
config.set(name, uuid.toString());
config.save(configFile);
}
}

View File

@ -0,0 +1,157 @@
package com.fpghoti.fpchatx.config;
import java.io.File;
import java.io.IOException;
import org.bukkit.OfflinePlayer;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
public class PlayerFile {
private FPChat plugin;
private File configFile;
private FileConfiguration config;
private String filename;
private OfflinePlayer player;
public PlayerFile(FPChat plugin, OfflinePlayer p) {
this.player = p;
filename = p.getUniqueId().toString() + ".yml";
this.plugin = plugin;
File pdir = new File(this.plugin.getDataFolder(), "players");
pdir.mkdirs();
configFile = new File(pdir, filename);
this.config = YamlConfiguration.loadConfiguration(configFile);
try {
generate();
} catch (IOException e) {
e.printStackTrace();
}
config = YamlConfiguration.loadConfiguration(configFile); // In case the player had changed their name and the config updated.
}
private void generate() throws IOException{
if (config.get("UUID")==null) {
config.createSection("UUID");
config.set("UUID", player.getUniqueId().toString());
}
if (config.get("Name")==null) {
config.createSection("Name");
config.set("Name", player.getName());
}
if (config.get("CurrentChannel")==null) {
config.createSection("CurrentChannel");
config.set("CurrentChannel", ChatChannel.getDefault().getName());
}
if (config.get("Ignore")==null) {
config.createSection("Ignore");
config.set("Ignore", "");
}
if (config.get("Channels")==null) {
config.createSection("Channels");
config.set("Channels", ChatChannel.getDefault().getName() + ",");
}
if (config.get("Spy")==null) {
config.createSection("Spy");
config.set("Spy", false);
}
if (config.get("ShoutVisible")==null) {
config.createSection("ShoutVisible");
config.set("ShoutVisible", true);
}
if (config.get("Hushed")==null) {
config.createSection("Hushed");
config.set("Hushed", false);
}
config.set("Name", player.getName());
config.save(configFile);
}
public String getUUID() {
return config.getString("UUID");
}
public String getName() {
return config.getString("Name");
}
public boolean isSpy() {
return config.getBoolean("Spy");
}
public void saveSpy(boolean spy) throws IOException {
if (config.get("Spy")==null) {
config.createSection("Spy");
}
config.set("Spy", spy);
config.save(configFile);
}
public boolean shoutVisible() {
return config.getBoolean("ShoutVisible");
}
public void saveShoutVisible(boolean visible) throws IOException {
if (config.get("ShoutVisible")==null) {
config.createSection("ShoutVisible");
}
config.set("ShoutVisible", visible);
config.save(configFile);
}
public boolean isHushed() {
return config.getBoolean("Hushed");
}
public void saveHushed(boolean hushed) throws IOException {
if (config.get("Hushed")==null) {
config.createSection("Hushed");
}
config.set("Hushed", hushed);
config.save(configFile);
}
public String getCurrentChannel() {
return config.getString("CurrentChannel");
}
public void saveCurrentChannel(String channel) throws IOException {
if (config.get("CurrentChannel")==null) {
config.createSection("CurrentChannel");
}
config.set("CurrentChannel", channel);
config.save(configFile);
}
public String getIgnore() {
return config.getString("Ignore");
}
public void saveIgnore(String ignore) throws IOException {
if (config.get("Ignore")==null) {
config.createSection("Ignore");
}
config.set("Ignore", ignore);
config.save(configFile);
}
public String getChannels() {
return config.getString("Channels");
}
public void saveChannels(String channels) throws IOException {
if (config.get("Channels")==null) {
config.createSection("Channels");
}
config.set("Channels", channels);
config.save(configFile);
}
}

View File

@ -0,0 +1,114 @@
package com.fpghoti.fpchatx.customcodes;
public class BubbleCode {
public static String bubblecode(Boolean hasPerm, String msg) {
String newmsg = msg;
if(hasPerm) {
newmsg = replaceChar(msg);
}
return newmsg;
}
private static String replaceChar(String msg) {
Boolean on = false;
String newmsg = "";
int i = 0;
while(i < msg.length()) {
if(msg.substring(i, i + 1).equals("§")) {
String code = msg.substring(i + 1, i + 2);
if(code.equals("r")) {
on = false;
}
String wcode = "§" + code;
newmsg = newmsg + wcode;
i++;
}else if(msg.substring(i, i + 1).equals("&")) {
if(msg.substring(i + 1, i + 2).equals("w")) {
on = true;
i++;
}else {
newmsg = newmsg + "&";
}
}else{
String sub = msg.substring(i, i + 1);
if(on) {
sub = sub.replace('a', 'ⓐ');
sub = sub.replace('b', 'ⓑ');
sub = sub.replace('c', 'ⓒ');
sub = sub.replace('d', 'ⓓ');
sub = sub.replace('e', 'ⓔ');
sub = sub.replace('f', 'ⓕ');
sub = sub.replace('g', 'ⓖ');
sub = sub.replace('h', 'ⓗ');
sub = sub.replace('i', 'ⓘ');
sub = sub.replace('j', 'ⓙ');
sub = sub.replace('k', 'ⓚ');
sub = sub.replace('l', 'ⓛ');
sub = sub.replace('m', 'ⓜ');
sub = sub.replace('n', 'ⓝ');
sub = sub.replace('o', 'ⓞ');
sub = sub.replace('p', 'ⓟ');
sub = sub.replace('q', 'ⓠ');
sub = sub.replace('r', 'ⓡ');
sub = sub.replace('s', 'ⓢ');
sub = sub.replace('t', 'ⓣ');
sub = sub.replace('u', 'ⓤ');
sub = sub.replace('v', 'ⓥ');
sub = sub.replace('w', 'ⓦ');
sub = sub.replace('x', 'ⓧ');
sub = sub.replace('y', 'ⓨ');
sub = sub.replace('z', 'ⓩ');
sub = sub.replace('A', 'Ⓐ');
sub = sub.replace('B', 'Ⓑ');
sub = sub.replace('C', 'Ⓒ');
sub = sub.replace('D', 'Ⓓ');
sub = sub.replace('E', 'Ⓔ');
sub = sub.replace('F', 'Ⓕ');
sub = sub.replace('G', 'Ⓖ');
sub = sub.replace('H', 'Ⓗ');
sub = sub.replace('I', 'Ⓘ');
sub = sub.replace('J', 'Ⓙ');
sub = sub.replace('K', 'Ⓚ');
sub = sub.replace('L', 'Ⓛ');
sub = sub.replace('M', 'Ⓜ');
sub = sub.replace('N', 'Ⓝ');
sub = sub.replace('O', 'Ⓞ');
sub = sub.replace('P', 'Ⓟ');
sub = sub.replace('Q', 'Ⓠ');
sub = sub.replace('R', 'Ⓡ');
sub = sub.replace('S', 'Ⓢ');
sub = sub.replace('T', 'Ⓣ');
sub = sub.replace('U', 'Ⓤ');
sub = sub.replace('V', 'Ⓥ');
sub = sub.replace('W', 'Ⓦ');
sub = sub.replace('X', 'Ⓧ');
sub = sub.replace('Y', 'Ⓨ');
sub = sub.replace('Z', 'Ⓩ');
sub = sub.replace('1', '①');
sub = sub.replace('2', '②');
sub = sub.replace('3', '③');
sub = sub.replace('4', '④');
sub = sub.replace('5', '⑤');
sub = sub.replace('6', '⑥');
sub = sub.replace('7', '⑦');
sub = sub.replace('8', '⑧');
sub = sub.replace('9', '⑨');
sub = sub.replace('0', '⓪');
}
newmsg = newmsg + sub;
}
i++;
}
return newmsg;
}
}

View File

@ -0,0 +1,114 @@
package com.fpghoti.fpchatx.customcodes;
public class Codify {
public static String changeFormatSign(String str) {
String nstr = str;
nstr = nstr.replace("&0", "§0");
nstr = nstr.replace("&1", "§1");
nstr = nstr.replace("&2", "§2");
nstr = nstr.replace("&3", "§3");
nstr = nstr.replace("&4", "§4");
nstr = nstr.replace("&5", "§5");
nstr = nstr.replace("&6", "§6");
nstr = nstr.replace("&7", "§7");
nstr = nstr.replace("&8", "§8");
nstr = nstr.replace("&9", "§9");
nstr = nstr.replace("&a", "§a");
nstr = nstr.replace("&b", "§b");
nstr = nstr.replace("&c", "§c");
nstr = nstr.replace("&d", "§d");
nstr = nstr.replace("&e", "§e");
nstr = nstr.replace("&f", "§f");
nstr = nstr.replace("&k", "§k");
nstr = nstr.replace("&l", "§l");
nstr = nstr.replace("&m", "§m");
nstr = nstr.replace("&n", "§n");
nstr = nstr.replace("&o", "§o");
nstr = nstr.replace("&r", "§r");
//nstr = nstr.replace("&w", "§w");
//nstr = nstr.replace("&x", "§x");
return nstr;
}
public static String removeBubbles(String str) {
String nstr = str;
nstr = nstr.replace('ⓐ', 'a');
nstr = nstr.replace('ⓑ', 'b');
nstr = nstr.replace('ⓒ', 'c');
nstr = nstr.replace('ⓓ', 'd');
nstr = nstr.replace('ⓔ', 'e');
nstr = nstr.replace('ⓕ', 'f');
nstr = nstr.replace('ⓖ', 'g');
nstr = nstr.replace('ⓗ', 'h');
nstr = nstr.replace('ⓘ', 'i');
nstr = nstr.replace('ⓙ', 'j');
nstr = nstr.replace('ⓚ', 'k');
nstr = nstr.replace('ⓛ', 'l');
nstr = nstr.replace('ⓜ', 'm');
nstr = nstr.replace('ⓝ', 'n');
nstr = nstr.replace('ⓞ', 'o');
nstr = nstr.replace('ⓟ', 'p');
nstr = nstr.replace('ⓠ', 'q');
nstr = nstr.replace('ⓡ', 'r');
nstr = nstr.replace('ⓢ', 's');
nstr = nstr.replace('ⓣ', 't');
nstr = nstr.replace('ⓤ', 'u');
nstr = nstr.replace('ⓥ', 'v');
nstr = nstr.replace('ⓦ', 'w');
nstr = nstr.replace('ⓧ', 'x');
nstr = nstr.replace('ⓨ', 'y');
nstr = nstr.replace('ⓩ', 'z');
nstr = nstr.replace('Ⓐ', 'A');
nstr = nstr.replace('Ⓑ', 'B');
nstr = nstr.replace('Ⓒ', 'C');
nstr = nstr.replace('Ⓓ', 'D');
nstr = nstr.replace('Ⓔ', 'E');
nstr = nstr.replace('Ⓕ', 'F');
nstr = nstr.replace('Ⓖ', 'G');
nstr = nstr.replace('Ⓗ', 'H');
nstr = nstr.replace('Ⓘ', 'I');
nstr = nstr.replace('Ⓙ', 'J');
nstr = nstr.replace('Ⓚ', 'K');
nstr = nstr.replace('Ⓛ', 'L');
nstr = nstr.replace('Ⓜ', 'M');
nstr = nstr.replace('Ⓝ', 'N');
nstr = nstr.replace('Ⓞ', 'O');
nstr = nstr.replace('Ⓟ', 'P');
nstr = nstr.replace('Ⓠ', 'Q');
nstr = nstr.replace('Ⓡ', 'R');
nstr = nstr.replace('Ⓢ', 'S');
nstr = nstr.replace('Ⓣ', 'T');
nstr = nstr.replace('Ⓤ', 'U');
nstr = nstr.replace('Ⓥ', 'V');
nstr = nstr.replace('Ⓦ', 'W');
nstr = nstr.replace('Ⓧ', 'X');
nstr = nstr.replace('Ⓨ', 'Y');
nstr = nstr.replace('Ⓩ', 'Z');
nstr = nstr.replace('①', '1');
nstr = nstr.replace('②', '2');
nstr = nstr.replace('③', '3');
nstr = nstr.replace('④', '4');
nstr = nstr.replace('⑤', '5');
nstr = nstr.replace('⑥', '6');
nstr = nstr.replace('⑦', '7');
nstr = nstr.replace('⑧', '8');
nstr = nstr.replace('⑨', '9');
nstr = nstr.replace('⓪', '0');
return nstr;
}
public static Boolean isCode(String c) {
String code = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f,k,l,m,n,o,r,w,x";
Boolean found = false;
String[] codes = code.split(",");
int size = codes.length;
for(int i = 0; i < size; i++) {
if(c.contains(codes[i])) {
found = true;
}
}
return found;
}
}

View File

@ -0,0 +1,78 @@
package com.fpghoti.fpchatx.listener;
import java.io.IOException;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.player.FPlayer;
public class PlayerListener implements Listener {
private boolean enabled = true;
@EventHandler (priority = EventPriority.HIGH)
public void onPlayerChat(AsyncPlayerChatEvent event) {
if(enabled) {
if (event.isCancelled()) {
return;
}
Player sender = event.getPlayer();
FPlayer p = FPlayer.getPlayer(sender);
if(p.toTalk() && p.getTalkChannel() != null) {
p.setTalk(false);
ChatChannel c = p.getTalkChannel();
p.setTalkChannel(null);
p.chat(c, event.getMessage());
}else {
p.chat(event.getMessage());
}
event.setCancelled(true);
}
}
@EventHandler (priority = EventPriority.NORMAL)
public void onPlayerJoin(PlayerJoinEvent event) {
if(enabled) {
try {
FPChat.getPlugin().getPlayerCache().saveUUID(event.getPlayer().getName(), event.getPlayer().getUniqueId());
} catch (IOException e) {
e.printStackTrace();
}
FPlayer.getPlayer(event.getPlayer());
}
}
@EventHandler (priority = EventPriority.NORMAL)
public void onPlayerQuit(PlayerQuitEvent event) {
if(enabled) {
FPlayer p = FPlayer.getPlayer(event.getPlayer());
p.cleanup();
}
}
@EventHandler (priority = EventPriority.NORMAL)
public void onPlayerKick(PlayerKickEvent event) {
if(enabled) {
FPlayer p = FPlayer.getPlayer(event.getPlayer());
p.cleanup();
}
}
public void enable() {
this.enabled = true;
}
public void disable() {
this.enabled = false;
}
}

View File

@ -0,0 +1,233 @@
package com.fpghoti.fpchatx.mysql;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import org.bukkit.scheduler.BukkitRunnable;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.config.MainConfig;
public class MySQLConnection{
private FPChat plugin;
private String host, user, password, database, port;
private MainConfig config;
public MySQLConnection(FPChat plugin) {
this.plugin = plugin;
config = plugin.getMainConfig();
host = config.getHost();
user = config.getUser();
password = config.getPassword();
database = config.getDatabase();
port = config.getPort();
}
private Connection connection;
public Connection getConnection(){
return connection;
}
public void generate() {
if(config.mySQLEnabled()){
plugin.log(Level.INFO, "Connecting to MySQL...");
connect();
if(!tableExists(config.getChatFeatureTable())){
plugin.log(Level.INFO, "FPChat table not found. Creating new table...");
//createTable(config.getChatFeatureTable(), "player_uuid VARCHAR (36), badge_slot1 INT (11), badge_slot2 INT (11), badge_slot3 INT (11)");
update("CREATE TABLE " + config.getChatFeatureTable() + " (player_uuid VARCHAR (36), badge_slot1 INT (11), badge_slot2 INT (11), badge_slot3 INT (11), PRIMARY KEY(player_uuid))");
plugin.log(Level.INFO, "FPChat table created!");
}
if(!tableExists(config.getPermSyncTable())){
//createTable(config.getPermSyncTable(), "player_uuid VARCHAR (36), badges TEXT");
update("CREATE TABLE " + config.getPermSyncTable() + " (player_uuid VARCHAR (36), badges TEXT, PRIMARY KEY(player_uuid))");
}
plugin.log(Level.INFO, "FPChat successfully connected to MySQL!");
plugin.log(Level.INFO, "Badges have been enabled!");
}else{
plugin.log(Level.INFO, "Continuing without MySQL.");
}
}
public void connect(){
if (host.equalsIgnoreCase("") || host == null) {
plugin.log(Level.SEVERE, "You have not specified a host in the FPChatX config!");
} else if (user.equalsIgnoreCase("") || user == null) {
plugin.log(Level.SEVERE, "You have not specified a user in the FPChatX config!");
} else if (password.equalsIgnoreCase("") || password == null) {
plugin.log(Level.SEVERE, "You have not specified a password in the FPChatX config!");
} else if (database.equalsIgnoreCase("") || database == null) {
plugin.log(Level.SEVERE, "You have not specified a database in the FPChatX config!");
} else {
login();
}
}
public void disconnect(){
try{
if (getConnection() != null){
connection.close();
}
else{
plugin.log(Level.SEVERE, "There was an issue with MySQL: FPChatX is not currently connected to a database.");
}
}catch(SQLException e){
plugin.log(Level.SEVERE, "There was an issue with MySQL: " + e.getMessage());
e.printStackTrace();
}
connection = null;
}
public void reconnect(){
disconnect();
connect();
}
public void login(){
try{
if (getConnection() != null){
connection.close();
}
}
catch (Exception e){}
connection = null;
try{
connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, user, password);
}catch(SQLException e){
plugin.log(Level.SEVERE, "There was an issue with MySQL: " + e.getMessage());
e.printStackTrace();
}
}
public ResultSet query(String query){
if (query == null) {
return null;
}
connect();
ResultSet results = null;
try{
Statement statement = getConnection().createStatement();
results = statement.executeQuery(query);
}catch(SQLException e){
plugin.log(Level.SEVERE, "There has been an error:" + e.getMessage());
plugin.log(Level.SEVERE,"Failed Query in MySQL using the following query input:");
plugin.log(Level.SEVERE, query);
e.printStackTrace();
}
return results;
}
public void update(String input){
if (input == null){
return;
}
connect();
try{
Statement statement = getConnection().createStatement();
statement.executeUpdate(input);
statement.close();
}catch(SQLException e){
plugin.log(Level.SEVERE, "There has been an error:" + e.getMessage());
plugin.log(Level.SEVERE,"Failed to update MySQL using the following update input:");
plugin.log(Level.SEVERE, input);
e.printStackTrace();
}
}
public boolean tableExists(String tablename){
if (tablename == null) {
return false;
}
try{
if (getConnection() == null) {
return false;
}
if (getConnection().getMetaData() == null) {
return false;
}
ResultSet results = getConnection().getMetaData().getTables(null, null, tablename, null);
if (results.next()) {
return true;
}
}catch(SQLException e) {
e.printStackTrace();
}
return false;
}
public boolean itemExists(String column, String data, String table){
if (data != null) {
data = "'" + data + "'";
}
try{
ResultSet results = query("SELECT * FROM " + table + " WHERE " + column + "=" + data);
while (results.next()) {
if (results.getString(column) != null) {
return true;
}
}
}catch(SQLException e) {
plugin.log(Level.SEVERE, "MYSQL itemExists error: " + e.getMessage());
e.printStackTrace();
}
return false;
}
public void createTable(String table, String columns){
if (!tableExists(table)) {
update("CREATE TABLE " + table + " (" + columns + ")");
}
}
public void insertInto(final String columns, final String values, final String table){
new BukkitRunnable() {
@Override
public void run() {
update("INSERT INTO " + table + " (" + columns + ") VALUES (" + values + ")");
}
}.runTaskAsynchronously(plugin);
}
public void set(final String selected, final Object object, final String column, final String equality, final String data, final String table){
new BukkitRunnable() {
@Override
public void run() {
Object gobject = object;
String gdata = data;
if (gobject != null) {
gobject = "'" + gobject + "'";
}
if (gdata != null) {
gdata = "'" + gdata + "'";
}
update("UPDATE " + table + " SET " + selected + "=" + gobject + " WHERE " + column + equality + gdata + ";");
}
}.runTaskAsynchronously(plugin);
}
public Object get(String selected, String column, String equality, String data, String table){
if (data != null) {
data = "'" + data + "'";
}
try{
ResultSet rs = query("SELECT * FROM " + table + " WHERE " + column + equality + data);
if (rs.next()) {
return rs.getObject(selected);
}
}catch(SQLException e) {
plugin.log(Level.SEVERE, "MySQL get error: " + e.getMessage());
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,242 @@
package com.fpghoti.fpchatx.permission;
import com.fpghoti.fpchatx.player.FPlayer;
public class Permission {
public static String noPerm = "You lack the permission required to perform this action.";
public static boolean canUseColor(FPlayer p) {
return p.hasPermission("fpchat.colorcodes");
}
public static boolean canUseColor(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canUseColor(p);
}
return false;
}
public static boolean canShoutColor(FPlayer p) {
return p.hasPermission("fpchat.shoutcolor");
}
public static boolean canShoutColor(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canShoutColor(p);
}
return false;
}
public static boolean canPMColor(FPlayer p) {
return p.hasPermission("fpchat.pmcolor");
}
public static boolean canPMColor(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canPMColor(p);
}
return false;
}
public static boolean canBubbleCode(FPlayer p) {
return p.hasPermission("fpchat.bubblecode");
}
public static boolean canBubbleCode(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canBubbleCode(p);
}
return false;
}
public static boolean canSpy(FPlayer p) {
return p.hasPermission("fpchat.spy");
}
public static boolean canSpy(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canSpy(p);
}
return false;
}
public static boolean isAdmin(FPlayer p) {
return p.hasPermission("fpchat.admin");
}
public static boolean isAdmin(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return isAdmin(p);
}
return false;
}
public static boolean canBan(FPlayer p) {
return p.hasPermission("fpchat.ban");
}
public static boolean canMakeChannel(FPlayer p) {
return p.hasPermission("fpchat.makechannel");
}
public static boolean canMakeChannel(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canMakeChannel(p);
}
return false;
}
public static boolean canMakeTempChannel(FPlayer p) {
return p.hasPermission("fpchat.maketempchannel");
}
public static boolean canMakeTempChannel(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canMakeTempChannel(p);
}
return false;
}
public static boolean canAlertMakeChannel(FPlayer p) {
return p.hasPermission("fpchat.alertmakechannel");
}
public static boolean canAlertMakeChannel(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canAlertMakeChannel(p);
}
return false;
}
public static boolean canIgnore(FPlayer p) {
return p.hasPermission("fpchat.ignore");
}
public static boolean canIgnore(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canIgnore(p);
}
return false;
}
public static boolean isStaff(FPlayer p) {
return p.hasPermission("fpchat.staff");
}
public static boolean isStaff(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return isStaff(p);
}
return false;
}
public static boolean canKick(FPlayer p) {
return p.hasPermission("fpchat.kick");
}
public static boolean canKick(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canKick(p);
}
return false;
}
public static boolean canMute(FPlayer p) {
return p.hasPermission("fpchat.mute");
}
public static boolean canMute(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canMute(p);
}
return false;
}
public static boolean canHush(FPlayer p) {
return p.hasPermission("fpchat.hush");
}
public static boolean canHush(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canHush(p);
}
return false;
}
public static boolean canShout(FPlayer p) {
return p.hasPermission("fpchat.shout");
}
public static boolean canShout(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canShout(p);
}
return false;
}
public static boolean canToggleShout(FPlayer p) {
return p.hasPermission("fpchat.toggleshout");
}
public static boolean canToggleShout(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canToggleShout(p);
}
return false;
}
public static boolean isDistinguished(FPlayer p) {
return p.hasPermission("fpchat.distinguished");
}
public static boolean isDistinguished(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return isDistinguished(p);
}
return false;
}
public static boolean canDeleteChannel(FPlayer p) {
return p.hasPermission("fpchat.deletechannel");
}
public static boolean canDeleteChannel(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canDeleteChannel(p);
}
return false;
}
public static boolean canPrivateMessage(FPlayer p) {
return p.hasPermission("fpchat.privatemessage");
}
public static boolean canPrivateMessage(String playername) {
if(FPlayer.getPlayer(playername) != null) {
FPlayer p = FPlayer.getPlayer(playername);
return canPrivateMessage(p);
}
return false;
}
}

View File

@ -0,0 +1,677 @@
package com.fpghoti.fpchatx.player;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.UUID;
import java.util.logging.Level;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import com.fpghoti.fpchatx.FPChat;
import com.fpghoti.fpchatx.badge.BadgeGetter;
import com.fpghoti.fpchatx.badge.BadgeSet;
import com.fpghoti.fpchatx.badge.SyncSet;
import com.fpghoti.fpchatx.chat.ChatChannel;
import com.fpghoti.fpchatx.chat.ChatFilter;
import com.fpghoti.fpchatx.chat.PrepareChat;
import com.fpghoti.fpchatx.chat.StandardChannel;
import com.fpghoti.fpchatx.chat.TempChannel;
import com.fpghoti.fpchatx.config.PlayerFile;
import com.fpghoti.fpchatx.customcodes.BubbleCode;
import com.fpghoti.fpchatx.customcodes.Codify;
import com.fpghoti.fpchatx.permission.Permission;
import com.fpghoti.fpchatx.util.Util;
import com.fpghoti.fpchatx.util.VaultUtil;
public class FPlayer {
private static HashMap<UUID,FPlayer> players = new HashMap<UUID,FPlayer>();
public static void purge() {
players = new HashMap<UUID,FPlayer>();
}
public static ArrayList<FPlayer> getPlayers(){
ArrayList<FPlayer> temp = new ArrayList<FPlayer>(players.values());
return temp;
}
public static FPlayer getPlayer(OfflinePlayer p) {
return getPlayer(p,false);
}
@SuppressWarnings("deprecation") // Needed in order to run command using name when player offline. Most people can't remember UUIDs!!
public static FPlayer getOfflinePlayer(String name) {
return getPlayer(Bukkit.getOfflinePlayer(name));
}
public static void dualMsg(FPlayer p, String msg) { // Messages FPlayer. If FPlayer NULL msges CONSOLE instead
if(p == null) {
FPChat.getPlugin().log(Level.INFO, msg);
}else {
p.sendMessage(FPChat.logo() + ChatColor.YELLOW + " " + msg);
}
}
public static void goodMsg(FPlayer p, String msg) { // Messages FPlayer. If FPlayer NULL msges CONSOLE instead
if(p == null) {
FPChat.getPlugin().log(Level.INFO, msg);
}else {
p.sendMessage(FPChat.logo() + ChatColor.YELLOW + " " + msg);
}
}
public static void errMsg(FPlayer p, String msg) { // Messages FPlayer. If FPlayer NULL msges CONSOLE instead
if(p == null) {
FPChat.getPlugin().log(Level.INFO, "" + ChatColor.RED + msg);
}else {
p.sendMessage(FPChat.logo() + ChatColor.RED + " " + msg);
}
}
public static void plainMsg(FPlayer p, String msg) { // Messages FPlayer. If FPlayer NULL msges CONSOLE instead
if(p == null) {
FPChat.getPlugin().log(Level.INFO, msg);
}else {
p.sendMessage(msg);
}
}
public static FPlayer getPlayer(Player p) {
return getPlayer(Bukkit.getOfflinePlayer(p.getUniqueId()));
}
public static FPlayer getPlayer(String playername) {
return getPlayer(Util.getEP(playername));
}
public static FPlayer getPlayer(OfflinePlayer p, Boolean temp) {
UUID uuid = p.getUniqueId();
if(players.containsKey(uuid)) {
return players.get(uuid);
}else {
FPlayer fplayer = new FPlayer(p);
if(!temp) {
players.put(uuid, fplayer);
}
return fplayer;
}
}
private String name;
private UUID uuid;
private PlayerFile pfile;
private OfflinePlayer offlinePlayer;
private ArrayList<UUID> ignored;
private ArrayList<String> channels;
private ArrayList<String> tempchannels;
private boolean tempspeak;
private String primaryChannel;
private String primaryTempChannel;
private int shoutCooldown;
private Integer[] badges;
private UUID lastMsg;
private boolean spy;
private boolean shoutVisible;
private boolean hushed;
private ArrayList<Integer> synced;
private boolean toShout;
private boolean toTalk;
private ChatChannel talkChannel;
private ArrayList<Integer> giveBadgeQueue;
private FPlayer(OfflinePlayer p) {
this.toShout = false;
this.toTalk = false;
this.talkChannel = null;
this.synced = new ArrayList<Integer>();
this.offlinePlayer = p;
this.name = p.getName();
this.uuid = p.getUniqueId();
this.pfile = new PlayerFile(FPChat.getPlugin(),p);
this.ignored = new ArrayList<UUID>();
this.shoutCooldown = 0;
this.lastMsg = null;
this.spy = pfile.isSpy();
this.shoutVisible = pfile.shoutVisible();
this.hushed = pfile.isHushed();
this.giveBadgeQueue = new ArrayList<Integer>();
String rawignore = pfile.getIgnore();
if(!rawignore.equals("")) {
for(String s : rawignore.split(",")) {
ignored.add(UUID.fromString(s));
}
}
String rawchannel = pfile.getCurrentChannel();
if(rawchannel.equals("default")) {
this.primaryChannel = ChatChannel.getDefault().getName();
}else if(ChatChannel.getChannel(rawchannel) != null) {
this.primaryChannel = rawchannel;
}else {
this.primaryChannel = ChatChannel.getDefault().getName();
}
this.channels = new ArrayList<String>();
this.tempchannels = new ArrayList<String>();
channels.add(ChatChannel.getDefault().getName());
channels.add(primaryChannel);
String rawchannels = pfile.getChannels();
if(!rawchannels.equals("")) {
for(String s : rawchannels.split(",")) {
ChatChannel chan = ChatChannel.getChannel(s);
if(chan != null && !chan.getName().equals(ChatChannel.getDefault().getName()) && !chan.getName().equals(primaryChannel)) {
this.channels.add(chan.getName());
}
}
}
if(FPChat.getPlugin().getMainConfig().mySQLEnabled()) {
Util.connect();
SyncSet.update(this);
this.badges = BadgeGetter.getBadges(this);
}else {
Integer[] empt = {0,0,0};
this.badges = empt;
}
}
public boolean equals(FPlayer p) {
return this.uuid == p.getUniqueId();
}
public String getName() {
return this.name;
}
public void updateBadges(int slot, int id) {
badges[slot-1] = id;
}
public void clearUnownedBadges() {
if(!BadgeGetter.hasBadge(this, badges[0])) {
BadgeSet.setBadge(this, 1, 0);
updateBadges(1,0);
}
if(!BadgeGetter.hasBadge(this, badges[1])) {
BadgeSet.setBadge(this, 2, 0);
updateBadges(2,0);
}
if(!BadgeGetter.hasBadge(this, badges[2])) {
BadgeSet.setBadge(this, 3, 0);
updateBadges(3,0);
}
}
public void addSyncedBadge(Integer id) {
if(!synced.contains(id)) {
this.synced.add(id);
}
}
public void removeSyncedBadge(Integer id) {
this.synced.remove(id);
}
public boolean isSynced(Integer id) {
return this.synced.contains(id);
}
public ArrayList<Integer> syncedList(){
return this.synced;
}
public int getShoutCooldown() {
return this.shoutCooldown;
}
public void setShoutCooldown(int time) {
this.shoutCooldown = time;
}
public UUID getUniqueId() {
return this.uuid;
}
public PlayerFile getFile() {
return this.pfile;
}
public boolean isOnline() {
return offlinePlayer.isOnline();
}
public boolean isSpy() {
return this.spy && Permission.canSpy(this);
}
public boolean enableSpy() {
if(Permission.canSpy(this)) {
this.spy = true;
return true;
}
return false;
}
public void disableSpy() {
this.spy = false;
}
public boolean isShoutVisible() {
return this.shoutVisible;
}
public void showShout() {
this.shoutVisible = true;
}
public void hideShout() {
this.shoutVisible = false;
}
public boolean isHushed() {
return this.hushed;
}
public void hush() {
this.hushed = true;
}
public void unhush() {
this.hushed = false;
}
public Integer[] getBadges() {
return this.badges;
}
public FPlayer getLastMessage() {
if(this.lastMsg == null) {
return null;
}
if(Bukkit.getOfflinePlayer(this.lastMsg).isOnline()) {
return FPlayer.getPlayer(Bukkit.getPlayer(this.lastMsg));
}
return null;
}
public boolean hasPermission(String permission) {
if(isOnline()) {
Player p = offlinePlayer.getPlayer();
return VaultUtil.permission.playerHas(p, permission);
}
return false;
}
public void setPrimaryChannel(String channel) {
this.primaryChannel = channel;
}
public ChatChannel getPrimaryChannel() {
ChatChannel c = ChatChannel.getChannel(this.primaryChannel);
if(c != null) {
return c;
}
c = ChatChannel.getDefault();
this.primaryChannel = c.getName();
return c;
}
public void setPrimaryTempChannel(String channel) {
this.primaryTempChannel = channel;
}
public ChatChannel getPrimaryTempChannel() {
ChatChannel c = ChatChannel.getTempChannel(this.primaryTempChannel);
if(c != null) {
return c;
}
this.tempspeak = false;
return getPrimaryChannel();
}
public boolean speakingInTemp() {
return this.tempspeak;
}
public void speakInTemp() {
this.tempspeak = true;
}
public void stopTempSpeak() {
this.tempspeak = false;
}
public ArrayList<String> getChannels(){
return this.channels;
}
public ArrayList<String> getTempChannels(){
return this.tempchannels;
}
public void sendMessage(String message) {
if(isOnline()) {
Player p = Bukkit.getPlayer(uuid);
p.sendMessage(message);
}
}
public Player getPlayer() {
if(isOnline()) {
return Util.getEP(name);
}
return null;
}
public boolean joinChannel(String channel) {
ChatChannel cc = ChatChannel.getChannel(channel);
if(cc == null) {
cc = ChatChannel.getTempChannel(channel);
}
if(cc == null) {
joinStandardChannel(ChatChannel.getDefault().getName());
FPlayer.errMsg(this, "You tried to join a channel that no longer exists. You have been placed in the default channel instead.");
return false;
}
if(cc.isBanned(this)) {
FPlayer.errMsg(this, "Unable to join. You are blacklisted from this channel.");
return false;
}
if(cc instanceof StandardChannel) {
return joinStandardChannel(cc.getName());
}else if(cc instanceof TempChannel) {
return joinTempChannel(cc.getName());
}
FPlayer.errMsg(this, "An error has occurred. Unable to join channel.");
return false;
}
public boolean joinStandardChannel(String channel) {
ChatChannel cc = ChatChannel.getChannel(channel);
if(cc == null || !(cc instanceof StandardChannel)) {
joinStandardChannel(ChatChannel.getDefault().getName());
FPlayer.errMsg(this, "You tried to join a channel that no longer exists. You have been placed in the default channel instead.");
return false;
}
StandardChannel c = (StandardChannel)cc;
if(!c.whitelistEnabled() || c.isWhitelisted(this)) {
channels.add(channel);
FPlayer.goodMsg(this, "You have joined channel " + ChatColor.YELLOW + cc.getName() + ChatColor.GREEN + ".");
return true;
}else {
FPlayer.errMsg(this, "Unable to join. Channel is whitelisted.");
}
return false;
}
public void leaveChannel(String channel) {
if(ChatChannel.getDefault().getName().equalsIgnoreCase(channel)) {
FPlayer.errMsg(this, "You cannot leave the default channel.");
return;
}
if(getPrimaryChannel().getName().equalsIgnoreCase(channel)) {
setPrimaryChannel(ChatChannel.getDefault().getName());
}
channels.remove(channel);
}
public boolean joinTempChannel(String channel) {
ChatChannel cc = ChatChannel.getTempChannel(channel);
if(cc == null || !(cc instanceof TempChannel)) {
joinStandardChannel(ChatChannel.getDefault().getName());
FPlayer.errMsg(this, "You tried to join a channel that no longer exists. You have been placed in the default channel instead.");
return false;
}
TempChannel c = (TempChannel)cc;
if(!c.whitelistEnabled() || c.isWhitelisted(this)) {
tempchannels.add(channel);
FPlayer.goodMsg(this, "You have joined temporary channel " + ChatColor.YELLOW + cc.getName() + ChatColor.GREEN + ".");
return true;
}else {
FPlayer.errMsg(this, "Unable to join. Channel is whitelisted.");
}
return false;
}
public boolean canJoin(ChatChannel channel) {
if(channel.isBanned(this)) {
return false;
}
if(channel.whitelistEnabled() && !channel.isWhitelisted(this)) {
return false;
}
return true;
}
public void leaveTempChannel(String channel) {
if(getPrimaryTempChannel().getName().equalsIgnoreCase(channel)) {
stopTempSpeak();
this.primaryTempChannel = null;
}
tempchannels.remove(channel);
}
public String formatChat(String msg) {
if(tempspeak) {
return formatChat(getPrimaryTempChannel(),msg);
}
return formatChat(getPrimaryChannel(), msg);
}
public String formatChat(ChatChannel channel, String msg) {
return channel.format(this, msg);
}
public void chat(ChatChannel channel, String msg) {
channel.sendMessage(formatChat(channel,msg), this);
}
public void chat(String msg) {
if(toShout) {
toShout = false;
ChatChannel.getShout().sendMessage(formatChat(ChatChannel.getShout(),msg), this);
if(FPChat.getPlugin().getMainConfig().shoutCooldownEnabled()) {
shoutCooldown = FPChat.getPlugin().getMainConfig().getShoutSeconds();
}
}else if(tempspeak) {
getPrimaryTempChannel().sendMessage(formatChat(getPrimaryTempChannel(),msg), this);
}else {
getPrimaryChannel().sendMessage(formatChat(msg), this);
}
}
public boolean shout(String message) {
if(!hushed && FPChat.getPlugin().getMainConfig().shoutCooldownEnabled() && shoutCooldown > 0) {
int i = shoutCooldown;
String time = " seconds ";
if(i == 1) {
time = " second ";
}
FPlayer.errMsg(this, "You must wait " + Integer.toString(i) + time + "before you can shout again.");
}
if(hushed) {
FPlayer.errMsg(this, "You are hushed.");
}
if(isOnline() && (shoutCooldown == 0 || !FPChat.getPlugin().getMainConfig().shoutCooldownEnabled() ) && !isHushed()) {
if(Permission.canShout(this)) {
Player p = Bukkit.getPlayer(uuid);
toShout = true;
AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(false, p, message, new HashSet<Player>(Bukkit.getOnlinePlayers()));
Bukkit.getPluginManager().callEvent(event);
return true;
}else {
FPlayer.errMsg(this, Permission.noPerm);
}
}
return false;
}
public boolean ignore(FPlayer p) {
if(Permission.isAdmin(p) || Permission.isStaff(p)) {
return false;
}
ignored.add(p.getUniqueId());
return true;
}
public void unignore(FPlayer p) {
ignored.remove(p.getUniqueId());
}
public ArrayList<UUID> getIgnored(){
return ignored;
}
public boolean isIgnoring(FPlayer p) {
if(Permission.isAdmin(p) || Permission.isStaff(p)) {
return false;
}
return this.ignored.contains(p.getUniqueId());
}
public boolean reply(String msg) {
if(getLastMessage() == null) {
sendMessage(FPChat.logo() + ChatColor.RED + "There is nobody currently online who you can reply to.");
return false;
}else {
FPlayer p = getLastMessage();
return sendPM(p,msg);
}
}
public boolean toTalk() {
return this.toTalk;
}
public void setTalk(boolean b) {
toTalk = b;
}
public ChatChannel getTalkChannel() {
return this.talkChannel;
}
public void setTalkChannel(ChatChannel c) {
talkChannel = c;
}
public boolean receivePM(FPlayer from, String msg) {
if(!from.isIgnoring(this)) {
String finalMessage = "";
String stf = "";
if (Permission.canPMColor(from)) {
msg = msg.replaceAll("&([0-9a-fk-or])", "§$1");
} else {
msg = msg.replaceAll("§[0-9a-fk-or]", "");
}
String header = PrepareChat.swapPlaceholders(from, this.getName(), msg, true);
if(Permission.isStaff(from)){
stf = FPChat.getPlugin().getMainConfig().getStaffBadge();
}
String filler = "";
if(FPChat.getPlugin().getMainConfig().chatFilterEnabled()){
filler = "word ";
}
if(Permission.canPMColor(from)){
String last = ChatFilter.filter(filler + msg);
last = BubbleCode.bubblecode(Permission.canBubbleCode(from), Codify.changeFormatSign(last));
finalMessage = stf + header + last;
}else{
String newmsg = ChatColor.stripColor(ChatColor.translateAlternateColorCodes('§', ChatFilter.filter(filler + msg)));
finalMessage = stf + Codify.removeBubbles(header + newmsg);
}
sendMessage(finalMessage);
lastMsg = from.getUniqueId();
return true;
}
return false;
}
public boolean sendPM(FPlayer to, String msg) {
boolean received = to.receivePM(this, msg);
if(to.isOnline() && received) {
String finalMessage = "";
String stf = "";
if (Permission.canPMColor(this)) {
msg = msg.replaceAll("&([0-9a-fk-or])", "§$1");
} else {
msg = msg.replaceAll("§[0-9a-fk-or]", "");
}
String header = PrepareChat.swapPlaceholders(this, to.getName(), msg, false);
if(Permission.isStaff(this)){
stf = FPChat.getPlugin().getMainConfig().getStaffBadge();
}
String filler = "";
if(FPChat.getPlugin().getMainConfig().chatFilterEnabled()){
filler = "word ";
}
if(Permission.canPMColor(this)){
String last = ChatFilter.filter(filler + msg);
last = BubbleCode.bubblecode(Permission.canBubbleCode(this), Codify.changeFormatSign(last));
finalMessage = stf + header + last;
}else{
String newmsg = ChatColor.stripColor(ChatColor.translateAlternateColorCodes('§', ChatFilter.filter(filler + msg)));
finalMessage = stf + Codify.removeBubbles(header + newmsg);
}
lastMsg = to.getUniqueId();
sendMessage(finalMessage);
if(!Permission.isAdmin(this)) {
for(FPlayer p: FPlayer.getPlayers()){
if(p.isSpy()){
p.sendMessage(ChatColor.DARK_GRAY + name + " --> " + to.getName() + ": " + msg);
}
}
}
return true;
}
sendMessage(FPChat.logo() + ChatColor.RED + "The person you are trying to send a message to is either offline or ignoring you.");
return false;
}
public void queueBadgeAdd(int id) {
if(!BadgeGetter.hasBadge(this, id) && !giveBadgeQueue.contains(id)) {
giveBadgeQueue.add(id);
}
}
public void unqueueBadge(Integer id) {
giveBadgeQueue.remove(id);
}
public ArrayList<Integer> getBadgeQueue(){
return this.giveBadgeQueue;
}
public void cleanup() {
String ignorelist = "";
for(UUID id : ignored) {
ignorelist = id.toString() + ",";
}
ignorelist = Util.stripLast(ignorelist);
String chanlist = "";
for(String c : channels) {
if(chanlist.equals("") || !Util.contains(Util.stripLast(chanlist).split(","), c)) {
chanlist = chanlist + c + ",";
}
}
chanlist = Util.stripLast(chanlist);
try {
pfile.saveIgnore(ignorelist);
pfile.saveChannels(chanlist);
pfile.saveCurrentChannel(getPrimaryChannel().getName());
pfile.saveSpy(spy);
pfile.saveHushed(hushed);
} catch (IOException e) {
e.printStackTrace();
}
players.remove(this.uuid);
}
}

View File

@ -0,0 +1,60 @@
package com.fpghoti.fpchatx.util;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.fpghoti.fpchatx.FPChat;
public class Util {
public static void connect(){
if(FPChat.getPlugin().getMySQLConnection().getConnection() == null){
FPChat.getPlugin().getMySQLConnection().reconnect();
}
}
public Player playerGet(String uuid){
UUID id = UUID.fromString(uuid);
Player p = Bukkit.getPlayer(id);
return p;
}
public static String fixCodes(String s){
return s.replaceAll("&", "§");
}
public static Player getEP(String playername){
Player p = null;
for(Player item : Bukkit.getOnlinePlayers()){
if(playername.equalsIgnoreCase(item.getName())){
p = item;
}
}
return p;
}
public static boolean isDigit(String s){
return s.matches("[0-9]+");
}
public static String stripLast(String s) {
if (s.length() != 0) {
s = s.substring(0, s.length()-1);
}
return s;
}
public static Boolean contains(String[] list, String s) {
Boolean check = false;
for(String item: list){
if(item.equals(s)){
check = true;
}
}
return check;
}
}

View File

@ -0,0 +1,52 @@
package com.fpghoti.fpchatx.util;
import org.bukkit.plugin.RegisteredServiceProvider;
import com.fpghoti.fpchatx.FPChat;
import net.milkbowl.vault.chat.Chat;
import net.milkbowl.vault.economy.Economy;
import net.milkbowl.vault.permission.Permission;
public class VaultUtil {
public static Permission permission = null;
public static Economy economy = null;
public static Chat chat = null;
private FPChat plugin;
public VaultUtil(FPChat plugin) {
this.plugin = plugin;
}
public boolean setupPermissions(){
RegisteredServiceProvider<Permission> permissionProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.permission.Permission.class);
if (permissionProvider != null) {
permission = permissionProvider.getProvider();
}
return (permission != null);
}
public boolean setupChat(){
RegisteredServiceProvider<Chat> chatProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.chat.Chat.class);
if (chatProvider != null) {
chat = chatProvider.getProvider();
}
return (chat != null);
}
public boolean setupEconomy(){
RegisteredServiceProvider<Economy> economyProvider = plugin.getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
if (economyProvider != null) {
economy = economyProvider.getProvider();
}
return (economy != null);
}
public Chat getChat() {
return chat;
}
}

View File

@ -0,0 +1,72 @@
name: FPChatX
version: ${project.version}
main: com.fpghoti.fpchatx.FPChat
description: Chat plugin for 1.12+
depend: [Vault]
softdepend: [PlaceholderAPI]
commands:
fpc:
aliases: [fpchat,ch]
description: Main FPChat command
usage: Wrong usage. For help, type /<command> help
shout:
aliases: [fyell, fshout, yell, y]
description: Send a global message to all players
usage: /shout message
spy:
description: Enables listening in on private messages
usage: /spy <on/off>
hush:
description: Disables a user's shout and tempchannel abilities
usage: /<command> player
unhush:
description: Re-enables a user's shout and tempchannel abilities
usage: /<command> player
badgelist:
aliases: [badges]
description: Pulls up a list of badges you own
usage: /<command> page#
badgeequip:
aliases: [equip]
description: equips a badge
usage: /<command> slot# badge#
badgeclear:
aliases: [badgesclear]
description: unequips all badges
usage: /<command>
msg:
aliases: [tell]
description: Starts or ends a private conversation
usage: /<command> player message
reply:
aliases: [r]
description: Replies to a private conversation
usage: /<command> message
ignore:
description: Ignores a player
usage: /<command> player
unignore:
description: Unignores a player.
usage: /<command> player
ignorelist:
description: Shows ignorelist
usage: /<command>
revokebadge:
description: Deletes synced badge in MySQL.
usage: /<command> player badge#
givebadge:
description: Grants player a badge.
usage: /<command> player badge#
shouttoggle:
aliases: [frankoffshout]
description: Toggles ability to see shout.
usage: /<command> player badge#
tempchat:
aliases: [tc]
description: Tempchat main command.
usage: /<command>
talk:
aliases: [tk]
description: Set main channel
usage: /<command> channel