Fixed channels a bit
This commit is contained in:
parent
9a61047cd2
commit
f5ce88faf6
3 changed files with 18 additions and 27 deletions
|
@ -1,21 +1,16 @@
|
||||||
package buttondevteam.core;
|
package buttondevteam.core;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scoreboard.Scoreboard;
|
|
||||||
|
|
||||||
import com.palmergames.bukkit.towny.Towny;
|
|
||||||
import com.palmergames.bukkit.towny.object.Nation;
|
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
|
||||||
import com.palmergames.bukkit.towny.object.TownyUniverse;
|
|
||||||
|
|
||||||
import buttondevteam.lib.TBMCCoreAPI;
|
import buttondevteam.lib.TBMCCoreAPI;
|
||||||
|
import buttondevteam.lib.chat.Channel;
|
||||||
|
import buttondevteam.lib.chat.Color;
|
||||||
import buttondevteam.lib.chat.TBMCChatAPI;
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
import buttondevteam.lib.chat.Channel.RecipientTestResult;
|
||||||
import buttondevteam.lib.player.TBMCPlayerBase;
|
import buttondevteam.lib.player.TBMCPlayerBase;
|
||||||
import net.milkbowl.vault.permission.Permission;
|
import net.milkbowl.vault.permission.Permission;
|
||||||
|
|
||||||
|
@ -40,7 +35,15 @@ public class MainPlugin extends JavaPlugin {
|
||||||
TBMCChatAPI.AddCommand(this, ScheduledRestartCommand.class);
|
TBMCChatAPI.AddCommand(this, ScheduledRestartCommand.class);
|
||||||
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
TBMCCoreAPI.RegisterEventsForExceptions(new PlayerListener(), this);
|
||||||
TBMCCoreAPI.RegisterUserClass(TBMCPlayerBase.class);
|
TBMCCoreAPI.RegisterUserClass(TBMCPlayerBase.class);
|
||||||
logger.info(pdfFile.getName() + " has been Enabled (V." + pdfFile.getVersion() + ").");
|
TBMCChatAPI.RegisterChatChannel(Channel.GlobalChat = new Channel("§fg§f", Color.White, "g", null));
|
||||||
|
TBMCChatAPI.RegisterChatChannel(
|
||||||
|
Channel.AdminChat = new Channel("§cADMIN§f", Color.Red, "a", s -> s.isOp() ? new RecipientTestResult(0)
|
||||||
|
: new RecipientTestResult("You need to be an admin to use this channel.")));
|
||||||
|
TBMCChatAPI.RegisterChatChannel(Channel.ModChat = new Channel("§9MOD§f", Color.Blue, "mod",
|
||||||
|
s -> s.isOp() || (s instanceof Player && MainPlugin.permission.playerInGroup((Player) s, "mod"))
|
||||||
|
? new RecipientTestResult(0) //
|
||||||
|
: new RecipientTestResult("You need to be a mod to use this channel.")));
|
||||||
|
logger.info(pdfFile.getName() + " has been Enabled (V." + pdfFile.getVersion() + ") Test: " + Test + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,6 +11,10 @@ import org.mockito.Mockito;
|
||||||
import org.mockito.invocation.InvocationOnMock;
|
import org.mockito.invocation.InvocationOnMock;
|
||||||
import org.mockito.stubbing.Answer;
|
import org.mockito.stubbing.Answer;
|
||||||
|
|
||||||
|
import buttondevteam.lib.chat.Channel;
|
||||||
|
import buttondevteam.lib.chat.Color;
|
||||||
|
import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
|
|
||||||
public class TestPrepare {
|
public class TestPrepare {
|
||||||
public static void PrepareServer() {
|
public static void PrepareServer() {
|
||||||
Bukkit.setServer(Mockito.mock(Server.class, new Answer<Object>() {
|
Bukkit.setServer(Mockito.mock(Server.class, new Answer<Object>() {
|
||||||
|
@ -34,5 +38,6 @@ public class TestPrepare {
|
||||||
return cl.isAssignableFrom(invocation.getMethod().getReturnType());
|
return cl.isAssignableFrom(invocation.getMethod().getReturnType());
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
TBMCChatAPI.RegisterChatChannel(Channel.GlobalChat = new Channel("§fg§f", Color.White, "g", null));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,6 @@ import java.util.function.Function;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
|
|
||||||
import com.palmergames.bukkit.towny.object.Nation;
|
|
||||||
import com.palmergames.bukkit.towny.object.Resident;
|
|
||||||
import com.palmergames.bukkit.towny.object.Town;
|
|
||||||
|
|
||||||
import buttondevteam.core.MainPlugin;
|
|
||||||
|
|
||||||
public class Channel {
|
public class Channel {
|
||||||
public final String DisplayName;
|
public final String DisplayName;
|
||||||
|
@ -46,16 +39,6 @@ public class Channel {
|
||||||
this.filteranderrormsg = filteranderrormsg;
|
this.filteranderrormsg = filteranderrormsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
RegisterChannel(GlobalChat = new Channel("§fg§f", Color.White, "g", null));
|
|
||||||
RegisterChannel(AdminChat = new Channel("§cADMIN§f", Color.Red, "a", s -> s.isOp() ? new RecipientTestResult(0)
|
|
||||||
: new RecipientTestResult("You need to be an admin to use this channel.")));
|
|
||||||
RegisterChannel(ModChat = new Channel("§9MOD§f", Color.Blue, "mod",
|
|
||||||
s -> s.isOp() || (s instanceof Player && MainPlugin.permission.playerInGroup((Player) s, "mod"))
|
|
||||||
? new RecipientTestResult(0) //
|
|
||||||
: new RecipientTestResult("You need to be a mod to use this channel.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Channel> getChannels() {
|
public static List<Channel> getChannels() {
|
||||||
return channels;
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue