Chat fixes, town color fixes, some features #72
3 changed files with 66 additions and 63 deletions
|
@ -1,19 +1,19 @@
|
||||||
package buttondevteam.chat.commands.ucmds.admin;
|
package buttondevteam.chat.commands.ucmds.admin;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.dynmap.towny.DynmapTownyPlugin;
|
|
||||||
|
|
||||||
import buttondevteam.chat.PluginMain;
|
import buttondevteam.chat.PluginMain;
|
||||||
import buttondevteam.lib.chat.Color;
|
import buttondevteam.lib.chat.Color;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.dynmap.towny.DynmapTownyPlugin;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class TownColorCommand extends AdminCommandBase {
|
public class TownColorCommand extends AdminCommandBase {
|
||||||
@Override
|
@Override
|
||||||
public String GetHelpText(String alias)[] { // TODO: Command path aliases
|
public String GetHelpText(String alias)[] { // TODO: Command path aliases
|
||||||
return new String[] { //
|
return new String[]{ //
|
||||||
"§6---- Town Color ----", //
|
"§6---- Town Color ----", //
|
||||||
"This command allows setting a color for a town.", //
|
"This command allows setting a color for a town.", //
|
||||||
"The town will be shown with this color on Dynmap and all players in the town will appear in chat with these colors.", //
|
"The town will be shown with this color on Dynmap and all players in the town will appear in chat with these colors.", //
|
||||||
|
@ -41,6 +41,7 @@ public class TownColorCommand extends AdminCommandBase {
|
||||||
val c = Arrays.stream(Color.values()).filter(cc -> cc.getName().equalsIgnoreCase(args[ii])).findAny();
|
val c = Arrays.stream(Color.values()).filter(cc -> cc.getName().equalsIgnoreCase(args[ii])).findAny();
|
||||||
if (!c.isPresent()) {
|
if (!c.isPresent()) {
|
||||||
sender.sendMessage("§cThe color '" + args[i] + "' cannot be found.");
|
sender.sendMessage("§cThe color '" + args[i] + "' cannot be found.");
|
||||||
|
sender.sendMessage("§cAvailable colors: " + Arrays.stream(Color.values()).map(Color::getName).collect(Collectors.joining(", ")));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
clrs[i - 1] = c.get();
|
clrs[i - 1] = c.get();
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
package buttondevteam.chat.listener;
|
package buttondevteam.chat.listener;
|
||||||
|
|
||||||
import java.util.Timer;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
|
||||||
|
|
||||||
import com.earth2me.essentials.Essentials;
|
|
||||||
|
|
||||||
import buttondevteam.chat.ChatPlayer;
|
import buttondevteam.chat.ChatPlayer;
|
||||||
import buttondevteam.chat.FlairStates;
|
import buttondevteam.chat.FlairStates;
|
||||||
import buttondevteam.chat.PlayerJoinTimerTask;
|
import buttondevteam.chat.PlayerJoinTimerTask;
|
||||||
|
@ -18,6 +8,15 @@ import buttondevteam.chat.commands.UnlolCommand;
|
||||||
import buttondevteam.lib.player.TBMCPlayerJoinEvent;
|
import buttondevteam.lib.player.TBMCPlayerJoinEvent;
|
||||||
import buttondevteam.lib.player.TBMCPlayerLoadEvent;
|
import buttondevteam.lib.player.TBMCPlayerLoadEvent;
|
||||||
import buttondevteam.lib.player.TBMCPlayerSaveEvent;
|
import buttondevteam.lib.player.TBMCPlayerSaveEvent;
|
||||||
|
import com.earth2me.essentials.Essentials;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
|
||||||
public class PlayerJoinLeaveListener implements Listener {
|
public class PlayerJoinLeaveListener implements Listener {
|
||||||
|
|
||||||
|
@ -46,9 +45,7 @@ public class PlayerJoinLeaveListener implements Listener {
|
||||||
tt.mp = cp;
|
tt.mp = cp;
|
||||||
timer.schedule(tt, 1000);
|
timer.schedule(tt, 1000);
|
||||||
} else {
|
} else {
|
||||||
if (cp.FlairTime().get() == 0x00)
|
/*Timer timer = new Timer();
|
||||||
cp.SetFlair(ChatPlayer.FlairTimeNone);
|
|
||||||
Timer timer = new Timer();
|
|
||||||
PlayerJoinTimerTask tt = new PlayerJoinTimerTask() {
|
PlayerJoinTimerTask tt = new PlayerJoinTimerTask() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,10 +67,13 @@ public class PlayerJoinLeaveListener implements Listener {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
tt.mp = cp;
|
tt.mp = cp;
|
||||||
timer.schedule(tt, 15 * 1000);
|
timer.schedule(tt, 15 * 1000);*/ //TODO: Better Reddit integration (OAuth)
|
||||||
}
|
}
|
||||||
|
|
||||||
String nwithoutformatting = PluginMain.essentials.getUser(p).getNickname();
|
String nwithoutformatting = PluginMain.essentials.getUser(p).getNickname();
|
||||||
|
|
||||||
|
p.setDisplayName();
|
||||||
|
|
||||||
int index;
|
int index;
|
||||||
if (nwithoutformatting != null) {
|
if (nwithoutformatting != null) {
|
||||||
while ((index = nwithoutformatting.indexOf("§k")) != -1)
|
while ((index = nwithoutformatting.indexOf("§k")) != -1)
|
||||||
|
|
|
@ -79,7 +79,9 @@ public class PlayerListener implements Listener {
|
||||||
else
|
else
|
||||||
mp = null;
|
mp = null;
|
||||||
String cmd = "";
|
String cmd = "";
|
||||||
if (index == -1 && (sender instanceof Player || sender instanceof ConsoleCommandSender)) { // Only the command is run
|
if (index == -1) { // Only the command is run
|
||||||
|
if (!(sender instanceof Player || sender instanceof ConsoleCommandSender))
|
||||||
|
return false;
|
||||||
// ^^ We can only store player or console channels - Directly sending to channels would still work if they had an event
|
// ^^ We can only store player or console channels - Directly sending to channels would still work if they had an event
|
||||||
cmd = sender instanceof ConsoleCommandSender ? message : message.substring(1);
|
cmd = sender instanceof ConsoleCommandSender ? message : message.substring(1);
|
||||||
for (Channel channel : Channel.getChannels()) {
|
for (Channel channel : Channel.getChannels()) {
|
||||||
|
|
Loading…
Reference in a new issue