mirror of
https://github.com/ryandw11/UltraChat.git
synced 2025-01-03 06:38:05 +01:00
Compatibility Readded
- Readded support for 1.10 - 1.12!
This commit is contained in:
parent
b270cde4ca
commit
0bff4de494
15
.classpath
Normal file
15
.classpath
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="D:/Spigot Development Dependencies/Spigot 1.13.2/spigot-1.13.2.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Spigot Development Dependencies/Vault.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Spigot Development Dependencies/Spigot 1.10/PlaceholderAPI (1).jar"/>
|
||||
<classpathentry kind="lib" path="D:/Spigot Development Dependencies/1.12/AdvancedBan-2.1.4-RELEASE.jar"/>
|
||||
<classpathentry kind="lib" path="D:/Spigot Development Dependencies/1.12/EssentialsX-2.0.1.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
.project
Normal file
17
.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>UltraChat</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
1
bin/.gitignore
vendored
Normal file
1
bin/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/me/
|
@ -13,7 +13,7 @@ apirestrict: false
|
||||
#Some of the chat formats break the mute function in plugins.
|
||||
#This plugin hooks into ban/mute plugins and allow it to work.
|
||||
#If set to true then the plugin will hook into that plugin.
|
||||
#Suggest more ban plugins here: https://github.com/ryandw11/Ultra-Chat/issues !
|
||||
#Suggest more ban plugins here: https://github.com/ryandw11/UltraChat/issues !
|
||||
#Or ask the ban plugin author.
|
||||
pluginhooks:
|
||||
Essentials: true
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: UltraChat
|
||||
version: 2.2.1
|
||||
version: 2.3.0
|
||||
main: me.ryandw11.ultrachat.UltraChat
|
||||
author: Ryandw11
|
||||
description: A chat formatting plugin.
|
||||
|
@ -21,10 +21,13 @@ import me.ryandw11.ultrachat.formatting.Chat_Json;
|
||||
import me.ryandw11.ultrachat.formatting.Normal;
|
||||
import me.ryandw11.ultrachat.formatting.Range;
|
||||
import me.ryandw11.ultrachat.gui.ColorGUI;
|
||||
import me.ryandw11.ultrachat.gui.ColorGUI_Latest;
|
||||
import me.ryandw11.ultrachat.gui.ColorGUI_Outdated;
|
||||
import me.ryandw11.ultrachat.listner.ConsoleLogChat;
|
||||
import me.ryandw11.ultrachat.listner.JoinListner;
|
||||
import me.ryandw11.ultrachat.listner.NoSwear;
|
||||
import me.ryandw11.ultrachat.listner.Notify;
|
||||
import me.ryandw11.ultrachat.listner.Notify_1_12;
|
||||
import me.ryandw11.ultrachat.listner.Spy;
|
||||
import me.ryandw11.ultrachat.listner.StopChat;
|
||||
import me.ryandw11.ultrachat.pluginhooks.AdvancedBanMute;
|
||||
@ -68,6 +71,8 @@ public class UltraChat extends JavaPlugin{
|
||||
public String prefix;
|
||||
public static YamlConfiguration LANG;
|
||||
public static File LANG_FILE;
|
||||
|
||||
private ColorGUI colorGUI;
|
||||
|
||||
|
||||
|
||||
@ -352,19 +357,46 @@ public class UltraChat extends JavaPlugin{
|
||||
getCommand("sc").setExecutor(new StaffChat());
|
||||
getCommand("sctoggle").setExecutor(new StaffChatToggle());
|
||||
getCommand("spy").setExecutor(new SpyCommand());
|
||||
if(!(plugin.getConfig().getBoolean("ChatColor_Command")))
|
||||
getCommand("color").setExecutor(new ColorGUI());
|
||||
getCommand("channel").setExecutor(new ChannelCmd());
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new StopChat(), this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new NoSwear(), this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Spy(), this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new JoinListner(), this);
|
||||
//Bukkit.getServer().getPluginManager().registerEvents(new Format(this), this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new ColorGUI(), this);
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Notify(), this);
|
||||
if(getConfig().getBoolean("console_log"))
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new ConsoleLogChat(), this);
|
||||
|
||||
loadVersions();
|
||||
}
|
||||
|
||||
private void loadVersions() {
|
||||
String version;
|
||||
|
||||
try {
|
||||
|
||||
version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
|
||||
|
||||
} catch (ArrayIndexOutOfBoundsException w0w) {
|
||||
version = " ";
|
||||
}
|
||||
if (version.equals("v1_13_R2")) {
|
||||
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Notify(), this);
|
||||
colorGUI = new ColorGUI_Latest();
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new ColorGUI_Latest(), this);
|
||||
if(!(plugin.getConfig().getBoolean("ChatColor_Command")))
|
||||
getCommand("color").setExecutor(new ColorGUI_Latest());
|
||||
}else {
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new Notify_1_12(), this);
|
||||
colorGUI = new ColorGUI_Outdated();
|
||||
Bukkit.getServer().getPluginManager().registerEvents(new ColorGUI_Outdated(), this);
|
||||
if(!(plugin.getConfig().getBoolean("ChatColor_Command")))
|
||||
getCommand("color").setExecutor(new ColorGUI_Outdated());
|
||||
getLogger().info("1.12 or below version detected. Activating compatibility mode.");
|
||||
}
|
||||
}
|
||||
|
||||
public ColorGUI getColorGUI() {
|
||||
return colorGUI;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@ package me.ryandw11.ultrachat.commands;
|
||||
import me.ryandw11.ultrachat.UltraChat;
|
||||
import me.ryandw11.ultrachat.api.Lang;
|
||||
import me.ryandw11.ultrachat.api.UltraChatAPI;
|
||||
import me.ryandw11.ultrachat.gui.ColorGUI;
|
||||
import me.ryandw11.ultrachat.gui.ColorGUI_Latest;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -251,7 +251,7 @@ public class ChatCommand implements CommandExecutor {
|
||||
}
|
||||
else if(args.length == 1 && args[0].equalsIgnoreCase("color")){
|
||||
if(p.hasPermission("ultrachat.color")){
|
||||
ColorGUI.openGUI(p.getPlayer());
|
||||
plugin.getColorGUI().openGUI(p.getPlayer());
|
||||
}
|
||||
else{
|
||||
p.sendMessage(Lang.NO_PERM.toString());
|
||||
|
@ -1,355 +1,11 @@
|
||||
package me.ryandw11.ultrachat.gui;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import me.ryandw11.ultrachat.UltraChat;
|
||||
import me.ryandw11.ultrachat.api.Lang;
|
||||
|
||||
/**
|
||||
* ColorGUI class.
|
||||
* Updated for 1.13.
|
||||
* Provides compatibility with older versions.
|
||||
* @author Ryandw11
|
||||
*
|
||||
*/
|
||||
public class ColorGUI implements CommandExecutor, Listener{
|
||||
|
||||
private UltraChat plugin;
|
||||
public ColorGUI(){
|
||||
plugin = UltraChat.plugin;
|
||||
}
|
||||
public static void openGUI(Player p){
|
||||
Inventory i = Bukkit.createInventory(null, 9*2, Lang.COLOR_GUI.toString());
|
||||
|
||||
ItemStack darkblueitem = new ItemStack(Material.BLUE_WOOL);
|
||||
ItemMeta darkbluemeta = darkblueitem.getItemMeta();
|
||||
|
||||
ItemStack greenitem = new ItemStack(Material.GREEN_WOOL);
|
||||
ItemMeta greenmeta = greenitem.getItemMeta();
|
||||
|
||||
ItemStack lightblueitem = new ItemStack(Material.CYAN_WOOL);
|
||||
ItemMeta lightbluemeta = lightblueitem.getItemMeta();
|
||||
|
||||
ItemStack reditem = new ItemStack(Material.RED_WOOL);
|
||||
ItemMeta redmeta = reditem.getItemMeta();
|
||||
|
||||
ItemStack purpleitem = new ItemStack(Material.PURPLE_WOOL);
|
||||
ItemMeta purplemeta = purpleitem.getItemMeta();
|
||||
|
||||
ItemStack golditem = new ItemStack(Material.ORANGE_WOOL);
|
||||
ItemMeta goldmeta = golditem.getItemMeta();
|
||||
|
||||
ItemStack lightgrayitem = new ItemStack(Material.LIGHT_GRAY_WOOL);
|
||||
ItemMeta lightgraymeta = lightgrayitem.getItemMeta();
|
||||
|
||||
ItemStack grayitem = new ItemStack(Material.GRAY_WOOL);
|
||||
ItemMeta graymeta = grayitem.getItemMeta();
|
||||
|
||||
ItemStack blueitem = new ItemStack(Material.LAPIS_BLOCK);
|
||||
ItemMeta bluemeta = blueitem.getItemMeta();
|
||||
|
||||
ItemStack lightgreenitem = new ItemStack(Material.LIME_WOOL);
|
||||
ItemMeta lightgreenmeta = lightgreenitem.getItemMeta();
|
||||
|
||||
ItemStack aquaitem = new ItemStack(Material.LIGHT_BLUE_WOOL);
|
||||
ItemMeta aquameta = aquaitem.getItemMeta();
|
||||
|
||||
ItemStack lightreditem = new ItemStack(Material.PINK_WOOL);
|
||||
ItemMeta lightredmeta = lightreditem.getItemMeta();
|
||||
|
||||
ItemStack pinkitem = new ItemStack(Material.MAGENTA_WOOL);
|
||||
ItemMeta pinkmeta = pinkitem.getItemMeta();
|
||||
|
||||
ItemStack yellowitem = new ItemStack(Material.YELLOW_WOOL);
|
||||
ItemMeta yellowmeta = yellowitem.getItemMeta();
|
||||
|
||||
ItemStack whiteitem = new ItemStack(Material.WHITE_WOOL);
|
||||
ItemMeta whitemeta = whiteitem.getItemMeta();
|
||||
|
||||
//==========================================================
|
||||
|
||||
darkbluemeta.setDisplayName("§1Dark Blue Color Chat");
|
||||
darkblueitem.setItemMeta(darkbluemeta);
|
||||
|
||||
greenmeta.setDisplayName("§2Green Color Chat");
|
||||
greenitem.setItemMeta(greenmeta);
|
||||
|
||||
lightbluemeta.setDisplayName("§3Cyan Color Chat");
|
||||
lightblueitem.setItemMeta(lightbluemeta);
|
||||
|
||||
redmeta.setDisplayName("§4Red Color Chat");
|
||||
reditem.setItemMeta(redmeta);
|
||||
|
||||
purplemeta.setDisplayName("§5Purple Color Chat");
|
||||
purpleitem.setItemMeta(purplemeta);
|
||||
|
||||
goldmeta.setDisplayName("§6Gold Color Chat");
|
||||
golditem.setItemMeta(goldmeta);
|
||||
|
||||
lightgraymeta.setDisplayName("§7Light Gray Color Chat");
|
||||
lightgrayitem.setItemMeta(lightgraymeta);
|
||||
|
||||
graymeta.setDisplayName("§8Gray Color Chat");
|
||||
grayitem.setItemMeta(graymeta);
|
||||
|
||||
bluemeta.setDisplayName("§9Blue Color Chat");
|
||||
blueitem.setItemMeta(bluemeta);
|
||||
|
||||
lightgreenmeta.setDisplayName("§aLight Green Color Chat");
|
||||
lightgreenitem.setItemMeta(lightgreenmeta);
|
||||
|
||||
aquameta.setDisplayName("§bAqua Color Chat");
|
||||
aquaitem.setItemMeta(aquameta);
|
||||
|
||||
lightredmeta.setDisplayName("§cLight Red Color Chat");
|
||||
lightreditem.setItemMeta(lightredmeta);
|
||||
|
||||
pinkmeta.setDisplayName("§dMagenta Color Chat");
|
||||
pinkitem.setItemMeta(pinkmeta);
|
||||
|
||||
yellowmeta.setDisplayName("§eYellow Color Chat");
|
||||
yellowitem.setItemMeta(yellowmeta);
|
||||
|
||||
whitemeta.setDisplayName("§fWhite Color Chat");
|
||||
whiteitem.setItemMeta(whitemeta);
|
||||
//==========================================================
|
||||
|
||||
|
||||
i.setItem(0, darkblueitem);
|
||||
i.setItem(1, greenitem);
|
||||
i.setItem(2, lightblueitem);
|
||||
i.setItem(3, reditem);
|
||||
i.setItem(4, purpleitem);
|
||||
i.setItem(5, golditem);
|
||||
i.setItem(6, lightgrayitem);
|
||||
i.setItem(7, grayitem);
|
||||
i.setItem(8, blueitem);
|
||||
i.setItem(9, lightgreenitem);
|
||||
i.setItem(10, aquaitem);
|
||||
i.setItem(11, lightreditem);
|
||||
i.setItem(12, pinkitem);
|
||||
i.setItem(13, yellowitem);
|
||||
i.setItem(14, whiteitem);
|
||||
|
||||
|
||||
p.openInventory(i);
|
||||
}
|
||||
/*
|
||||
* Command
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
|
||||
if(!(sender instanceof Player)){
|
||||
plugin.getLogger().info("This command is for players only!");
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
if(p.hasPermission("ultrachat.color")){
|
||||
openGUI(p.getPlayer());
|
||||
}
|
||||
else{
|
||||
p.sendMessage(Lang.NO_PERM.toString());
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
/*
|
||||
* Event
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClickEvent(InventoryClickEvent e){
|
||||
if(!e.getInventory().getName().equalsIgnoreCase(Lang.COLOR_GUI.toString())) return;
|
||||
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
e.setCancelled(true);
|
||||
|
||||
if(e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR || !e.getCurrentItem().hasItemMeta()){
|
||||
p.closeInventory();
|
||||
return;
|
||||
}
|
||||
//================
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
||||
switch(item.getType()) {
|
||||
case LAPIS_BLOCK:
|
||||
if(p.hasPermission("ultrachat.color.blue")){
|
||||
p.sendMessage(ChatColor.BLUE + "You choose blue color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&9");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case WHITE_WOOL:
|
||||
p.sendMessage(ChatColor.WHITE + "You choose white color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&f");
|
||||
plugin.saveFile();
|
||||
break;
|
||||
case ORANGE_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.gold")){
|
||||
p.sendMessage(ChatColor.GOLD + "You choose gold color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&6");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGENTA_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.magenta")){
|
||||
p.sendMessage(ChatColor.LIGHT_PURPLE + "You choose magenta color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&d");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case LIGHT_BLUE_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.aqua")){
|
||||
p.sendMessage(ChatColor.AQUA + "You choose Aqua color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&b");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case YELLOW_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.yellow")){
|
||||
p.sendMessage(ChatColor.YELLOW + "You choose yellow color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&e");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
case LIME_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.lightgreen")){
|
||||
p.sendMessage(ChatColor.GREEN + "You choose light green color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&a");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case PINK_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.lightred")){
|
||||
p.sendMessage(ChatColor.RED + "You choose light red color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&c");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case GRAY_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.gray")){
|
||||
p.sendMessage(ChatColor.DARK_GRAY + "You choose gray color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&8");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case LIGHT_GRAY_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.lightgray")){
|
||||
p.sendMessage(ChatColor.GRAY + "You choose light gray color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&7");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case CYAN_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.cyan")){
|
||||
p.sendMessage(ChatColor.DARK_AQUA + "You choose cyan color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&3");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case PURPLE_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.purple")){
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "You choose purple color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&5");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case BLUE_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.darkblue")){
|
||||
p.sendMessage(ChatColor.DARK_BLUE + "You choose dark blue color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&1");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case GREEN_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.green")){
|
||||
p.sendMessage(ChatColor.DARK_GREEN + "You choose green color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&2");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case RED_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.red")){
|
||||
p.sendMessage(ChatColor.DARK_RED + "You choose red color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&4");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
p.sendMessage(ChatColor.WHITE + "You choose white color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&f");
|
||||
plugin.saveFile();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public interface ColorGUI {
|
||||
public void openGUI(Player p);
|
||||
}
|
||||
|
355
src/me/ryandw11/ultrachat/gui/ColorGUI_Latest.java
Normal file
355
src/me/ryandw11/ultrachat/gui/ColorGUI_Latest.java
Normal file
@ -0,0 +1,355 @@
|
||||
package me.ryandw11.ultrachat.gui;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import me.ryandw11.ultrachat.UltraChat;
|
||||
import me.ryandw11.ultrachat.api.Lang;
|
||||
|
||||
/**
|
||||
* ColorGUI class.
|
||||
* Updated for 1.13.
|
||||
* @author Ryandw11
|
||||
*
|
||||
*/
|
||||
public class ColorGUI_Latest implements CommandExecutor, Listener, ColorGUI{
|
||||
|
||||
private UltraChat plugin;
|
||||
public ColorGUI_Latest(){
|
||||
plugin = UltraChat.plugin;
|
||||
}
|
||||
public void openGUI(Player p){
|
||||
Inventory i = Bukkit.createInventory(null, 9*2, Lang.COLOR_GUI.toString());
|
||||
|
||||
ItemStack darkblueitem = new ItemStack(Material.BLUE_WOOL);
|
||||
ItemMeta darkbluemeta = darkblueitem.getItemMeta();
|
||||
|
||||
ItemStack greenitem = new ItemStack(Material.GREEN_WOOL);
|
||||
ItemMeta greenmeta = greenitem.getItemMeta();
|
||||
|
||||
ItemStack lightblueitem = new ItemStack(Material.CYAN_WOOL);
|
||||
ItemMeta lightbluemeta = lightblueitem.getItemMeta();
|
||||
|
||||
ItemStack reditem = new ItemStack(Material.RED_WOOL);
|
||||
ItemMeta redmeta = reditem.getItemMeta();
|
||||
|
||||
ItemStack purpleitem = new ItemStack(Material.PURPLE_WOOL);
|
||||
ItemMeta purplemeta = purpleitem.getItemMeta();
|
||||
|
||||
ItemStack golditem = new ItemStack(Material.ORANGE_WOOL);
|
||||
ItemMeta goldmeta = golditem.getItemMeta();
|
||||
|
||||
ItemStack lightgrayitem = new ItemStack(Material.LIGHT_GRAY_WOOL);
|
||||
ItemMeta lightgraymeta = lightgrayitem.getItemMeta();
|
||||
|
||||
ItemStack grayitem = new ItemStack(Material.GRAY_WOOL);
|
||||
ItemMeta graymeta = grayitem.getItemMeta();
|
||||
|
||||
ItemStack blueitem = new ItemStack(Material.LAPIS_BLOCK);
|
||||
ItemMeta bluemeta = blueitem.getItemMeta();
|
||||
|
||||
ItemStack lightgreenitem = new ItemStack(Material.LIME_WOOL);
|
||||
ItemMeta lightgreenmeta = lightgreenitem.getItemMeta();
|
||||
|
||||
ItemStack aquaitem = new ItemStack(Material.LIGHT_BLUE_WOOL);
|
||||
ItemMeta aquameta = aquaitem.getItemMeta();
|
||||
|
||||
ItemStack lightreditem = new ItemStack(Material.PINK_WOOL);
|
||||
ItemMeta lightredmeta = lightreditem.getItemMeta();
|
||||
|
||||
ItemStack pinkitem = new ItemStack(Material.MAGENTA_WOOL);
|
||||
ItemMeta pinkmeta = pinkitem.getItemMeta();
|
||||
|
||||
ItemStack yellowitem = new ItemStack(Material.YELLOW_WOOL);
|
||||
ItemMeta yellowmeta = yellowitem.getItemMeta();
|
||||
|
||||
ItemStack whiteitem = new ItemStack(Material.WHITE_WOOL);
|
||||
ItemMeta whitemeta = whiteitem.getItemMeta();
|
||||
|
||||
//==========================================================
|
||||
|
||||
darkbluemeta.setDisplayName("§1Dark Blue Color Chat");
|
||||
darkblueitem.setItemMeta(darkbluemeta);
|
||||
|
||||
greenmeta.setDisplayName("§2Green Color Chat");
|
||||
greenitem.setItemMeta(greenmeta);
|
||||
|
||||
lightbluemeta.setDisplayName("§3Cyan Color Chat");
|
||||
lightblueitem.setItemMeta(lightbluemeta);
|
||||
|
||||
redmeta.setDisplayName("§4Red Color Chat");
|
||||
reditem.setItemMeta(redmeta);
|
||||
|
||||
purplemeta.setDisplayName("§5Purple Color Chat");
|
||||
purpleitem.setItemMeta(purplemeta);
|
||||
|
||||
goldmeta.setDisplayName("§6Gold Color Chat");
|
||||
golditem.setItemMeta(goldmeta);
|
||||
|
||||
lightgraymeta.setDisplayName("§7Light Gray Color Chat");
|
||||
lightgrayitem.setItemMeta(lightgraymeta);
|
||||
|
||||
graymeta.setDisplayName("§8Gray Color Chat");
|
||||
grayitem.setItemMeta(graymeta);
|
||||
|
||||
bluemeta.setDisplayName("§9Blue Color Chat");
|
||||
blueitem.setItemMeta(bluemeta);
|
||||
|
||||
lightgreenmeta.setDisplayName("§aLight Green Color Chat");
|
||||
lightgreenitem.setItemMeta(lightgreenmeta);
|
||||
|
||||
aquameta.setDisplayName("§bAqua Color Chat");
|
||||
aquaitem.setItemMeta(aquameta);
|
||||
|
||||
lightredmeta.setDisplayName("§cLight Red Color Chat");
|
||||
lightreditem.setItemMeta(lightredmeta);
|
||||
|
||||
pinkmeta.setDisplayName("§dMagenta Color Chat");
|
||||
pinkitem.setItemMeta(pinkmeta);
|
||||
|
||||
yellowmeta.setDisplayName("§eYellow Color Chat");
|
||||
yellowitem.setItemMeta(yellowmeta);
|
||||
|
||||
whitemeta.setDisplayName("§fWhite Color Chat");
|
||||
whiteitem.setItemMeta(whitemeta);
|
||||
//==========================================================
|
||||
|
||||
|
||||
i.setItem(0, darkblueitem);
|
||||
i.setItem(1, greenitem);
|
||||
i.setItem(2, lightblueitem);
|
||||
i.setItem(3, reditem);
|
||||
i.setItem(4, purpleitem);
|
||||
i.setItem(5, golditem);
|
||||
i.setItem(6, lightgrayitem);
|
||||
i.setItem(7, grayitem);
|
||||
i.setItem(8, blueitem);
|
||||
i.setItem(9, lightgreenitem);
|
||||
i.setItem(10, aquaitem);
|
||||
i.setItem(11, lightreditem);
|
||||
i.setItem(12, pinkitem);
|
||||
i.setItem(13, yellowitem);
|
||||
i.setItem(14, whiteitem);
|
||||
|
||||
|
||||
p.openInventory(i);
|
||||
}
|
||||
/*
|
||||
* Command
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
|
||||
if(!(sender instanceof Player)){
|
||||
plugin.getLogger().info("This command is for players only!");
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
if(p.hasPermission("ultrachat.color")){
|
||||
openGUI(p.getPlayer());
|
||||
}
|
||||
else{
|
||||
p.sendMessage(Lang.NO_PERM.toString());
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
/*
|
||||
* Event
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClickEvent(InventoryClickEvent e){
|
||||
if(!e.getInventory().getName().equalsIgnoreCase(Lang.COLOR_GUI.toString())) return;
|
||||
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
e.setCancelled(true);
|
||||
|
||||
if(e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR || !e.getCurrentItem().hasItemMeta()){
|
||||
p.closeInventory();
|
||||
return;
|
||||
}
|
||||
//================
|
||||
ItemStack item = e.getCurrentItem();
|
||||
|
||||
switch(item.getType()) {
|
||||
case LAPIS_BLOCK:
|
||||
if(p.hasPermission("ultrachat.color.blue")){
|
||||
p.sendMessage(ChatColor.BLUE + "You choose blue color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&9");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case WHITE_WOOL:
|
||||
p.sendMessage(ChatColor.WHITE + "You choose white color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&f");
|
||||
plugin.saveFile();
|
||||
break;
|
||||
case ORANGE_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.gold")){
|
||||
p.sendMessage(ChatColor.GOLD + "You choose gold color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&6");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
case MAGENTA_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.magenta")){
|
||||
p.sendMessage(ChatColor.LIGHT_PURPLE + "You choose magenta color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&d");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case LIGHT_BLUE_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.aqua")){
|
||||
p.sendMessage(ChatColor.AQUA + "You choose Aqua color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&b");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case YELLOW_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.yellow")){
|
||||
p.sendMessage(ChatColor.YELLOW + "You choose yellow color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&e");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
case LIME_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.lightgreen")){
|
||||
p.sendMessage(ChatColor.GREEN + "You choose light green color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&a");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case PINK_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.lightred")){
|
||||
p.sendMessage(ChatColor.RED + "You choose light red color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&c");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case GRAY_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.gray")){
|
||||
p.sendMessage(ChatColor.DARK_GRAY + "You choose gray color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&8");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case LIGHT_GRAY_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.lightgray")){
|
||||
p.sendMessage(ChatColor.GRAY + "You choose light gray color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&7");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case CYAN_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.cyan")){
|
||||
p.sendMessage(ChatColor.DARK_AQUA + "You choose cyan color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&3");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case PURPLE_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.purple")){
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "You choose purple color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&5");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case BLUE_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.darkblue")){
|
||||
p.sendMessage(ChatColor.DARK_BLUE + "You choose dark blue color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&1");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case GREEN_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.green")){
|
||||
p.sendMessage(ChatColor.DARK_GREEN + "You choose green color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&2");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case RED_WOOL:
|
||||
if(p.hasPermission("ultrachat.color.red")){
|
||||
p.sendMessage(ChatColor.DARK_RED + "You choose red color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&4");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
p.sendMessage(ChatColor.WHITE + "You choose white color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&f");
|
||||
plugin.saveFile();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
370
src/me/ryandw11/ultrachat/gui/ColorGUI_Outdated.java
Normal file
370
src/me/ryandw11/ultrachat/gui/ColorGUI_Outdated.java
Normal file
@ -0,0 +1,370 @@
|
||||
package me.ryandw11.ultrachat.gui;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.material.Wool;
|
||||
|
||||
import me.ryandw11.ultrachat.UltraChat;
|
||||
import me.ryandw11.ultrachat.api.Lang;
|
||||
|
||||
/**
|
||||
* ColorGUI class.
|
||||
* Old and outdated. Only in for compatibility.
|
||||
* (When compiling for 1.13+ only it is ok to leave this class out (Just remove references to it in the UltraChat main class))
|
||||
* @author Ryandw11
|
||||
*
|
||||
*/
|
||||
public class ColorGUI_Outdated implements CommandExecutor, Listener, ColorGUI{
|
||||
|
||||
private UltraChat plugin;
|
||||
public ColorGUI_Outdated(){
|
||||
plugin = UltraChat.plugin;
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
public void openGUI(Player p){
|
||||
Inventory i = Bukkit.createInventory(null, 9*2, Lang.COLOR_GUI.toString());
|
||||
|
||||
Wool darkblue = new Wool(DyeColor.BLUE);
|
||||
ItemStack darkblueitem = darkblue.toItemStack(1);
|
||||
ItemMeta darkbluemeta = darkblueitem.getItemMeta();
|
||||
|
||||
Wool green = new Wool(DyeColor.GREEN);
|
||||
ItemStack greenitem = green.toItemStack(1);
|
||||
ItemMeta greenmeta = greenitem.getItemMeta();
|
||||
|
||||
Wool lightblue = new Wool(DyeColor.CYAN);
|
||||
ItemStack lightblueitem = lightblue.toItemStack(1);
|
||||
ItemMeta lightbluemeta = lightblueitem.getItemMeta();
|
||||
|
||||
Wool red = new Wool(DyeColor.RED);
|
||||
ItemStack reditem = red.toItemStack(1);
|
||||
ItemMeta redmeta = reditem.getItemMeta();
|
||||
|
||||
Wool purple = new Wool(DyeColor.PURPLE);
|
||||
ItemStack purpleitem = purple.toItemStack(1);
|
||||
ItemMeta purplemeta = purpleitem.getItemMeta();
|
||||
|
||||
Wool gold = new Wool(DyeColor.ORANGE);
|
||||
ItemStack golditem = gold.toItemStack(1);
|
||||
ItemMeta goldmeta = golditem.getItemMeta();
|
||||
|
||||
ItemStack lightgrayitem = new ItemStack(Material.CLAY);
|
||||
ItemMeta lightgraymeta = lightgrayitem.getItemMeta();
|
||||
|
||||
Wool gray = new Wool(DyeColor.GRAY);
|
||||
ItemStack grayitem = gray.toItemStack(1);
|
||||
ItemMeta graymeta = grayitem.getItemMeta();
|
||||
|
||||
ItemStack blueitem = new ItemStack(Material.LAPIS_BLOCK);
|
||||
ItemMeta bluemeta = blueitem.getItemMeta();
|
||||
|
||||
Wool lightgreen = new Wool(DyeColor.LIME);
|
||||
ItemStack lightgreenitem = lightgreen.toItemStack(1);
|
||||
ItemMeta lightgreenmeta = lightgreenitem.getItemMeta();
|
||||
|
||||
Wool aqua = new Wool(DyeColor.LIGHT_BLUE);
|
||||
ItemStack aquaitem = aqua.toItemStack(1);
|
||||
ItemMeta aquameta = aquaitem.getItemMeta();
|
||||
|
||||
Wool lightred = new Wool(DyeColor.PINK);
|
||||
ItemStack lightreditem = lightred.toItemStack(1);
|
||||
ItemMeta lightredmeta = lightreditem.getItemMeta();
|
||||
|
||||
Wool pink = new Wool(DyeColor.MAGENTA);
|
||||
ItemStack pinkitem = pink.toItemStack(1);
|
||||
ItemMeta pinkmeta = pinkitem.getItemMeta();
|
||||
|
||||
Wool yellow = new Wool(DyeColor.YELLOW);
|
||||
ItemStack yellowitem = yellow.toItemStack(1);
|
||||
ItemMeta yellowmeta = yellowitem.getItemMeta();
|
||||
|
||||
Wool white = new Wool(DyeColor.WHITE);
|
||||
ItemStack whiteitem = white.toItemStack(1);
|
||||
ItemMeta whitemeta = whiteitem.getItemMeta();
|
||||
|
||||
//==========================================================
|
||||
|
||||
darkbluemeta.setDisplayName("§1Dark Blue Color Chat");
|
||||
darkblueitem.setItemMeta(darkbluemeta);
|
||||
|
||||
greenmeta.setDisplayName("§2Green Color Chat");
|
||||
greenitem.setItemMeta(greenmeta);
|
||||
|
||||
lightbluemeta.setDisplayName("§3Cyan Color Chat");
|
||||
lightblueitem.setItemMeta(lightbluemeta);
|
||||
|
||||
redmeta.setDisplayName("§4Red Color Chat");
|
||||
reditem.setItemMeta(redmeta);
|
||||
|
||||
purplemeta.setDisplayName("§5Purple Color Chat");
|
||||
purpleitem.setItemMeta(purplemeta);
|
||||
|
||||
goldmeta.setDisplayName("§6Gold Color Chat");
|
||||
golditem.setItemMeta(goldmeta);
|
||||
|
||||
lightgraymeta.setDisplayName("§7Light Gray Color Chat");
|
||||
lightgrayitem.setItemMeta(lightgraymeta);
|
||||
|
||||
graymeta.setDisplayName("§8Gray Color Chat");
|
||||
grayitem.setItemMeta(graymeta);
|
||||
|
||||
bluemeta.setDisplayName("§9Blue Color Chat");
|
||||
blueitem.setItemMeta(bluemeta);
|
||||
|
||||
lightgreenmeta.setDisplayName("§aLight Green Color Chat");
|
||||
lightgreenitem.setItemMeta(lightgreenmeta);
|
||||
|
||||
aquameta.setDisplayName("§bAqua Color Chat");
|
||||
aquaitem.setItemMeta(aquameta);
|
||||
|
||||
lightredmeta.setDisplayName("§cLight Red Color Chat");
|
||||
lightreditem.setItemMeta(lightredmeta);
|
||||
|
||||
pinkmeta.setDisplayName("§dMagenta Color Chat");
|
||||
pinkitem.setItemMeta(pinkmeta);
|
||||
|
||||
yellowmeta.setDisplayName("§eYellow Color Chat");
|
||||
yellowitem.setItemMeta(yellowmeta);
|
||||
|
||||
whitemeta.setDisplayName("§fWhite Chat");
|
||||
whiteitem.setItemMeta(whitemeta);
|
||||
//==========================================================
|
||||
|
||||
|
||||
i.setItem(0, darkblueitem);
|
||||
i.setItem(1, greenitem);
|
||||
i.setItem(2, lightblueitem);
|
||||
i.setItem(3, reditem);
|
||||
i.setItem(4, purpleitem);
|
||||
i.setItem(5, golditem);
|
||||
i.setItem(6, lightgrayitem);
|
||||
i.setItem(7, grayitem);
|
||||
i.setItem(8, blueitem);
|
||||
i.setItem(9, lightgreenitem);
|
||||
i.setItem(10, aquaitem);
|
||||
i.setItem(11, lightreditem);
|
||||
i.setItem(12, pinkitem);
|
||||
i.setItem(13, yellowitem);
|
||||
i.setItem(14, whiteitem);
|
||||
|
||||
|
||||
p.openInventory(i);
|
||||
}
|
||||
/*
|
||||
* Command
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String s, String[] args) {
|
||||
if(!(sender instanceof Player)){
|
||||
plugin.getLogger().info("This command is for players only!");
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
if(p.hasPermission("ultrachat.color")){
|
||||
openGUI(p.getPlayer());
|
||||
}
|
||||
else{
|
||||
p.sendMessage(Lang.NO_PERM.toString());
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
/*
|
||||
* Event
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClickEvent(InventoryClickEvent e){
|
||||
if(!e.getInventory().getName().equalsIgnoreCase(Lang.COLOR_GUI.toString())) return;
|
||||
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
e.setCancelled(true);
|
||||
|
||||
if(e.getCurrentItem() == null || e.getCurrentItem().getType() == Material.AIR || !e.getCurrentItem().hasItemMeta()){
|
||||
p.closeInventory();
|
||||
return;
|
||||
}
|
||||
//================
|
||||
ItemStack item = e.getCurrentItem();
|
||||
int data = item.getDurability();
|
||||
|
||||
if(item.getType() == Material.LAPIS_BLOCK){
|
||||
if(p.hasPermission("ultrachat.color.blue")){
|
||||
p.sendMessage(ChatColor.BLUE + "You choose blue chat color!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&9");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
}
|
||||
else if(item.getType() == Material.CLAY){
|
||||
if(p.hasPermission("ultrachat.color.lightgray")){
|
||||
p.sendMessage(ChatColor.GRAY + "You choose light gray color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&7");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
switch(data) {
|
||||
case 0:
|
||||
p.sendMessage(ChatColor.WHITE + "You choose white chat color!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&f");
|
||||
plugin.saveFile();
|
||||
break;
|
||||
case 1:
|
||||
if(p.hasPermission("ultrachat.color.gold")){
|
||||
p.sendMessage(ChatColor.GOLD + "You choose gold color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&6");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if(p.hasPermission("ultrachat.color.magenta")){
|
||||
p.sendMessage(ChatColor.LIGHT_PURPLE + "You choose magenta color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&d");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 3:
|
||||
if(p.hasPermission("ultrachat.color.aqua")){
|
||||
p.sendMessage(ChatColor.AQUA + "You choose Aqua color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&b");
|
||||
plugin.saveFile();
|
||||
}
|
||||
else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case 4:
|
||||
if(p.hasPermission("ultrachat.color.yellow")){
|
||||
p.sendMessage(ChatColor.YELLOW + "You choose yellow color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&e");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
if(p.hasPermission("ultrachat.color.lightgreen")){
|
||||
p.sendMessage(ChatColor.GREEN + "You choose light green color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&a");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if(p.hasPermission("ultrachat.color.lightred")){
|
||||
p.sendMessage(ChatColor.RED + "You choose light red color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&c");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if(p.hasPermission("ultrachat.color.gray")){
|
||||
p.sendMessage(ChatColor.DARK_GRAY + "You choose gray color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&8");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if(p.hasPermission("ultrachat.color.cyan")){
|
||||
p.sendMessage(ChatColor.DARK_AQUA + "You choose cyan color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&3");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if(p.hasPermission("ultrachat.color.purple")){
|
||||
p.sendMessage(ChatColor.DARK_PURPLE + "You choose purple color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&5");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
if(p.hasPermission("ultrachat.color.darkblue")){
|
||||
p.sendMessage(ChatColor.DARK_BLUE + "You choose dark blue color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&1");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
if(p.hasPermission("ultrachat.color.green")){
|
||||
p.sendMessage(ChatColor.DARK_GREEN + "You choose green color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&2");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if(p.hasPermission("ultrachat.color.red")){
|
||||
p.sendMessage(ChatColor.DARK_RED + "You choose red color chat!");
|
||||
p.closeInventory();
|
||||
plugin.data.set(p.getUniqueId() + ".color", "&4");
|
||||
plugin.saveFile();
|
||||
}else{
|
||||
p.sendMessage(ChatColor.RED + "You do not have permission for this color!");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
41
src/me/ryandw11/ultrachat/listner/Notify_1_12.java
Normal file
41
src/me/ryandw11/ultrachat/listner/Notify_1_12.java
Normal file
@ -0,0 +1,41 @@
|
||||
package me.ryandw11.ultrachat.listner;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import me.ryandw11.ultrachat.UltraChat;
|
||||
import me.ryandw11.ultrachat.api.JsonChatEvent;
|
||||
import me.ryandw11.ultrachat.api.Lang;
|
||||
|
||||
/**
|
||||
* For 1.12 and below servers.
|
||||
*/
|
||||
public class Notify_1_12 implements Listener {
|
||||
private UltraChat plugin;
|
||||
public Notify_1_12(){
|
||||
plugin = UltraChat.plugin;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onChat(AsyncPlayerChatEvent event){
|
||||
if(plugin.JSON) return;
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
if(event.getMessage().contains("@" + p.getName())){
|
||||
p.sendMessage(Lang.MENTION.toString().replace("%p", event.getPlayer().getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJsonChat(JsonChatEvent e){
|
||||
for(Player p : Bukkit.getOnlinePlayers()){
|
||||
if(e.getMessage().contains("@" + p.getName())){
|
||||
p.sendMessage(Lang.MENTION.toString().replace("%p", e.getPlayer().getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user