mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:39:05 +00:00
Merge branch 'master' into build-system
# Conflicts: # src/main/java/mineverse/Aust1n46/chat/MineverseChat.java # src/main/java/mineverse/Aust1n46/chat/listeners/ChatListener.java # src/main/java/mineverse/Aust1n46/chat/listeners/CommandListener.java # src/main/java/mineverse/Aust1n46/chat/utilities/Format.java # src/main/resources/config.yml # src/main/resources/example_config_always_up_to_date!.yml # src/main/resources/plugin.yml # src/mineverse/Aust1n46/chat/channel/ChatChannel.java # src/mineverse/Aust1n46/chat/command/VentureCommandExecutor.java # src/mineverse/Aust1n46/chat/command/chat/Chatreload.java
This commit is contained in:
commit
94aa22d89a
@ -13,6 +13,7 @@ import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
|||||||
import mineverse.Aust1n46.chat.utilities.Format;
|
import mineverse.Aust1n46.chat.utilities.Format;
|
||||||
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
import mineverse.Aust1n46.chat.versions.VersionHandler;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -38,6 +39,10 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) throws FileNotFoundException {
|
public void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) throws FileNotFoundException {
|
||||||
|
if(event.getPlayer() == null) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - Event.getPlayer() returned null in PlayerCommandPreprocessEvent"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("commandspy");
|
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("commandspy");
|
||||||
Boolean wec = cs.getBoolean("worldeditcommands", true);
|
Boolean wec = cs.getBoolean("worldeditcommands", true);
|
||||||
MineverseChatPlayer mcp = MineverseChatAPI.getOnlineMineverseChatPlayer(event.getPlayer());
|
MineverseChatPlayer mcp = MineverseChatAPI.getOnlineMineverseChatPlayer(event.getPlayer());
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name: VentureChat
|
name: VentureChat
|
||||||
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
|
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
|
||||||
version: 2.23.0
|
version: 2.23.3
|
||||||
author: Aust1n46
|
author: Aust1n46
|
@ -1,3 +1,4 @@
|
|||||||
|
<<<<<<< HEAD:src/main/resources/config.yml
|
||||||
#===============================================================
|
#===============================================================
|
||||||
# VentureChat Config =
|
# VentureChat Config =
|
||||||
# Author: Aust1n46 =
|
# Author: Aust1n46 =
|
||||||
@ -420,4 +421,429 @@ channels:
|
|||||||
alias: l
|
alias: l
|
||||||
permissions: None
|
permissions: None
|
||||||
speak_permissions: None
|
speak_permissions: None
|
||||||
|
=======
|
||||||
|
#===============================================================
|
||||||
|
# VentureChat Config =
|
||||||
|
# Author: Aust1n46 =
|
||||||
|
#===============================================================
|
||||||
|
|
||||||
|
# - regex1,regex2
|
||||||
|
# Simple regex tips: Use \b to "cut" a section of the word or phrase. Example: \bass,donuts
|
||||||
|
# Example filtered sentence: You are an ass. Will become: You are an donuts.
|
||||||
|
# Example filtered sentence: You caught a bass. Will stay: You caught a bass.
|
||||||
|
# Example filtered sentence: You are an asshole. Will become: You are an donutshole.
|
||||||
|
# Default filters by Jabelpeeps
|
||||||
|
filters:
|
||||||
|
- (\b.?anus),donuts
|
||||||
|
- (\ba+r*(se+|ss+(?!(ass|um|oc|ign|ist)).*?|s*e*h+[o0]*[l1]+e*[sz]*)\b),donuts
|
||||||
|
- (b[i1]a?tch(es)?),puppy
|
||||||
|
- Carpet Muncher,cookie monster
|
||||||
|
- (\bc((?!ook\b)[o0]+c*|aw)k\W?(sucker|s*|he[ea]*d)\b),rooster
|
||||||
|
- (\b[ck]r+a+p+(er|s|z)?\b),poopoo
|
||||||
|
- (\bcu+m+\b),go
|
||||||
|
- (\b.?[ck](u*n+|[l1]+[i1]+)t+[sz]*\b),peach
|
||||||
|
- (\b.?d[1i](c?k(head)?|[l1]+d[o0])e?[sz]?\b),rooster
|
||||||
|
- f u c k( e r)?,nono
|
||||||
|
- (\b.?fai*g+[oei1]*t*[sz]*\b),cigar
|
||||||
|
- Fudge Packer,fine person
|
||||||
|
- (\b(m[uo]+th[ae]r?)?(f|ph)uc*k*(e[rn]|ah*|ing?|)[sz]?\b),oh dear
|
||||||
|
- (\b(j(ac|er|ur)k\W?(of+))|(ji[sz]+i*m*)\b),bake brownies
|
||||||
|
- (\b(ma+s+te?rbai?te?[rs]?|wank(er)?[sz]?)\b),bake brownies
|
||||||
|
- orafi(s|ce),rooster
|
||||||
|
- (\bp+[e3]+[ai]*n+[i1!ua]+s+),rooster
|
||||||
|
- (\bp[i1]s+(?!(ton))(flap|face|drop)?),peepee
|
||||||
|
- (\b.?sh[i1!y]t+(er?|y|head)?[sz]*),poopoo
|
||||||
|
- (\bva[1i]?[gj]+[i1]+na+\b),peach
|
||||||
|
- vu[1l]+va,peach
|
||||||
|
- planet.?minecraft,another dimension
|
||||||
|
- pmc,another dimension
|
||||||
|
- ((\d+\.){3}\d+),another dimension
|
||||||
|
|
||||||
|
# command without the /
|
||||||
|
blockablecommands:
|
||||||
|
- vote
|
||||||
|
- me
|
||||||
|
|
||||||
|
# blacklisted nicknames
|
||||||
|
nicknames:
|
||||||
|
- Notch
|
||||||
|
|
||||||
|
nickname-in-tablist: true
|
||||||
|
|
||||||
|
# {player} : player sending command
|
||||||
|
# {command} : command typed
|
||||||
|
commandspy:
|
||||||
|
format: '&6{player}: {command}'
|
||||||
|
worldeditcommands: true
|
||||||
|
|
||||||
|
antispam:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# Number of messages to be spam
|
||||||
|
spamnumber: 5
|
||||||
|
|
||||||
|
# Amount of time in seconds for it to be spam
|
||||||
|
spamtime: 10
|
||||||
|
|
||||||
|
# Amount of time for the mute to last
|
||||||
|
# Acceptable units are: d,h,m,s
|
||||||
|
# Units can be combined, for example: 1d8h30m15s
|
||||||
|
# Use 0 for untimed mute
|
||||||
|
mutetime: 10m
|
||||||
|
|
||||||
|
# Logging chat and commands to a mysql database
|
||||||
|
mysql:
|
||||||
|
enabled: false
|
||||||
|
user: User
|
||||||
|
port: 3306
|
||||||
|
password: Password
|
||||||
|
host: localhost
|
||||||
|
database: Database
|
||||||
|
|
||||||
|
# Loglevel feature is still in the works for adding of debug messages
|
||||||
|
# Valid loglevels:
|
||||||
|
# Info: Regular logging
|
||||||
|
# Debug: Show extra messages and caught errors for debugging
|
||||||
|
# Severe: Only show severe messages
|
||||||
|
loglevel: info
|
||||||
|
|
||||||
|
# saveinterval is in minutes
|
||||||
|
saveinterval: 30
|
||||||
|
|
||||||
|
# If you're running a "cracked" server, player data might not be stored properly, and thus, you are on your own.
|
||||||
|
# If you run your server in offline mode, you might have to reset your player data when switching to online mode!
|
||||||
|
# If you see this warning by accident and you are using BungeeCord, make sure you have properly setup IP Forwarding.
|
||||||
|
# https://www.spigotmc.org/wiki/bungeecord-ip-forwarding/
|
||||||
|
# No player data will be saved in offline mode unless you set this acknowledgement to 'true'
|
||||||
|
offline_server_acknowledgement: false
|
||||||
|
|
||||||
|
# The time in seconds between each check to remove timed mutes
|
||||||
|
unmuteinterval: 60
|
||||||
|
|
||||||
|
# Enables or disabled BungeeCord messaging
|
||||||
|
bungeecordmessaging: false
|
||||||
|
|
||||||
|
# Sound for message notification
|
||||||
|
# Enter 'None' to disable the sound
|
||||||
|
message_sound: ENTITY_PLAYER_LEVELUP
|
||||||
|
|
||||||
|
# This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online
|
||||||
|
vanishsupport: true
|
||||||
|
|
||||||
|
# Use PlaceholderAPI placeholders
|
||||||
|
# Start the placeholder with 'sender_' for the sending players placeholder
|
||||||
|
# Start the placeholder with 'receiver_' for the receiving players placeholder
|
||||||
|
# The defaults shown below provide an example of each
|
||||||
|
tellformatto: '&7You message {receiver_vault_prefix}{receiver_player_displayname}&7:'
|
||||||
|
tellformatfrom: '{sender_vault_prefix}{sender_player_displayname} &7messages you:'
|
||||||
|
tellformatspy: '{sender_player_name} messages {receiver_player_name}:&7'
|
||||||
|
replyformatto: '&7You reply to {receiver_vault_prefix}{receiver_player_displayname}&7:'
|
||||||
|
replyformatfrom: '{sender_vault_prefix}{sender_player_displayname} &7replies to you:'
|
||||||
|
replyformatspy: '{sender_player_name} replies to {receiver_player_name}:&7'
|
||||||
|
|
||||||
|
# {host} : party hosts name
|
||||||
|
# {player} : player name
|
||||||
|
# use Default for the basic formatting
|
||||||
|
partyformat: Default
|
||||||
|
|
||||||
|
formatcleaner: true
|
||||||
|
|
||||||
|
# If true, /ignore will block chat from the ignored player as well as PM's
|
||||||
|
ignorechat: false
|
||||||
|
|
||||||
|
# The message shown to players alerting them no one is in the channel to hear them
|
||||||
|
emptychannelalert: "&6No one is listening to you."
|
||||||
|
|
||||||
|
messageremoverpermissions: '&cYou need additional permissions to view this message!'
|
||||||
|
messageremovertext: '&c&o<message removed>'
|
||||||
|
|
||||||
|
# The name of the group is the permissions node for the format
|
||||||
|
# Example: venturechat.json.Owner is the node for the group Owner
|
||||||
|
# A lower priority overrides a higher priority if a player has more than 1 group
|
||||||
|
# Possible options for click_name and click_prefix are suggest_command, run_command, and open_url
|
||||||
|
jsonformatting:
|
||||||
|
Default: # This default format is required! Do not delete or rename it!
|
||||||
|
priority: 2147483647 # Integer.MAX_VALUE
|
||||||
|
hover_name:
|
||||||
|
- '&6I have no rank!'
|
||||||
|
click_name: 'suggest_command'
|
||||||
|
click_name_text: '/msg {player_name}'
|
||||||
|
hover_prefix:
|
||||||
|
- '&dI am default!'
|
||||||
|
click_prefix: 'run_command'
|
||||||
|
click_prefix_text: '/help'
|
||||||
|
hover_suffix:
|
||||||
|
- '&dI am default suffix!'
|
||||||
|
click_suffix: 'suggest_command'
|
||||||
|
click_suffix_text: '/msg {player_name}'
|
||||||
|
Owner:
|
||||||
|
priority: 1 # Lowest Priority
|
||||||
|
hover_name:
|
||||||
|
- '&cOwner of the server!'
|
||||||
|
- '&bMessage me for help!'
|
||||||
|
click_name: 'suggest_command'
|
||||||
|
click_name_text: '/msg {player_name}'
|
||||||
|
hover_prefix:
|
||||||
|
- '&dServer Owner'
|
||||||
|
click_prefix: 'run_command'
|
||||||
|
click_prefix_text: '/help'
|
||||||
|
hover_suffix:
|
||||||
|
- '&dI am Owner suffix!'
|
||||||
|
click_suffix: 'suggest_command'
|
||||||
|
click_suffix_text: '/msg {player_name}'
|
||||||
|
|
||||||
|
# The icon is the block shown in the GUI
|
||||||
|
# The text is the display name of the block icon
|
||||||
|
# Include a slash (/) before the command
|
||||||
|
# Permissions are the name of the button and automatically include "venturechat."
|
||||||
|
# Example: mute equals venturechat.mute
|
||||||
|
venturegui:
|
||||||
|
mute:
|
||||||
|
icon: 'REDSTONE_BLOCK'
|
||||||
|
durability: 0
|
||||||
|
text: '&cMute {player_name} &410m'
|
||||||
|
permission: 'mute'
|
||||||
|
command: '/mute {channel} {player_name} 10m'
|
||||||
|
slot: 1
|
||||||
|
unmute:
|
||||||
|
icon: 'DIAMOND_BLOCK'
|
||||||
|
durability: 0
|
||||||
|
text: '&bUnmute {player_name}'
|
||||||
|
permission: 'mute'
|
||||||
|
command: '/unmute {channel} {player_name} '
|
||||||
|
slot: 2
|
||||||
|
removemessage:
|
||||||
|
icon: 'DIAMOND_AXE'
|
||||||
|
durability: 0
|
||||||
|
text: '&cRemove Message'
|
||||||
|
permission: 'removemessage'
|
||||||
|
command: '/removemessage {hash} {channel}'
|
||||||
|
slot: 7
|
||||||
|
|
||||||
|
guiicon: '&c [✓]'
|
||||||
|
guitext: '&cOpen Moderation GUI'
|
||||||
|
guirows: 1
|
||||||
|
|
||||||
|
# All clickable URL's will be underlined if set to true
|
||||||
|
underlineurls: true
|
||||||
|
|
||||||
|
# broadcast information
|
||||||
|
broadcast:
|
||||||
|
color: red
|
||||||
|
permissions: venturechat.adminchannel
|
||||||
|
displaytag: '[Broadcast]'
|
||||||
|
|
||||||
|
# Use $ to include arguments into the message
|
||||||
|
# Valid component types are:
|
||||||
|
# Command: Sends a message or command in chat
|
||||||
|
# Message: Sends a message to the player
|
||||||
|
# Broadcast: Sends a broadcast to all players on the server
|
||||||
|
# Permissions automatically include "venturechat."
|
||||||
|
# Example: permissions: alert equals venturechat.alert
|
||||||
|
# Use None for no permissions
|
||||||
|
# The number of arguments is the minimum number of required arguments, use 0 for no required arguments
|
||||||
|
alias:
|
||||||
|
vote:
|
||||||
|
arguments: 0
|
||||||
|
permissions: None
|
||||||
|
components:
|
||||||
|
- 'Message: &6Vote here: www.votelinkhere.com'
|
||||||
|
bane:
|
||||||
|
arguments: 2
|
||||||
|
permissions: bane
|
||||||
|
components:
|
||||||
|
- 'Command: /ban $ appeal at www.site.com'
|
||||||
|
- 'Command: /st banned $'
|
||||||
|
alert:
|
||||||
|
arguments: 1
|
||||||
|
permissions: alert
|
||||||
|
components:
|
||||||
|
- 'Broadcast: &c<Alert> $'
|
||||||
|
donate:
|
||||||
|
arguments: 0
|
||||||
|
permissions: None
|
||||||
|
components:
|
||||||
|
- 'Message: &bDonate here: www.mywebsite.com'
|
||||||
|
website:
|
||||||
|
arguments: 0
|
||||||
|
permissions: None
|
||||||
|
components:
|
||||||
|
- 'Message: &aThis is our website: www.site.net'
|
||||||
|
|
||||||
|
# Enables the creation of special Towny channels: Town and Nation
|
||||||
|
# To create these channels, simply name two channels below "Town" and "Nation"
|
||||||
|
# Bungeecord must be set to false for these channels!
|
||||||
|
enable_towny_channel: false
|
||||||
|
|
||||||
|
# Enables the creation of a special faction only channel using the Factions plugin
|
||||||
|
# To create this channel, simply name a channel below "Faction"
|
||||||
|
# Bungeecord must be set to false for this channel!
|
||||||
|
# WARNING: May not work for all versions of Factions!
|
||||||
|
enable_factions_channel: false
|
||||||
|
|
||||||
|
# color = [channel] color
|
||||||
|
# chatcolor = text color
|
||||||
|
# cooldown is in seconds
|
||||||
|
# bungeecord overrides distance
|
||||||
|
# channel permissions are configurable
|
||||||
|
# channels can be changed, and new channels can be created
|
||||||
|
# Permissions automatically include "venturechat."
|
||||||
|
# Example: permissions: staff equals venturechat.staff
|
||||||
|
# Use None for no permissions
|
||||||
|
|
||||||
|
# Use PlaceholderAPI placeholders are required!!!
|
||||||
|
# Use PlaceholderAPI placeholders are required!!!
|
||||||
|
# Use PlaceholderAPI placeholders are required!!!
|
||||||
|
# /papi ecloud download [plugin]
|
||||||
|
# /papi reload
|
||||||
|
# Use '' or "" around format, example: '[&2global&f] {vault_prefix} {player_displayname}&2:'
|
||||||
|
# You must have prefixes and suffixes set in a Vault compatible permissions plugin to avoid errors
|
||||||
|
# Use "" as the prefix or suffix to have none
|
||||||
|
|
||||||
|
# Set chatcolor to 'None' to have a group based chat color! Don't forget to put a suffix or other placeholder at the end of the format!
|
||||||
|
|
||||||
|
# Important!!!
|
||||||
|
# Important!!!
|
||||||
|
# If you delete a channel, restart the server! Do not use /chatreload!!!
|
||||||
|
channels:
|
||||||
|
GroupChatColorExample:
|
||||||
|
color: '#706C1E'
|
||||||
|
chatcolor: 'None'
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: ge
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[#706C1EGroupColorChat&f] {vault_prefix} {player_displayname}#706C1E:{vault_suffix}'
|
||||||
|
HexExample:
|
||||||
|
color: '#ff0000'
|
||||||
|
chatcolor: '#ff0000'
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: he
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[#ff0000Hex&f] {vault_prefix} {player_displayname}#ff0000:'
|
||||||
|
BungeeExample:
|
||||||
|
color: gold
|
||||||
|
chatcolor: gold
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 3
|
||||||
|
bungeecord: true
|
||||||
|
alias: be
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&6Network&f] {vault_prefix} {player_displayname}&6:'
|
||||||
|
AnnouncementExample:
|
||||||
|
color: red
|
||||||
|
chatcolor: red
|
||||||
|
mutable: false
|
||||||
|
filter: false
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: true
|
||||||
|
alias: announce
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: announcement
|
||||||
|
format: '&f[&aServer Announcement&f] {vault_prefix} {player_displayname}&c:'
|
||||||
|
Global:
|
||||||
|
color: dark_green
|
||||||
|
chatcolor: dark_green
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: true
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: g
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&2Global&f] {vault_prefix} {player_displayname}&2:'
|
||||||
|
Staff:
|
||||||
|
color: green
|
||||||
|
chatcolor: green
|
||||||
|
mutable: false
|
||||||
|
filter: false
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: st
|
||||||
|
permissions: staffchannel
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&aStaff&f] {vault_prefix} {player_displayname}&a:'
|
||||||
|
Donator:
|
||||||
|
color: light_purple
|
||||||
|
chatcolor: light_purple
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: d
|
||||||
|
permissions: donatorchannel
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&dDonator&f] {vault_prefix} {player_displayname}&d:'
|
||||||
|
Help:
|
||||||
|
color: aqua
|
||||||
|
chatcolor: aqua
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: h
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&bHelp&f] {vault_prefix} {player_displayname}&b:'
|
||||||
|
Trade:
|
||||||
|
color: dark_aqua
|
||||||
|
chatcolor: dark_aqua
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: t
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&3Trade&f] {vault_prefix} {player_displayname}&3:'
|
||||||
|
Local:
|
||||||
|
color: yellow
|
||||||
|
chatcolor: yellow
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 230
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: l
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
>>>>>>> master:src/config.yml
|
||||||
format: '&f[&eLocal&f] {vault_prefix} {player_displayname}&e:'
|
format: '&f[&eLocal&f] {vault_prefix} {player_displayname}&e:'
|
@ -1,3 +1,4 @@
|
|||||||
|
<<<<<<< HEAD:src/main/resources/example_config_always_up_to_date!.yml
|
||||||
#===============================================================
|
#===============================================================
|
||||||
# VentureChat Config =
|
# VentureChat Config =
|
||||||
# Author: Aust1n46 =
|
# Author: Aust1n46 =
|
||||||
@ -420,4 +421,429 @@ channels:
|
|||||||
alias: l
|
alias: l
|
||||||
permissions: None
|
permissions: None
|
||||||
speak_permissions: None
|
speak_permissions: None
|
||||||
|
=======
|
||||||
|
#===============================================================
|
||||||
|
# VentureChat Config =
|
||||||
|
# Author: Aust1n46 =
|
||||||
|
#===============================================================
|
||||||
|
|
||||||
|
# - regex1,regex2
|
||||||
|
# Simple regex tips: Use \b to "cut" a section of the word or phrase. Example: \bass,donuts
|
||||||
|
# Example filtered sentence: You are an ass. Will become: You are an donuts.
|
||||||
|
# Example filtered sentence: You caught a bass. Will stay: You caught a bass.
|
||||||
|
# Example filtered sentence: You are an asshole. Will become: You are an donutshole.
|
||||||
|
# Default filters by Jabelpeeps
|
||||||
|
filters:
|
||||||
|
- (\b.?anus),donuts
|
||||||
|
- (\ba+r*(se+|ss+(?!(ass|um|oc|ign|ist)).*?|s*e*h+[o0]*[l1]+e*[sz]*)\b),donuts
|
||||||
|
- (b[i1]a?tch(es)?),puppy
|
||||||
|
- Carpet Muncher,cookie monster
|
||||||
|
- (\bc((?!ook\b)[o0]+c*|aw)k\W?(sucker|s*|he[ea]*d)\b),rooster
|
||||||
|
- (\b[ck]r+a+p+(er|s|z)?\b),poopoo
|
||||||
|
- (\bcu+m+\b),go
|
||||||
|
- (\b.?[ck](u*n+|[l1]+[i1]+)t+[sz]*\b),peach
|
||||||
|
- (\b.?d[1i](c?k(head)?|[l1]+d[o0])e?[sz]?\b),rooster
|
||||||
|
- f u c k( e r)?,nono
|
||||||
|
- (\b.?fai*g+[oei1]*t*[sz]*\b),cigar
|
||||||
|
- Fudge Packer,fine person
|
||||||
|
- (\b(m[uo]+th[ae]r?)?(f|ph)uc*k*(e[rn]|ah*|ing?|)[sz]?\b),oh dear
|
||||||
|
- (\b(j(ac|er|ur)k\W?(of+))|(ji[sz]+i*m*)\b),bake brownies
|
||||||
|
- (\b(ma+s+te?rbai?te?[rs]?|wank(er)?[sz]?)\b),bake brownies
|
||||||
|
- orafi(s|ce),rooster
|
||||||
|
- (\bp+[e3]+[ai]*n+[i1!ua]+s+),rooster
|
||||||
|
- (\bp[i1]s+(?!(ton))(flap|face|drop)?),peepee
|
||||||
|
- (\b.?sh[i1!y]t+(er?|y|head)?[sz]*),poopoo
|
||||||
|
- (\bva[1i]?[gj]+[i1]+na+\b),peach
|
||||||
|
- vu[1l]+va,peach
|
||||||
|
- planet.?minecraft,another dimension
|
||||||
|
- pmc,another dimension
|
||||||
|
- ((\d+\.){3}\d+),another dimension
|
||||||
|
|
||||||
|
# command without the /
|
||||||
|
blockablecommands:
|
||||||
|
- vote
|
||||||
|
- me
|
||||||
|
|
||||||
|
# blacklisted nicknames
|
||||||
|
nicknames:
|
||||||
|
- Notch
|
||||||
|
|
||||||
|
nickname-in-tablist: true
|
||||||
|
|
||||||
|
# {player} : player sending command
|
||||||
|
# {command} : command typed
|
||||||
|
commandspy:
|
||||||
|
format: '&6{player}: {command}'
|
||||||
|
worldeditcommands: true
|
||||||
|
|
||||||
|
antispam:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# Number of messages to be spam
|
||||||
|
spamnumber: 5
|
||||||
|
|
||||||
|
# Amount of time in seconds for it to be spam
|
||||||
|
spamtime: 10
|
||||||
|
|
||||||
|
# Amount of time for the mute to last
|
||||||
|
# Acceptable units are: d,h,m,s
|
||||||
|
# Units can be combined, for example: 1d8h30m15s
|
||||||
|
# Use 0 for untimed mute
|
||||||
|
mutetime: 10m
|
||||||
|
|
||||||
|
# Logging chat and commands to a mysql database
|
||||||
|
mysql:
|
||||||
|
enabled: false
|
||||||
|
user: User
|
||||||
|
port: 3306
|
||||||
|
password: Password
|
||||||
|
host: localhost
|
||||||
|
database: Database
|
||||||
|
|
||||||
|
# Loglevel feature is still in the works for adding of debug messages
|
||||||
|
# Valid loglevels:
|
||||||
|
# Info: Regular logging
|
||||||
|
# Debug: Show extra messages and caught errors for debugging
|
||||||
|
# Severe: Only show severe messages
|
||||||
|
loglevel: info
|
||||||
|
|
||||||
|
# saveinterval is in minutes
|
||||||
|
saveinterval: 30
|
||||||
|
|
||||||
|
# If you're running a "cracked" server, player data might not be stored properly, and thus, you are on your own.
|
||||||
|
# If you run your server in offline mode, you might have to reset your player data when switching to online mode!
|
||||||
|
# If you see this warning by accident and you are using BungeeCord, make sure you have properly setup IP Forwarding.
|
||||||
|
# https://www.spigotmc.org/wiki/bungeecord-ip-forwarding/
|
||||||
|
# No player data will be saved in offline mode unless you set this acknowledgement to 'true'
|
||||||
|
offline_server_acknowledgement: false
|
||||||
|
|
||||||
|
# The time in seconds between each check to remove timed mutes
|
||||||
|
unmuteinterval: 60
|
||||||
|
|
||||||
|
# Enables or disabled BungeeCord messaging
|
||||||
|
bungeecordmessaging: false
|
||||||
|
|
||||||
|
# Sound for message notification
|
||||||
|
# Enter 'None' to disable the sound
|
||||||
|
message_sound: ENTITY_PLAYER_LEVELUP
|
||||||
|
|
||||||
|
# This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online
|
||||||
|
vanishsupport: true
|
||||||
|
|
||||||
|
# Use PlaceholderAPI placeholders
|
||||||
|
# Start the placeholder with 'sender_' for the sending players placeholder
|
||||||
|
# Start the placeholder with 'receiver_' for the receiving players placeholder
|
||||||
|
# The defaults shown below provide an example of each
|
||||||
|
tellformatto: '&7You message {receiver_vault_prefix}{receiver_player_displayname}&7:'
|
||||||
|
tellformatfrom: '{sender_vault_prefix}{sender_player_displayname} &7messages you:'
|
||||||
|
tellformatspy: '{sender_player_name} messages {receiver_player_name}:&7'
|
||||||
|
replyformatto: '&7You reply to {receiver_vault_prefix}{receiver_player_displayname}&7:'
|
||||||
|
replyformatfrom: '{sender_vault_prefix}{sender_player_displayname} &7replies to you:'
|
||||||
|
replyformatspy: '{sender_player_name} replies to {receiver_player_name}:&7'
|
||||||
|
|
||||||
|
# {host} : party hosts name
|
||||||
|
# {player} : player name
|
||||||
|
# use Default for the basic formatting
|
||||||
|
partyformat: Default
|
||||||
|
|
||||||
|
formatcleaner: true
|
||||||
|
|
||||||
|
# If true, /ignore will block chat from the ignored player as well as PM's
|
||||||
|
ignorechat: false
|
||||||
|
|
||||||
|
# The message shown to players alerting them no one is in the channel to hear them
|
||||||
|
emptychannelalert: "&6No one is listening to you."
|
||||||
|
|
||||||
|
messageremoverpermissions: '&cYou need additional permissions to view this message!'
|
||||||
|
messageremovertext: '&c&o<message removed>'
|
||||||
|
|
||||||
|
# The name of the group is the permissions node for the format
|
||||||
|
# Example: venturechat.json.Owner is the node for the group Owner
|
||||||
|
# A lower priority overrides a higher priority if a player has more than 1 group
|
||||||
|
# Possible options for click_name and click_prefix are suggest_command, run_command, and open_url
|
||||||
|
jsonformatting:
|
||||||
|
Default: # This default format is required! Do not delete or rename it!
|
||||||
|
priority: 2147483647 # Integer.MAX_VALUE
|
||||||
|
hover_name:
|
||||||
|
- '&6I have no rank!'
|
||||||
|
click_name: 'suggest_command'
|
||||||
|
click_name_text: '/msg {player_name}'
|
||||||
|
hover_prefix:
|
||||||
|
- '&dI am default!'
|
||||||
|
click_prefix: 'run_command'
|
||||||
|
click_prefix_text: '/help'
|
||||||
|
hover_suffix:
|
||||||
|
- '&dI am default suffix!'
|
||||||
|
click_suffix: 'suggest_command'
|
||||||
|
click_suffix_text: '/msg {player_name}'
|
||||||
|
Owner:
|
||||||
|
priority: 1 # Lowest Priority
|
||||||
|
hover_name:
|
||||||
|
- '&cOwner of the server!'
|
||||||
|
- '&bMessage me for help!'
|
||||||
|
click_name: 'suggest_command'
|
||||||
|
click_name_text: '/msg {player_name}'
|
||||||
|
hover_prefix:
|
||||||
|
- '&dServer Owner'
|
||||||
|
click_prefix: 'run_command'
|
||||||
|
click_prefix_text: '/help'
|
||||||
|
hover_suffix:
|
||||||
|
- '&dI am Owner suffix!'
|
||||||
|
click_suffix: 'suggest_command'
|
||||||
|
click_suffix_text: '/msg {player_name}'
|
||||||
|
|
||||||
|
# The icon is the block shown in the GUI
|
||||||
|
# The text is the display name of the block icon
|
||||||
|
# Include a slash (/) before the command
|
||||||
|
# Permissions are the name of the button and automatically include "venturechat."
|
||||||
|
# Example: mute equals venturechat.mute
|
||||||
|
venturegui:
|
||||||
|
mute:
|
||||||
|
icon: 'REDSTONE_BLOCK'
|
||||||
|
durability: 0
|
||||||
|
text: '&cMute {player_name} &410m'
|
||||||
|
permission: 'mute'
|
||||||
|
command: '/mute {channel} {player_name} 10m'
|
||||||
|
slot: 1
|
||||||
|
unmute:
|
||||||
|
icon: 'DIAMOND_BLOCK'
|
||||||
|
durability: 0
|
||||||
|
text: '&bUnmute {player_name}'
|
||||||
|
permission: 'mute'
|
||||||
|
command: '/unmute {channel} {player_name} '
|
||||||
|
slot: 2
|
||||||
|
removemessage:
|
||||||
|
icon: 'DIAMOND_AXE'
|
||||||
|
durability: 0
|
||||||
|
text: '&cRemove Message'
|
||||||
|
permission: 'removemessage'
|
||||||
|
command: '/removemessage {hash} {channel}'
|
||||||
|
slot: 7
|
||||||
|
|
||||||
|
guiicon: '&c [✓]'
|
||||||
|
guitext: '&cOpen Moderation GUI'
|
||||||
|
guirows: 1
|
||||||
|
|
||||||
|
# All clickable URL's will be underlined if set to true
|
||||||
|
underlineurls: true
|
||||||
|
|
||||||
|
# broadcast information
|
||||||
|
broadcast:
|
||||||
|
color: red
|
||||||
|
permissions: venturechat.adminchannel
|
||||||
|
displaytag: '[Broadcast]'
|
||||||
|
|
||||||
|
# Use $ to include arguments into the message
|
||||||
|
# Valid component types are:
|
||||||
|
# Command: Sends a message or command in chat
|
||||||
|
# Message: Sends a message to the player
|
||||||
|
# Broadcast: Sends a broadcast to all players on the server
|
||||||
|
# Permissions automatically include "venturechat."
|
||||||
|
# Example: permissions: alert equals venturechat.alert
|
||||||
|
# Use None for no permissions
|
||||||
|
# The number of arguments is the minimum number of required arguments, use 0 for no required arguments
|
||||||
|
alias:
|
||||||
|
vote:
|
||||||
|
arguments: 0
|
||||||
|
permissions: None
|
||||||
|
components:
|
||||||
|
- 'Message: &6Vote here: www.votelinkhere.com'
|
||||||
|
bane:
|
||||||
|
arguments: 2
|
||||||
|
permissions: bane
|
||||||
|
components:
|
||||||
|
- 'Command: /ban $ appeal at www.site.com'
|
||||||
|
- 'Command: /st banned $'
|
||||||
|
alert:
|
||||||
|
arguments: 1
|
||||||
|
permissions: alert
|
||||||
|
components:
|
||||||
|
- 'Broadcast: &c<Alert> $'
|
||||||
|
donate:
|
||||||
|
arguments: 0
|
||||||
|
permissions: None
|
||||||
|
components:
|
||||||
|
- 'Message: &bDonate here: www.mywebsite.com'
|
||||||
|
website:
|
||||||
|
arguments: 0
|
||||||
|
permissions: None
|
||||||
|
components:
|
||||||
|
- 'Message: &aThis is our website: www.site.net'
|
||||||
|
|
||||||
|
# Enables the creation of special Towny channels: Town and Nation
|
||||||
|
# To create these channels, simply name two channels below "Town" and "Nation"
|
||||||
|
# Bungeecord must be set to false for these channels!
|
||||||
|
enable_towny_channel: false
|
||||||
|
|
||||||
|
# Enables the creation of a special faction only channel using the Factions plugin
|
||||||
|
# To create this channel, simply name a channel below "Faction"
|
||||||
|
# Bungeecord must be set to false for this channel!
|
||||||
|
# WARNING: May not work for all versions of Factions!
|
||||||
|
enable_factions_channel: false
|
||||||
|
|
||||||
|
# color = [channel] color
|
||||||
|
# chatcolor = text color
|
||||||
|
# cooldown is in seconds
|
||||||
|
# bungeecord overrides distance
|
||||||
|
# channel permissions are configurable
|
||||||
|
# channels can be changed, and new channels can be created
|
||||||
|
# Permissions automatically include "venturechat."
|
||||||
|
# Example: permissions: staff equals venturechat.staff
|
||||||
|
# Use None for no permissions
|
||||||
|
|
||||||
|
# Use PlaceholderAPI placeholders are required!!!
|
||||||
|
# Use PlaceholderAPI placeholders are required!!!
|
||||||
|
# Use PlaceholderAPI placeholders are required!!!
|
||||||
|
# /papi ecloud download [plugin]
|
||||||
|
# /papi reload
|
||||||
|
# Use '' or "" around format, example: '[&2global&f] {vault_prefix} {player_displayname}&2:'
|
||||||
|
# You must have prefixes and suffixes set in a Vault compatible permissions plugin to avoid errors
|
||||||
|
# Use "" as the prefix or suffix to have none
|
||||||
|
|
||||||
|
# Set chatcolor to 'None' to have a group based chat color! Don't forget to put a suffix or other placeholder at the end of the format!
|
||||||
|
|
||||||
|
# Important!!!
|
||||||
|
# Important!!!
|
||||||
|
# If you delete a channel, restart the server! Do not use /chatreload!!!
|
||||||
|
channels:
|
||||||
|
GroupChatColorExample:
|
||||||
|
color: '#706C1E'
|
||||||
|
chatcolor: 'None'
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: ge
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[#706C1EGroupColorChat&f] {vault_prefix} {player_displayname}#706C1E:{vault_suffix}'
|
||||||
|
HexExample:
|
||||||
|
color: '#ff0000'
|
||||||
|
chatcolor: '#ff0000'
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: he
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[#ff0000Hex&f] {vault_prefix} {player_displayname}#ff0000:'
|
||||||
|
BungeeExample:
|
||||||
|
color: gold
|
||||||
|
chatcolor: gold
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 3
|
||||||
|
bungeecord: true
|
||||||
|
alias: be
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&6Network&f] {vault_prefix} {player_displayname}&6:'
|
||||||
|
AnnouncementExample:
|
||||||
|
color: red
|
||||||
|
chatcolor: red
|
||||||
|
mutable: false
|
||||||
|
filter: false
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: true
|
||||||
|
alias: announce
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: announcement
|
||||||
|
format: '&f[&aServer Announcement&f] {vault_prefix} {player_displayname}&c:'
|
||||||
|
Global:
|
||||||
|
color: dark_green
|
||||||
|
chatcolor: dark_green
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: true
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: g
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&2Global&f] {vault_prefix} {player_displayname}&2:'
|
||||||
|
Staff:
|
||||||
|
color: green
|
||||||
|
chatcolor: green
|
||||||
|
mutable: false
|
||||||
|
filter: false
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: st
|
||||||
|
permissions: staffchannel
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&aStaff&f] {vault_prefix} {player_displayname}&a:'
|
||||||
|
Donator:
|
||||||
|
color: light_purple
|
||||||
|
chatcolor: light_purple
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: d
|
||||||
|
permissions: donatorchannel
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&dDonator&f] {vault_prefix} {player_displayname}&d:'
|
||||||
|
Help:
|
||||||
|
color: aqua
|
||||||
|
chatcolor: aqua
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: h
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&bHelp&f] {vault_prefix} {player_displayname}&b:'
|
||||||
|
Trade:
|
||||||
|
color: dark_aqua
|
||||||
|
chatcolor: dark_aqua
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 0
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: t
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
format: '&f[&3Trade&f] {vault_prefix} {player_displayname}&3:'
|
||||||
|
Local:
|
||||||
|
color: yellow
|
||||||
|
chatcolor: yellow
|
||||||
|
mutable: true
|
||||||
|
filter: true
|
||||||
|
autojoin: true
|
||||||
|
default: false
|
||||||
|
distance: 230
|
||||||
|
cooldown: 0
|
||||||
|
bungeecord: false
|
||||||
|
alias: l
|
||||||
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
|
>>>>>>> master:src/example_config_always_up_to_date!.yml
|
||||||
format: '&f[&eLocal&f] {vault_prefix} {player_displayname}&e:'
|
format: '&f[&eLocal&f] {vault_prefix} {player_displayname}&e:'
|
@ -1,4 +1,5 @@
|
|||||||
name: VentureChat
|
name: VentureChat
|
||||||
|
<<<<<<< HEAD:src/main/resources/plugin.yml
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
main: mineverse.Aust1n46.chat.MineverseChat
|
main: mineverse.Aust1n46.chat.MineverseChat
|
||||||
@ -17,6 +18,26 @@ commands:
|
|||||||
usage: /unmute [playername] [channel]
|
usage: /unmute [playername] [channel]
|
||||||
aliases: [ump,vunmute]
|
aliases: [ump,vunmute]
|
||||||
description: Unmutes player in a channel so they can talk again.
|
description: Unmutes player in a channel so they can talk again.
|
||||||
|
=======
|
||||||
|
version: 2.23.3
|
||||||
|
api-version: 1.13
|
||||||
|
main: mineverse.Aust1n46.chat.MineverseChat
|
||||||
|
depend: [Vault, ProtocolLib, PlaceholderAPI]
|
||||||
|
softdepend: [Towny, Factions, Heroes]
|
||||||
|
author: Aust1n46
|
||||||
|
website: https://bitbucket.org/Aust1n46/venturechat/
|
||||||
|
description: #1 Channels Chat plugin! Spigot + Bungee. Supports PlaceholderAPI + JSON formatting. Moderation GUI!
|
||||||
|
commands:
|
||||||
|
mute:
|
||||||
|
usage: /mute [playername] [channel]
|
||||||
|
aliases: [mp,vmute]
|
||||||
|
description: Mutes player in a channel so they cannot talk.
|
||||||
|
permission-message: You don't have <permission>
|
||||||
|
unmute:
|
||||||
|
usage: /unmute [playername] [channel]
|
||||||
|
aliases: [ump,vunmute]
|
||||||
|
description: Unmutes player in a channel so they can talk again.
|
||||||
|
>>>>>>> master:src/plugin.yml
|
||||||
permission-message: You don't have <permission>
|
permission-message: You don't have <permission>
|
||||||
msg:
|
msg:
|
||||||
usage: /msg [playername] [msg]
|
usage: /msg [playername] [msg]
|
||||||
|
457
src/mineverse/Aust1n46/chat/channel/ChatChannel.java
Normal file
457
src/mineverse/Aust1n46/chat/channel/ChatChannel.java
Normal file
@ -0,0 +1,457 @@
|
|||||||
|
package mineverse.Aust1n46.chat.channel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
import mineverse.Aust1n46.chat.MineverseChat;
|
||||||
|
import mineverse.Aust1n46.chat.utilities.Format;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Chat channel object pojo. Class also contains static initialization methods
|
||||||
|
* for reading chat channels from the config file.
|
||||||
|
*
|
||||||
|
* @author Aust1n46
|
||||||
|
*/
|
||||||
|
public class ChatChannel {
|
||||||
|
private static final String PERMISSION_PREFIX = "venturechat.";
|
||||||
|
private static final String NO_PERMISSIONS = "venturechat.none";
|
||||||
|
|
||||||
|
private static boolean aliasesRegisteredAsCommands;
|
||||||
|
|
||||||
|
private static MineverseChat plugin = MineverseChat.getInstance();
|
||||||
|
private static ChatChannel defaultChatChannel;
|
||||||
|
private static String defaultColor;
|
||||||
|
private static HashMap<String, ChatChannel> chatChannels;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
private static ChatChannel[] channels;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String permission;
|
||||||
|
private String speakPermission;
|
||||||
|
private boolean mutable;
|
||||||
|
private String color;
|
||||||
|
private String chatColor;
|
||||||
|
private boolean defaultChannel;
|
||||||
|
private boolean autojoin;
|
||||||
|
private String alias;
|
||||||
|
private double distance;
|
||||||
|
private boolean filter;
|
||||||
|
private boolean bungee;
|
||||||
|
private String format;
|
||||||
|
private int cooldown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read chat channels from config file and initialize channel array.
|
||||||
|
*/
|
||||||
|
public static void initialize(boolean aliasesRegisteredAsCommands) {
|
||||||
|
chatChannels = new HashMap<String, ChatChannel>();
|
||||||
|
ChatChannel.aliasesRegisteredAsCommands = aliasesRegisteredAsCommands;
|
||||||
|
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("channels");
|
||||||
|
int len = (cs.getKeys(false)).size();
|
||||||
|
channels = new ChatChannel[len];
|
||||||
|
int counter = 0;
|
||||||
|
for (String key : cs.getKeys(false)) {
|
||||||
|
String color = cs.getString(key + ".color", "white");
|
||||||
|
String chatColor = cs.getString(key + ".chatcolor", "white");
|
||||||
|
String name = key;
|
||||||
|
String permission = cs.getString(key + ".permissions", "None");
|
||||||
|
String speakPermission = cs.getString(key + ".speak_permissions", "None");
|
||||||
|
boolean mutable = cs.getBoolean(key + ".mutable", false);
|
||||||
|
boolean filter = cs.getBoolean(key + ".filter", true);
|
||||||
|
boolean bungee = cs.getBoolean(key + ".bungeecord", false);
|
||||||
|
String format = cs.getString(key + ".format", "Default");
|
||||||
|
boolean defaultChannel = cs.getBoolean(key + ".default", false);
|
||||||
|
String alias = cs.getString(key + ".alias", "None");
|
||||||
|
double distance = cs.getDouble(key + ".distance", (double) 0);
|
||||||
|
int cooldown = cs.getInt(key + ".cooldown", 0);
|
||||||
|
boolean autojoin = cs.getBoolean(key + ".autojoin", false);
|
||||||
|
ChatChannel chatChannel = new ChatChannel(name, color, chatColor, permission, speakPermission, mutable,
|
||||||
|
filter, defaultChannel, alias, distance, autojoin, bungee, cooldown, format);
|
||||||
|
channels[counter++] = chatChannel;
|
||||||
|
chatChannels.put(name.toLowerCase(), chatChannel);
|
||||||
|
chatChannels.put(alias.toLowerCase(), chatChannel);
|
||||||
|
if (defaultChannel) {
|
||||||
|
defaultChatChannel = chatChannel;
|
||||||
|
defaultColor = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean areAliasesRegisteredAsCommands() {
|
||||||
|
return aliasesRegisteredAsCommands;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get array of chat channels.
|
||||||
|
*
|
||||||
|
* @return {@link ChatChannel}[]
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public static ChatChannel[] getChannels() {
|
||||||
|
return channels;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of chat channels.
|
||||||
|
*
|
||||||
|
* @return {@link Collection}<{@link ChatChannel}>
|
||||||
|
*/
|
||||||
|
public static Collection<ChatChannel> getChatChannels() {
|
||||||
|
return new HashSet<ChatChannel>(chatChannels.values());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a chat channel by name.
|
||||||
|
*
|
||||||
|
* @param channelName
|
||||||
|
* name of channel to get.
|
||||||
|
* @return {@link ChatChannel}
|
||||||
|
*/
|
||||||
|
public static ChatChannel getChannel(String channelName) {
|
||||||
|
return chatChannels.get(channelName.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the chat channel exists.
|
||||||
|
*
|
||||||
|
* @param channelName
|
||||||
|
* name of channel to check.
|
||||||
|
* @return true if channel exists, false otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean isChannel(String channelName) {
|
||||||
|
return getChannel(channelName) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default chat channel color.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public static String getDefaultColor() {
|
||||||
|
return defaultColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link ChatChannel}
|
||||||
|
*/
|
||||||
|
public static ChatChannel getDefaultChannel() {
|
||||||
|
return defaultChatChannel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of chat channels with autojoin set to true.
|
||||||
|
*
|
||||||
|
* @return {@link List}<{@link ChatChannel}>
|
||||||
|
*/
|
||||||
|
public static List<ChatChannel> getAutojoinList() {
|
||||||
|
List<ChatChannel> joinlist = new ArrayList<ChatChannel>();
|
||||||
|
for (ChatChannel c : channels) {
|
||||||
|
if (c.getAutojoin()) {
|
||||||
|
joinlist.add(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return joinlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parameterized constructor a {@link ChatChannel}.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param color
|
||||||
|
* @param chatColor
|
||||||
|
* @param permission
|
||||||
|
* @param speakPermission
|
||||||
|
* @param mutable
|
||||||
|
* @param filter
|
||||||
|
* @param defaultChannel
|
||||||
|
* @param alias
|
||||||
|
* @param distance
|
||||||
|
* @param autojoin
|
||||||
|
* @param bungee
|
||||||
|
* @param cooldown
|
||||||
|
* @param format
|
||||||
|
*/
|
||||||
|
public ChatChannel(String name, String color, String chatColor, String permission, String speakPermission,
|
||||||
|
boolean mutable, boolean filter, boolean defaultChannel, String alias, double distance, boolean autojoin,
|
||||||
|
boolean bungee, int cooldown, String format) {
|
||||||
|
this.name = name;
|
||||||
|
this.color = color;
|
||||||
|
this.chatColor = chatColor;
|
||||||
|
this.permission = PERMISSION_PREFIX + permission;
|
||||||
|
this.speakPermission = PERMISSION_PREFIX + speakPermission;
|
||||||
|
this.mutable = mutable;
|
||||||
|
this.filter = filter;
|
||||||
|
this.defaultChannel = defaultChannel;
|
||||||
|
this.alias = alias;
|
||||||
|
this.distance = distance;
|
||||||
|
this.autojoin = autojoin;
|
||||||
|
this.bungee = bungee;
|
||||||
|
this.cooldown = cooldown;
|
||||||
|
this.format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated parameterized constructor a {@link ChatChannel}.
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
* @param color
|
||||||
|
* @param chatColor
|
||||||
|
* @param permission
|
||||||
|
* @param speakPermission
|
||||||
|
* @param mutable
|
||||||
|
* @param filter
|
||||||
|
* @param defaultChannel
|
||||||
|
* @param alias
|
||||||
|
* @param distance
|
||||||
|
* @param autojoin
|
||||||
|
* @param bungee
|
||||||
|
* @param cooldown
|
||||||
|
* @param format
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public ChatChannel(String name, String color, String chatColor, String permission, String speakPermission,
|
||||||
|
Boolean mutable, Boolean filter, Boolean defaultChannel, String alias, Double distance, Boolean autojoin,
|
||||||
|
Boolean bungee, int cooldown, String format) {
|
||||||
|
this.name = name;
|
||||||
|
this.color = color;
|
||||||
|
this.chatColor = chatColor;
|
||||||
|
this.permission = PERMISSION_PREFIX + permission;
|
||||||
|
this.speakPermission = PERMISSION_PREFIX + speakPermission;
|
||||||
|
this.mutable = mutable;
|
||||||
|
this.filter = filter;
|
||||||
|
this.defaultChannel = defaultChannel;
|
||||||
|
this.alias = alias;
|
||||||
|
this.distance = distance;
|
||||||
|
this.autojoin = autojoin;
|
||||||
|
this.bungee = bungee;
|
||||||
|
this.cooldown = cooldown;
|
||||||
|
this.format = format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the format of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getFormat() {
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cooldown of the chat channel in seconds.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public int getCooldown() {
|
||||||
|
return cooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the chat channel is BungeeCord enabled.
|
||||||
|
*
|
||||||
|
* @return {@link Boolean#TRUE} if the chat channel is BungeeCord enabled,
|
||||||
|
* {@link Boolean#FALSE} otherwise.
|
||||||
|
*/
|
||||||
|
public Boolean getBungee() {
|
||||||
|
return Boolean.valueOf(bungee);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the permissions node for the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getPermission() {
|
||||||
|
return permission;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if autojoin is enabled for the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link Boolean#TRUE} if autojoin is enabled, {@link Boolean#FALSE}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
public Boolean getAutojoin() {
|
||||||
|
return Boolean.valueOf(autojoin);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the chat channel allows muting.
|
||||||
|
*
|
||||||
|
* @return {@link Boolean#TRUE} if muting is allowed, {@link Boolean#FALSE}
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
public Boolean isMutable() {
|
||||||
|
return Boolean.valueOf(mutable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the formatted color of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}. Returns {@link Format#DEFAULT_COLOR_CODE} if the
|
||||||
|
* color is invalid.
|
||||||
|
*/
|
||||||
|
public String getColor() {
|
||||||
|
if (Format.isValidColor(color)) {
|
||||||
|
return String.valueOf(ChatColor.valueOf(color.toUpperCase()));
|
||||||
|
}
|
||||||
|
if (Format.isValidHexColor(color)) {
|
||||||
|
return Format.convertHexColorCodeToBukkitColorCode(color);
|
||||||
|
}
|
||||||
|
return Format.DEFAULT_COLOR_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the raw color value of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getColorRaw() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the formatted chat color of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}. Returns {@link Format#DEFAULT_COLOR_CODE} if the chat
|
||||||
|
* color is invalid.
|
||||||
|
*/
|
||||||
|
public String getChatColor() {
|
||||||
|
if (chatColor.equalsIgnoreCase("None")) {
|
||||||
|
return chatColor;
|
||||||
|
}
|
||||||
|
if (Format.isValidColor(chatColor)) {
|
||||||
|
return String.valueOf(ChatColor.valueOf(chatColor.toUpperCase()));
|
||||||
|
}
|
||||||
|
if (Format.isValidHexColor(chatColor)) {
|
||||||
|
return Format.convertHexColorCodeToBukkitColorCode(chatColor);
|
||||||
|
}
|
||||||
|
return Format.DEFAULT_COLOR_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the raw chat color value of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getChatColorRaw() {
|
||||||
|
return chatColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if the chat channel is the default chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link Boolean#TRUE} if the chat channel is the default chat channel,
|
||||||
|
* {@link Boolean#FALSE} otherwise.
|
||||||
|
*/
|
||||||
|
public Boolean isDefaultchannel() {
|
||||||
|
return Boolean.valueOf(defaultChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the alias of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getAlias() {
|
||||||
|
return alias;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the distance of the chat channel in blocks.
|
||||||
|
*
|
||||||
|
* @return {@link Double}
|
||||||
|
*/
|
||||||
|
public Double getDistance() {
|
||||||
|
return Double.valueOf(distance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the chat channel has a distance set.
|
||||||
|
*
|
||||||
|
* @return {@link Boolean#TRUE} if the distance is greater than zero,
|
||||||
|
* {@link Boolean#FALSE} otherwise.
|
||||||
|
*/
|
||||||
|
public Boolean hasDistance() {
|
||||||
|
return Boolean.valueOf(distance > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the chat channel has a cooldown set.
|
||||||
|
*
|
||||||
|
* @return {@link Boolean#TRUE} if the cooldown is greater than zero,
|
||||||
|
* {@link Boolean#FALSE} otherwise.
|
||||||
|
*/
|
||||||
|
public Boolean hasCooldown() {
|
||||||
|
return Boolean.valueOf(cooldown > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the chat channel has a permission set.
|
||||||
|
*
|
||||||
|
* @return {@link Boolean#TRUE} if the permission does not equal
|
||||||
|
* {@link ChatChannel#NO_PERMISSIONS}, {@link Boolean#FALSE} otherwise.
|
||||||
|
*/
|
||||||
|
public Boolean hasPermission() {
|
||||||
|
return Boolean.valueOf(!permission.equalsIgnoreCase(NO_PERMISSIONS));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the chat channel has a speak permission set.
|
||||||
|
*
|
||||||
|
* @return true if the speak permission does not equal
|
||||||
|
* {@link ChatChannel#NO_PERMISSIONS}, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean hasSpeakPermission() {
|
||||||
|
return !speakPermission.equalsIgnoreCase(NO_PERMISSIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the speak permissions node for the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getSpeakPermission() {
|
||||||
|
return speakPermission;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the chat channel has the filter enabled.
|
||||||
|
*
|
||||||
|
* @return {@link Boolean#TRUE} if the chat channel has the filter enabled,
|
||||||
|
* {@link Boolean#FALSE} otherwise.
|
||||||
|
*/
|
||||||
|
public Boolean isFiltered() {
|
||||||
|
return Boolean.valueOf(filter);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compares the chat channel by name to determine equality.
|
||||||
|
*
|
||||||
|
* @param channel
|
||||||
|
* Object to compare for equality.
|
||||||
|
* @return true if the objects are equal, false otherwise.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object channel) {
|
||||||
|
return channel instanceof ChatChannel && this.name.equals(((ChatChannel) channel).getName());
|
||||||
|
}
|
||||||
|
}
|
142
src/mineverse/Aust1n46/chat/command/VentureCommandExecutor.java
Normal file
142
src/mineverse/Aust1n46/chat/command/VentureCommandExecutor.java
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
package mineverse.Aust1n46.chat.command;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.TabExecutor;
|
||||||
|
|
||||||
|
import mineverse.Aust1n46.chat.MineverseChat;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Broadcast;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.BungeeToggle;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Channel;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Channelinfo;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Chatinfo;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Chatreload;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Chlist;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Chwho;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Clearchat;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Commandblock;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Commandspy;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Config;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Edit;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Filter;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Force;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Forceall;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Kickchannel;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Kickchannelall;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Leave;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Listen;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Me;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Nick;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Party;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.RangedSpy;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Removemessage;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Setchannel;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Setchannelall;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.VentureChatGui;
|
||||||
|
import mineverse.Aust1n46.chat.command.chat.Venturechat;
|
||||||
|
import mineverse.Aust1n46.chat.command.message.IgnoreCommandExecutor;
|
||||||
|
import mineverse.Aust1n46.chat.command.message.MessageCommandExecutor;
|
||||||
|
import mineverse.Aust1n46.chat.command.message.MessageToggle;
|
||||||
|
import mineverse.Aust1n46.chat.command.message.Notifications;
|
||||||
|
import mineverse.Aust1n46.chat.command.message.Reply;
|
||||||
|
import mineverse.Aust1n46.chat.command.message.Spy;
|
||||||
|
import mineverse.Aust1n46.chat.command.mute.Mute;
|
||||||
|
import mineverse.Aust1n46.chat.command.mute.Muteall;
|
||||||
|
import mineverse.Aust1n46.chat.command.mute.Unmute;
|
||||||
|
import mineverse.Aust1n46.chat.command.mute.Unmuteall;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class that initializes and executes the plugin's commands.
|
||||||
|
*/
|
||||||
|
public class VentureCommandExecutor implements TabExecutor {
|
||||||
|
private static Map<String, VentureCommand> commands = new HashMap<String, VentureCommand>();
|
||||||
|
private static MineverseChat plugin = MineverseChat.getInstance();
|
||||||
|
private static VentureCommandExecutor commandExecutor;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] parameters) {
|
||||||
|
commands.get(command.getName()).execute(sender, command.getName(), parameters);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
return commands.get(command.getName()).onTabComplete(sender, command, label, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initialize() {
|
||||||
|
commandExecutor = new VentureCommandExecutor();
|
||||||
|
commands.put("broadcast", new Broadcast());
|
||||||
|
commands.put("channel", new Channel());
|
||||||
|
commands.put("join", new Channel());
|
||||||
|
commands.put("channelinfo", new Channelinfo());
|
||||||
|
commands.put("chatinfo", new Chatinfo());
|
||||||
|
commands.put("chatreload", new Chatreload());
|
||||||
|
commands.put("chlist", new Chlist());
|
||||||
|
commands.put("chwho", new Chwho());
|
||||||
|
commands.put("clearchat", new Clearchat());
|
||||||
|
commands.put("commandblock", new Commandblock());
|
||||||
|
commands.put("commandspy", new Commandspy());
|
||||||
|
commands.put("config", new Config());
|
||||||
|
commands.put("edit", new Edit());
|
||||||
|
commands.put("filter", new Filter());
|
||||||
|
commands.put("force", new Force());
|
||||||
|
commands.put("forceall", new Forceall());
|
||||||
|
commands.put("kickchannel", new Kickchannel());
|
||||||
|
commands.put("kickchannelall", new Kickchannelall());
|
||||||
|
commands.put("leave", new Leave());
|
||||||
|
commands.put("listen", new Listen());
|
||||||
|
commands.put("me", new Me());
|
||||||
|
commands.put("venturechat", new Venturechat());
|
||||||
|
commands.put("setnickname", new Nick());
|
||||||
|
commands.put("notifications", new Notifications());
|
||||||
|
commands.put("party", new Party());
|
||||||
|
commands.put("rangedspy", new RangedSpy());
|
||||||
|
commands.put("removemessage", new Removemessage());
|
||||||
|
commands.put("setchannel", new Setchannel());
|
||||||
|
commands.put("setchannelall", new Setchannelall());
|
||||||
|
commands.put("spy", new Spy());
|
||||||
|
commands.put("venturechatgui", new VentureChatGui());
|
||||||
|
commands.put("messagetoggle", new MessageToggle());
|
||||||
|
commands.put("bungeetoggle", new BungeeToggle());
|
||||||
|
for(String command : commands.keySet()) {
|
||||||
|
registerCommand(command, commandExecutor);
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||||
|
VentureCommand reply = new Reply();
|
||||||
|
commands.put("reply", reply);
|
||||||
|
commands.put("r", reply);
|
||||||
|
registerCommand("reply", commandExecutor);
|
||||||
|
registerCommand("r", commandExecutor);
|
||||||
|
|
||||||
|
commands.put("mute", new Mute());
|
||||||
|
commands.put("muteall", new Muteall());
|
||||||
|
commands.put("unmute", new Unmute());
|
||||||
|
commands.put("unmuteall", new Unmuteall());
|
||||||
|
registerCommand("mute", commandExecutor);
|
||||||
|
registerCommand("muteall", commandExecutor);
|
||||||
|
registerCommand("unmute", commandExecutor);
|
||||||
|
registerCommand("unmuteall", commandExecutor);
|
||||||
|
|
||||||
|
MessageCommandExecutor messageCommandExecutor = new MessageCommandExecutor();
|
||||||
|
registerCommand("message", messageCommandExecutor);
|
||||||
|
registerCommand("msg", messageCommandExecutor);
|
||||||
|
registerCommand("tell", messageCommandExecutor);
|
||||||
|
registerCommand("whisper", messageCommandExecutor);
|
||||||
|
|
||||||
|
registerCommand("ignore", new IgnoreCommandExecutor());
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void registerCommand(String command, CommandExecutor commandExecutor) {
|
||||||
|
if(plugin.getCommand(command) != null) {
|
||||||
|
plugin.getCommand(command).setExecutor(commandExecutor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
src/mineverse/Aust1n46/chat/command/chat/Chatreload.java
Normal file
60
src/mineverse/Aust1n46/chat/command/chat/Chatreload.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package mineverse.Aust1n46.chat.command.chat;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mineverse.Aust1n46.chat.MineverseChat;
|
||||||
|
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||||
|
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||||
|
import mineverse.Aust1n46.chat.command.VentureCommand;
|
||||||
|
import mineverse.Aust1n46.chat.database.PlayerData;
|
||||||
|
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
||||||
|
import mineverse.Aust1n46.chat.utilities.Format;
|
||||||
|
|
||||||
|
public class Chatreload implements VentureCommand {
|
||||||
|
private MineverseChat plugin = MineverseChat.getInstance();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(CommandSender sender, String command, String[] args) {
|
||||||
|
if(sender.hasPermission("venturechat.reload")) {
|
||||||
|
PlayerData.savePlayerData();
|
||||||
|
MineverseChatAPI.clearMineverseChatPlayerMap();
|
||||||
|
MineverseChatAPI.clearNameMap();
|
||||||
|
MineverseChatAPI.clearOnlineMineverseChatPlayerMap();
|
||||||
|
|
||||||
|
plugin.reloadConfig();
|
||||||
|
MineverseChat.initializeConfigReaders();
|
||||||
|
|
||||||
|
PlayerData.loadLegacyPlayerData();
|
||||||
|
PlayerData.loadPlayerData();
|
||||||
|
for(Player p : plugin.getServer().getOnlinePlayers()) {
|
||||||
|
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer(p);
|
||||||
|
if(mcp == null) {
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - Could not find player data post reload for currently online player: " + p.getName()));
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&c - There could be an issue with your player data saving."));
|
||||||
|
String name = p.getName();
|
||||||
|
UUID uuid = p.getUniqueId();
|
||||||
|
mcp = new MineverseChatPlayer(uuid, name);
|
||||||
|
}
|
||||||
|
mcp.setOnline(true);
|
||||||
|
mcp.setHasPlayed(false);
|
||||||
|
mcp.setJsonFormat();
|
||||||
|
MineverseChatAPI.addMineverseChatOnlinePlayerToMap(mcp);
|
||||||
|
MineverseChatAPI.addNameToMap(mcp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Config reloaded"));
|
||||||
|
for(MineverseChatPlayer player : MineverseChatAPI.getOnlineMineverseChatPlayers()) {
|
||||||
|
if(player.getPlayer().hasPermission("venturechat.reload")) {
|
||||||
|
player.getPlayer().sendMessage(LocalizedMessage.CONFIG_RELOADED.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sender.sendMessage(LocalizedMessage.COMMAND_NO_PERMISSION.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -19,7 +19,6 @@ import mineverse.Aust1n46.chat.MineverseChat;
|
|||||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||||
import mineverse.Aust1n46.chat.database.PlayerData;
|
import mineverse.Aust1n46.chat.database.PlayerData;
|
||||||
import mineverse.Aust1n46.chat.listeners.LoginListener;;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link LoginListener}.
|
* Tests {@link LoginListener}.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user