mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 10:39:05 +00:00
Merge branch 'master' into mute-rework
Conflicts: MineverseChat/mineverse/Aust1n46/chat/MineverseChat.java
This commit is contained in:
commit
93fcf38fbb
26
.classpath
26
.classpath
@ -1,26 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<classpath>
|
|
||||||
<classpathentry kind="src" path="MineverseChat"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/workspace/VentureChat Dependencies/Factions.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/workspace/VentureChat Dependencies/Heroes.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/workspace/VentureChat Dependencies/MassiveCore.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/workspace/VentureChat Dependencies/pircbotx-2.0.1.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/workspace/VentureChat Dependencies/PlaceholderAPI-2.8.2.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/workspace/VentureChat Dependencies/Towny.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/workspace/VentureChat Dependencies/Vault.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/workspace/VentureChat Dependencies/BungeeCord.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/plugins_1.13/ProtocolLib.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.14.1.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.7.10-SNAPSHOT-b1657.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.8.8-R0.1-SNAPSHOT.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.9.4-R0.1-SNAPSHOT-latest.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.10-R0.1-SNAPSHOT.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.11.2-R0.1-SNAPSHOT.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.12.2.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.13.2.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.14.4.jar"/>
|
|
||||||
<classpathentry kind="lib" path="C:/Users/Austin/Desktop/Mineverse Network/Servers/Hub/spigot-1.15.jar"/>
|
|
||||||
<classpathentry kind="lib" path="lib"/>
|
|
||||||
<classpathentry kind="output" path="bin"/>
|
|
||||||
</classpath>
|
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/bin/
|
/bin/
|
||||||
|
/.classpath
|
||||||
|
1
MineverseChat/.gitignore
vendored
Normal file
1
MineverseChat/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/TODO.txt
|
@ -1,4 +1,4 @@
|
|||||||
Version: 2.18.2
|
Version: 2.20.0
|
||||||
BlockCommandPlayer: '&cYou have been blocked from entering command {command}.'
|
BlockCommandPlayer: '&cYou have been blocked from entering command {command}.'
|
||||||
BlockCommandSender: '&cBlocked player &6{player} &cfrom entering command {command}.'
|
BlockCommandSender: '&cBlocked player &6{player} &cfrom entering command {command}.'
|
||||||
BlockedCommand: '&cYou are blocked from entering this command: {command}'
|
BlockedCommand: '&cYou are blocked from entering this command: {command}'
|
||||||
@ -14,6 +14,7 @@ ChannelListHeader: '&6Channel List : Alias'
|
|||||||
ChannelListWithPermissions: '{channel_color}{channel_name} : {channel_alias} - Permission Required'
|
ChannelListWithPermissions: '{channel_color}{channel_name} : {channel_alias} - Permission Required'
|
||||||
ChannelNoPermission: '&cYou do not have permission for this channel.'
|
ChannelNoPermission: '&cYou do not have permission for this channel.'
|
||||||
ChannelNoPermissionView: '&cYou do not have permission to look at this channel.'
|
ChannelNoPermissionView: '&cYou do not have permission to look at this channel.'
|
||||||
|
ChannelNoSpeakPermissions: '&cYou do not have permission to speak in this channel.'
|
||||||
ChannelPlayerListHeader: '&6Players in Channel: {channel_color}{channel_name}'
|
ChannelPlayerListHeader: '&6Players in Channel: {channel_color}{channel_name}'
|
||||||
ChannelMuted: '&cYou are muted in this channel: {channel_color}{channel_name}&c{time}'
|
ChannelMuted: '&cYou are muted in this channel: {channel_color}{channel_name}&c{time}'
|
||||||
CommandInvalidArguments: '&cInvalid command: {command} {args}'
|
CommandInvalidArguments: '&cInvalid command: {command} {args}'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
name: VentureChat
|
name: VentureChat
|
||||||
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
|
main: mineverse.Aust1n46.chat.bungee.MineverseChatBungee
|
||||||
version: 2.18.4
|
version: 2.20.0
|
||||||
author: Aust1n46
|
author: Aust1n46
|
@ -95,24 +95,20 @@ saveinterval: 30
|
|||||||
# The time in seconds between each check to remove timed mutes
|
# The time in seconds between each check to remove timed mutes
|
||||||
unmuteinterval: 60
|
unmuteinterval: 60
|
||||||
|
|
||||||
# The color of the private messages
|
|
||||||
tellcolor: white
|
|
||||||
|
|
||||||
# Enables or disabled BungeeCord messaging
|
# Enables or disabled BungeeCord messaging
|
||||||
bungeecordmessaging: true
|
bungeecordmessaging: false
|
||||||
|
|
||||||
# This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online
|
# This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online
|
||||||
vanishsupport: true
|
vanishsupport: true
|
||||||
|
|
||||||
# {playerto} : player receivings name
|
# {playerto} : player receivings name
|
||||||
# {playerfrom} : player sendings name
|
# {playerfrom} : player sendings name
|
||||||
# use Default for the basic formatting
|
tellformatto: 'You message {playerto}:&7'
|
||||||
tellformatto: Default
|
tellformatfrom: '{playerfrom} messages you:&7'
|
||||||
tellformatfrom: Default
|
tellformatspy: '{playerfrom} messages {playerto}:&7'
|
||||||
tellformatspy: Default
|
replyformatto: 'You reply to {playerto}:&7'
|
||||||
replyformatto: Default
|
replyformatfrom: '{playerfrom} replies to you:&7'
|
||||||
replyformatfrom: Default
|
replyformatspy: '{playerfrom} replied to {playerto}:&7'
|
||||||
replyformatspy: Default
|
|
||||||
|
|
||||||
# {host} : party hosts name
|
# {host} : party hosts name
|
||||||
# {player} : player name
|
# {player} : player name
|
||||||
@ -297,7 +293,69 @@ enable_factions_channel: false
|
|||||||
# Use '' or "" around format, example: '[&2global&f] {vault_prefix} {player_displayname}&2:'
|
# 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
|
# 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
|
# 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:
|
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:
|
Global:
|
||||||
color: dark_green
|
color: dark_green
|
||||||
chatcolor: dark_green
|
chatcolor: dark_green
|
||||||
@ -310,6 +368,7 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: g
|
alias: g
|
||||||
permissions: None
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&2Global&f] {vault_prefix} {player_displayname}&2:'
|
format: '&f[&2Global&f] {vault_prefix} {player_displayname}&2:'
|
||||||
Staff:
|
Staff:
|
||||||
color: green
|
color: green
|
||||||
@ -323,20 +382,8 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: st
|
alias: st
|
||||||
permissions: staffchannel
|
permissions: staffchannel
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&aStaff&f] {vault_prefix} {player_displayname}&a:'
|
format: '&f[&aStaff&f] {vault_prefix} {player_displayname}&a:'
|
||||||
Admin:
|
|
||||||
color: red
|
|
||||||
chatcolor: red
|
|
||||||
mutable: false
|
|
||||||
filter: false
|
|
||||||
autojoin: true
|
|
||||||
default: false
|
|
||||||
distance: 0
|
|
||||||
cooldown: 0
|
|
||||||
bungeecord: false
|
|
||||||
alias: a
|
|
||||||
permissions: adminchannel
|
|
||||||
format: '&f[&cAdmin&f] {vault_prefix} {player_displayname}&c:'
|
|
||||||
Donator:
|
Donator:
|
||||||
color: light_purple
|
color: light_purple
|
||||||
chatcolor: light_purple
|
chatcolor: light_purple
|
||||||
@ -349,6 +396,7 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: d
|
alias: d
|
||||||
permissions: donatorchannel
|
permissions: donatorchannel
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&dDonator&f] {vault_prefix} {player_displayname}&d:'
|
format: '&f[&dDonator&f] {vault_prefix} {player_displayname}&d:'
|
||||||
Help:
|
Help:
|
||||||
color: aqua
|
color: aqua
|
||||||
@ -362,6 +410,7 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: h
|
alias: h
|
||||||
permissions: None
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&bHelp&f] {vault_prefix} {player_displayname}&b:'
|
format: '&f[&bHelp&f] {vault_prefix} {player_displayname}&b:'
|
||||||
Trade:
|
Trade:
|
||||||
color: dark_aqua
|
color: dark_aqua
|
||||||
@ -375,6 +424,7 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: t
|
alias: t
|
||||||
permissions: None
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&3Trade&f] {vault_prefix} {player_displayname}&3:'
|
format: '&f[&3Trade&f] {vault_prefix} {player_displayname}&3:'
|
||||||
Local:
|
Local:
|
||||||
color: yellow
|
color: yellow
|
||||||
@ -388,17 +438,5 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: l
|
alias: l
|
||||||
permissions: None
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&eLocal&f] {vault_prefix} {player_displayname}&e:'
|
format: '&f[&eLocal&f] {vault_prefix} {player_displayname}&e:'
|
||||||
Network:
|
|
||||||
color: gold
|
|
||||||
chatcolor: gold
|
|
||||||
mutable: true
|
|
||||||
filter: true
|
|
||||||
autojoin: true
|
|
||||||
default: false
|
|
||||||
distance: 0
|
|
||||||
cooldown: 60
|
|
||||||
bungeecord: true
|
|
||||||
alias: n
|
|
||||||
permissions: None
|
|
||||||
format: '&f[&6Network&f] {vault_prefix} {player_displayname}&6:'
|
|
@ -46,6 +46,8 @@ nicknames:
|
|||||||
|
|
||||||
nickname-in-tablist: true
|
nickname-in-tablist: true
|
||||||
|
|
||||||
|
# {player} : player sending command
|
||||||
|
# {command} : command typed
|
||||||
commandspy:
|
commandspy:
|
||||||
format: '&6{player}: {command}'
|
format: '&6{player}: {command}'
|
||||||
worldeditcommands: true
|
worldeditcommands: true
|
||||||
@ -93,24 +95,20 @@ saveinterval: 30
|
|||||||
# The time in seconds between each check to remove timed mutes
|
# The time in seconds between each check to remove timed mutes
|
||||||
unmuteinterval: 60
|
unmuteinterval: 60
|
||||||
|
|
||||||
# The color of the private messages
|
|
||||||
tellcolor: white
|
|
||||||
|
|
||||||
# Enables or disabled BungeeCord messaging
|
# Enables or disabled BungeeCord messaging
|
||||||
bungeecordmessaging: true
|
bungeecordmessaging: false
|
||||||
|
|
||||||
# This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online
|
# This will allow vanished players to be exempt from being sent private messages, and will act as if they aren't online
|
||||||
vanishsupport: true
|
vanishsupport: true
|
||||||
|
|
||||||
# {playerto} : player receivings name
|
# {playerto} : player receivings name
|
||||||
# {playerfrom} : player sendings name
|
# {playerfrom} : player sendings name
|
||||||
# use Default for the basic formatting
|
tellformatto: 'You message {playerto}:&7'
|
||||||
tellformatto: Default
|
tellformatfrom: '{playerfrom} messages you:&7'
|
||||||
tellformatfrom: Default
|
tellformatspy: '{playerfrom} messages {playerto}:&7'
|
||||||
tellformatspy: Default
|
replyformatto: 'You reply to {playerto}:&7'
|
||||||
replyformatto: Default
|
replyformatfrom: '{playerfrom} replies to you:&7'
|
||||||
replyformatfrom: Default
|
replyformatspy: '{playerfrom} replied to {playerto}:&7'
|
||||||
replyformatspy: Default
|
|
||||||
|
|
||||||
# {host} : party hosts name
|
# {host} : party hosts name
|
||||||
# {player} : player name
|
# {player} : player name
|
||||||
@ -295,7 +293,69 @@ enable_factions_channel: false
|
|||||||
# Use '' or "" around format, example: '[&2global&f] {vault_prefix} {player_displayname}&2:'
|
# 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
|
# 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
|
# 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:
|
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:
|
Global:
|
||||||
color: dark_green
|
color: dark_green
|
||||||
chatcolor: dark_green
|
chatcolor: dark_green
|
||||||
@ -308,6 +368,7 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: g
|
alias: g
|
||||||
permissions: None
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&2Global&f] {vault_prefix} {player_displayname}&2:'
|
format: '&f[&2Global&f] {vault_prefix} {player_displayname}&2:'
|
||||||
Staff:
|
Staff:
|
||||||
color: green
|
color: green
|
||||||
@ -321,20 +382,8 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: st
|
alias: st
|
||||||
permissions: staffchannel
|
permissions: staffchannel
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&aStaff&f] {vault_prefix} {player_displayname}&a:'
|
format: '&f[&aStaff&f] {vault_prefix} {player_displayname}&a:'
|
||||||
Admin:
|
|
||||||
color: red
|
|
||||||
chatcolor: red
|
|
||||||
mutable: false
|
|
||||||
filter: false
|
|
||||||
autojoin: true
|
|
||||||
default: false
|
|
||||||
distance: 0
|
|
||||||
cooldown: 0
|
|
||||||
bungeecord: false
|
|
||||||
alias: a
|
|
||||||
permissions: adminchannel
|
|
||||||
format: '&f[&cAdmin&f] {vault_prefix} {player_displayname}&c:'
|
|
||||||
Donator:
|
Donator:
|
||||||
color: light_purple
|
color: light_purple
|
||||||
chatcolor: light_purple
|
chatcolor: light_purple
|
||||||
@ -347,6 +396,7 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: d
|
alias: d
|
||||||
permissions: donatorchannel
|
permissions: donatorchannel
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&dDonator&f] {vault_prefix} {player_displayname}&d:'
|
format: '&f[&dDonator&f] {vault_prefix} {player_displayname}&d:'
|
||||||
Help:
|
Help:
|
||||||
color: aqua
|
color: aqua
|
||||||
@ -360,6 +410,7 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: h
|
alias: h
|
||||||
permissions: None
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&bHelp&f] {vault_prefix} {player_displayname}&b:'
|
format: '&f[&bHelp&f] {vault_prefix} {player_displayname}&b:'
|
||||||
Trade:
|
Trade:
|
||||||
color: dark_aqua
|
color: dark_aqua
|
||||||
@ -373,6 +424,7 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: t
|
alias: t
|
||||||
permissions: None
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&3Trade&f] {vault_prefix} {player_displayname}&3:'
|
format: '&f[&3Trade&f] {vault_prefix} {player_displayname}&3:'
|
||||||
Local:
|
Local:
|
||||||
color: yellow
|
color: yellow
|
||||||
@ -386,17 +438,5 @@ channels:
|
|||||||
bungeecord: false
|
bungeecord: false
|
||||||
alias: l
|
alias: l
|
||||||
permissions: None
|
permissions: None
|
||||||
|
speak_permissions: None
|
||||||
format: '&f[&eLocal&f] {vault_prefix} {player_displayname}&e:'
|
format: '&f[&eLocal&f] {vault_prefix} {player_displayname}&e:'
|
||||||
Network:
|
|
||||||
color: gold
|
|
||||||
chatcolor: gold
|
|
||||||
mutable: true
|
|
||||||
filter: true
|
|
||||||
autojoin: true
|
|
||||||
default: false
|
|
||||||
distance: 0
|
|
||||||
cooldown: 60
|
|
||||||
bungeecord: true
|
|
||||||
alias: n
|
|
||||||
permissions: None
|
|
||||||
format: '&f[&6Network&f] {vault_prefix} {player_displayname}&6:'
|
|
@ -111,8 +111,6 @@ import com.comphenix.protocol.ProtocolLibrary;
|
|||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPI;
|
|
||||||
|
|
||||||
public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||||
// Listeners --------------------------------
|
// Listeners --------------------------------
|
||||||
private ChatListener chatListener;
|
private ChatListener chatListener;
|
||||||
@ -319,7 +317,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
commands.put("venturechat", new Venturechat("venturechat"));
|
commands.put("venturechat", new Venturechat("venturechat"));
|
||||||
commands.put("mute", new Mute("mute"));
|
commands.put("mute", new Mute("mute"));
|
||||||
commands.put("muteall", new Muteall("muteall"));
|
commands.put("muteall", new Muteall("muteall"));
|
||||||
commands.put("nick", new Nick("nick"));
|
commands.put("setnickname", new Nick("setnickname"));
|
||||||
commands.put("notifications", new Notifications("notifications"));
|
commands.put("notifications", new Notifications("notifications"));
|
||||||
commands.put("party", new Party("party"));
|
commands.put("party", new Party("party"));
|
||||||
commands.put("rangedspy", new RangedSpy("rangedspy"));
|
commands.put("rangedspy", new RangedSpy("rangedspy"));
|
||||||
@ -406,13 +404,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
if(pluginManager.isPluginEnabled("PlaceholderAPI")) {
|
if(pluginManager.isPluginEnabled("PlaceholderAPI")) {
|
||||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Enabling PlaceholderAPI Hook"));
|
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Enabling PlaceholderAPI Hook"));
|
||||||
}
|
}
|
||||||
boolean hooked = PlaceholderAPI.registerPlaceholderHook("venturechat", new VentureChatPlaceholders());
|
new VentureChatPlaceholders().register();
|
||||||
if(hooked) {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Added placeholders to PlaceholderAPI!"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - &cPlaceholders were not added to PlaceholderAPI!"));
|
|
||||||
}
|
|
||||||
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Loading player data"));
|
Bukkit.getConsoleSender().sendMessage(Format.FormatStringAll("&8[&eVentureChat&8]&e - Loading player data"));
|
||||||
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
||||||
scheduler.runTaskTimerAsynchronously(this, new Runnable() {
|
scheduler.runTaskTimerAsynchronously(this, new Runnable() {
|
||||||
@ -437,7 +429,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
// System.out.println(time + " " + timemark);
|
// System.out.println(time + " " + timemark);
|
||||||
if(time > timemark) {
|
if(time > timemark) {
|
||||||
p.removeMute(channel.getName());
|
p.removeMute(channel.getName());
|
||||||
if(p.isOnline()) p.getPlayer().sendMessage(ChatColor.RED + "You have just been unmuted in: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName());
|
if(p.isOnline()) p.getPlayer().sendMessage(ChatColor.RED + "You have just been unmuted in: " + channel.getColor() + channel.getName());
|
||||||
else p.setModified(true);
|
else p.setModified(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -822,7 +814,7 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
|||||||
playerList = playerList.substring(0, playerList.length() - 2);
|
playerList = playerList.substring(0, playerList.length() - 2);
|
||||||
}
|
}
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.CHANNEL_PLAYER_LIST_HEADER.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.CHANNEL_PLAYER_LIST_HEADER.toString()
|
||||||
.replace("{channel_color}", (ChatColor.valueOf(chatchannel.getColor().toUpperCase())).toString())
|
.replace("{channel_color}", chatchannel.getColor().toString())
|
||||||
.replace("{channel_name}", chatchannel.getName()));
|
.replace("{channel_name}", chatchannel.getName()));
|
||||||
mcp.getPlayer().sendMessage(Format.FormatStringAll(playerList));
|
mcp.getPlayer().sendMessage(Format.FormatStringAll(playerList));
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,11 @@ package mineverse.Aust1n46.chat;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.PlaceholderHook;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
import mineverse.Aust1n46.chat.api.MineverseChatAPI;
|
||||||
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||||
|
|
||||||
public class VentureChatPlaceholders extends PlaceholderHook {
|
public class VentureChatPlaceholders extends PlaceholderExpansion {
|
||||||
@Override
|
@Override
|
||||||
public String onPlaceholderRequest(Player p, String identifier) {
|
public String onPlaceholderRequest(Player p, String identifier) {
|
||||||
if(p == null) {
|
if(p == null) {
|
||||||
@ -67,4 +66,29 @@ public class VentureChatPlaceholders extends PlaceholderHook {
|
|||||||
if(color.equalsIgnoreCase("white")) return "f";
|
if(color.equalsIgnoreCase("white")) return "f";
|
||||||
return "f";
|
return "f";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean persist(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canRegister(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAuthor() {
|
||||||
|
return "Aust1n46";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getIdentifier() {
|
||||||
|
return "venturechat";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVersion() {
|
||||||
|
return MineverseChat.getInstance().getDescription().getVersion();
|
||||||
|
}
|
||||||
}
|
}
|
@ -477,8 +477,9 @@ public class MineverseChatPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setJsonFormat() {
|
public void setJsonFormat() {
|
||||||
|
this.jsonFormat = "Default";
|
||||||
for(JsonFormat j : MineverseChat.jfInfo.getJsonFormats()) {
|
for(JsonFormat j : MineverseChat.jfInfo.getJsonFormats()) {
|
||||||
if(this.getPlayer().hasPermission("venturechat.json." + j.getName())) {
|
if(this.getPlayer().isPermissionSet("venturechat.json." + j.getName())) {
|
||||||
if(MineverseChat.jfInfo.getJsonFormat(this.getJsonFormat()).getPriority() > j.getPriority()) {
|
if(MineverseChat.jfInfo.getJsonFormat(this.getJsonFormat()).getPriority() > j.getPriority()) {
|
||||||
this.jsonFormat = j.getName();
|
this.jsonFormat = j.getName();
|
||||||
}
|
}
|
||||||
|
@ -3,108 +3,134 @@ package mineverse.Aust1n46.chat.channel;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.MineverseChat;
|
import mineverse.Aust1n46.chat.MineverseChat;
|
||||||
import mineverse.Aust1n46.chat.utilities.Format;
|
import mineverse.Aust1n46.chat.utilities.Format;
|
||||||
|
|
||||||
//This class is used to create ChatChannel objects, which store all the information for a channel. This
|
/**
|
||||||
//information is read in from the config file when the server starts up.
|
* Chat channel object pojo. Class also contains static initialization methods
|
||||||
|
* for reading chat channels from the config file.
|
||||||
|
*
|
||||||
|
* @author Aust1n46
|
||||||
|
*/
|
||||||
public class ChatChannel {
|
public class ChatChannel {
|
||||||
private String name;
|
private static final String PERMISSION_PREFIX = "venturechat.";
|
||||||
private String permission;
|
private static final String NO_PERMISSIONS = "venturechat.none";
|
||||||
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;
|
|
||||||
private boolean irc;
|
|
||||||
|
|
||||||
private static MineverseChat plugin = MineverseChat.getInstance();
|
private static MineverseChat plugin = MineverseChat.getInstance();
|
||||||
private static ChatChannel defaultChatChannel;
|
private static ChatChannel defaultChatChannel;
|
||||||
private static ChatChannel[] channels;
|
private static ChatChannel[] channels;
|
||||||
private static String defaultColor;
|
private static String defaultColor;
|
||||||
|
|
||||||
|
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() {
|
public static void initialize() {
|
||||||
String _color = "";
|
|
||||||
String _chatcolor = "";
|
|
||||||
String _name = "";
|
|
||||||
String _permission = "";
|
|
||||||
Boolean _mutable = false;
|
|
||||||
Boolean _filter = false;
|
|
||||||
Boolean _defaultchannel = false;
|
|
||||||
String _alias = "";
|
|
||||||
Double _distance = (double) 0;
|
|
||||||
Boolean _autojoin = false;
|
|
||||||
Boolean _bungee = false;
|
|
||||||
String _format = "";
|
|
||||||
int _cooldown = 0;
|
|
||||||
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("channels");
|
ConfigurationSection cs = plugin.getConfig().getConfigurationSection("channels");
|
||||||
int len = (cs.getKeys(false)).size();
|
int len = (cs.getKeys(false)).size();
|
||||||
channels = new ChatChannel[len];
|
channels = new ChatChannel[len];
|
||||||
int x = 0;
|
int counter = 0;
|
||||||
for (String key : cs.getKeys(false)) {
|
for (String key : cs.getKeys(false)) {
|
||||||
_color = (String) cs.getString(key + ".color", "white");
|
String color = cs.getString(key + ".color", "white");
|
||||||
_chatcolor = (String) cs.getString(key + ".chatcolor", "white");
|
String chatColor = cs.getString(key + ".chatcolor", "white");
|
||||||
if(!(Format.isValidColor(_color))) {
|
String name = key;
|
||||||
plugin.getServer().getLogger().info("[" + plugin.getName() + "] " + _color + " is not valid. Changing to white.");
|
String permission = cs.getString(key + ".permissions", "None");
|
||||||
_color = "white";
|
String speakPermission = cs.getString(key + ".speak_permissions", "None");
|
||||||
}
|
boolean mutable = cs.getBoolean(key + ".mutable", false);
|
||||||
if(!(Format.isValidColor(_chatcolor)) && !_chatcolor.equalsIgnoreCase("None")) {
|
boolean filter = cs.getBoolean(key + ".filter", true);
|
||||||
plugin.getServer().getLogger().info("[" + plugin.getName() + "] " + _chatcolor + " is not valid. Changing to white.");
|
boolean bungee = cs.getBoolean(key + ".bungeecord", false);
|
||||||
_chatcolor = "white";
|
String format = cs.getString(key + ".format", "Default");
|
||||||
}
|
boolean defaultChannel = cs.getBoolean(key + ".default", false);
|
||||||
_name = key;
|
String alias = cs.getString(key + ".alias", "None");
|
||||||
_permission = (String) cs.getString(key + ".permissions", "None");
|
double distance = cs.getDouble(key + ".distance", (double) 0);
|
||||||
_mutable = (Boolean) cs.getBoolean(key + ".mutable", false);
|
int cooldown = cs.getInt(key + ".cooldown", 0);
|
||||||
_filter = (Boolean) cs.getBoolean(key + ".filter", true);
|
boolean autojoin = cs.getBoolean(key + ".autojoin", false);
|
||||||
_bungee = (Boolean) cs.getBoolean(key + ".bungeecord", false);
|
ChatChannel chatChannel = new ChatChannel(name, color, chatColor, permission, speakPermission, mutable,
|
||||||
_format = cs.getString(key + ".format", "Default");
|
filter, defaultChannel, alias, distance, autojoin, bungee, cooldown, format);
|
||||||
_defaultchannel = (Boolean) cs.getBoolean(key + ".default", false);
|
channels[counter++] = chatChannel;
|
||||||
_alias = (String) cs.getString(key + ".alias", "None");
|
if (defaultChannel) {
|
||||||
_distance = (Double) cs.getDouble(key + ".distance", (double) 0);
|
defaultChatChannel = chatChannel;
|
||||||
_cooldown = (int) cs.getInt(key + ".cooldown", 0);
|
defaultColor = color;
|
||||||
_autojoin = (Boolean) cs.getBoolean(key + ".autojoin", false);
|
|
||||||
ChatChannel c = new ChatChannel(_name, _color, _chatcolor, _permission, _mutable, _filter, _defaultchannel, _alias, _distance, _autojoin, _bungee, _cooldown, _format);
|
|
||||||
channels[x++] = c;
|
|
||||||
if(_defaultchannel) {
|
|
||||||
defaultChatChannel = c;
|
|
||||||
defaultColor = _color;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get array of chat channels.
|
||||||
|
*
|
||||||
|
* @return {@link ChatChannel}[]
|
||||||
|
*/
|
||||||
public static ChatChannel[] getChannels() {
|
public static ChatChannel[] getChannels() {
|
||||||
return channels;
|
return channels;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ChatChannel getChannel(String ChannelName) {
|
/**
|
||||||
|
* Get a chat channel by name.
|
||||||
|
*
|
||||||
|
* @param channelName
|
||||||
|
* name of channel to get.
|
||||||
|
* @return {@link ChatChannel}
|
||||||
|
*/
|
||||||
|
public static ChatChannel getChannel(String channelName) {
|
||||||
for (ChatChannel c : channels) {
|
for (ChatChannel c : channels) {
|
||||||
if(c.getName().equalsIgnoreCase(ChannelName) || c.getAlias().equalsIgnoreCase(ChannelName)) {
|
if (c.getName().equalsIgnoreCase(channelName) || c.getAlias().equalsIgnoreCase(channelName)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isChannel(String channel) {
|
/**
|
||||||
return getChannel(channel) != null;
|
* 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() {
|
public static String getDefaultColor() {
|
||||||
return defaultColor;
|
return defaultColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get default chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link ChatChannel}
|
||||||
|
*/
|
||||||
public static ChatChannel getDefaultChannel() {
|
public static ChatChannel getDefaultChannel() {
|
||||||
return defaultChatChannel;
|
return defaultChatChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of chat channels with autojoin set to true.
|
||||||
|
*
|
||||||
|
* @return {@link List}<{@link ChatChannel}>
|
||||||
|
*/
|
||||||
public static List<ChatChannel> getAutojoinList() {
|
public static List<ChatChannel> getAutojoinList() {
|
||||||
List<ChatChannel> joinlist = new ArrayList<ChatChannel>();
|
List<ChatChannel> joinlist = new ArrayList<ChatChannel>();
|
||||||
for (ChatChannel c : channels) {
|
for (ChatChannel c : channels) {
|
||||||
@ -115,130 +141,250 @@ public class ChatChannel {
|
|||||||
return joinlist;
|
return joinlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChatChannel(String _Name, String _color, String _chatcolor, String _Permission, Boolean _mutable, Boolean _filter, Boolean _defaultchannel, String _alias, Double _distance, Boolean _autojoin, Boolean _bungee, int _cooldown, String _format) {
|
/**
|
||||||
name = _Name;
|
* Parameterized constructor a {@link ChatChannel}.
|
||||||
permission = "venturechat." + _Permission;
|
*
|
||||||
mutable = _mutable;
|
* @param name
|
||||||
setColor(_color);
|
* @param color
|
||||||
setChatColor(_chatcolor);
|
* @param chatColor
|
||||||
setDefaultChannel(_defaultchannel);
|
* @param permission
|
||||||
setAlias(_alias);
|
* @param speakPermission
|
||||||
setDistance(_distance);
|
* @param mutable
|
||||||
setFilter(_filter);
|
* @param filter
|
||||||
setAutojoin(_autojoin);
|
* @param defaultChannel
|
||||||
setBungee(_bungee);
|
* @param alias
|
||||||
setCooldown(_cooldown);
|
* @param distance
|
||||||
setFormat(_format);
|
* @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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFormat(String _format) {
|
/**
|
||||||
format = _format;
|
* Get the format of the chat channel.
|
||||||
}
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
public String getFormat() {
|
public String getFormat() {
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCooldown(int _cooldown) {
|
/**
|
||||||
cooldown = _cooldown;
|
* Get the cooldown of the chat channel in seconds.
|
||||||
}
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
public int getCooldown() {
|
public int getCooldown() {
|
||||||
return cooldown;
|
return cooldown;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBungee(Boolean _bungee) {
|
/**
|
||||||
bungee = _bungee;
|
* Check if the chat channel is BungeeCord enabled.
|
||||||
}
|
*
|
||||||
|
* @return true if the chat channel is BungeeCord enabled, false otherwise.
|
||||||
public Boolean getBungee() {
|
*/
|
||||||
|
public boolean getBungee() {
|
||||||
return bungee;
|
return bungee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the permissions node for the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
public String getPermission() {
|
public String getPermission() {
|
||||||
return permission;
|
return permission;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getAutojoin() {
|
/**
|
||||||
|
* Check if autojoin is enabled for the chat channel.
|
||||||
|
*
|
||||||
|
* @return true if autojoin is enabled, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean getAutojoin() {
|
||||||
return autojoin;
|
return autojoin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAutojoin(Boolean _autojoin) {
|
/**
|
||||||
autojoin = _autojoin;
|
* Check if the chat channel allows muting.
|
||||||
}
|
*
|
||||||
|
* @return true if muting is allowed, false otherwise.
|
||||||
public Boolean isMutable() {
|
*/
|
||||||
|
public boolean isMutable() {
|
||||||
return mutable;
|
return 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() {
|
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;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColor(String color) {
|
/**
|
||||||
this.color = 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() {
|
public String getChatColor() {
|
||||||
return chatcolor;
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChatColor(String chatcolor) {
|
/**
|
||||||
this.chatcolor = chatcolor;
|
* Get the raw chat color value of the chat channel.
|
||||||
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
|
public String getChatColorRaw() {
|
||||||
|
return chatColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isDefaultchannel() {
|
/**
|
||||||
|
* Check if the chat channel is the default chat channel.
|
||||||
|
*
|
||||||
|
* @return true if the chat channel is the default chat channel, false
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isDefaultchannel() {
|
||||||
return defaultChannel;
|
return defaultChannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultChannel(Boolean defaultChannel) {
|
/**
|
||||||
this.defaultChannel = defaultChannel;
|
* Get the alias of the chat channel.
|
||||||
}
|
*
|
||||||
|
* @return {@link String}
|
||||||
|
*/
|
||||||
public String getAlias() {
|
public String getAlias() {
|
||||||
return alias;
|
return alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAlias(String alias) {
|
/**
|
||||||
this.alias = alias;
|
* Get the distance of the chat channel in blocks.
|
||||||
}
|
*
|
||||||
|
* @return double
|
||||||
public Double getDistance() {
|
*/
|
||||||
|
public double getDistance() {
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDistance(Double distance) {
|
/**
|
||||||
this.distance = distance;
|
* Checks if the chat channel has a distance set.
|
||||||
}
|
*
|
||||||
|
* @return true if the distance is greater than zero, false otherwise.
|
||||||
public Boolean hasDistance() {
|
*/
|
||||||
|
public boolean hasDistance() {
|
||||||
return distance > 0;
|
return distance > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean hasCooldown() {
|
/**
|
||||||
|
* Checks if the chat channel has a cooldown set.
|
||||||
|
*
|
||||||
|
* @return true if the cooldown is greater than zero, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean hasCooldown() {
|
||||||
return cooldown > 0;
|
return cooldown > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean hasPermission() {
|
/**
|
||||||
return !permission.equalsIgnoreCase("venturechat.none");
|
* Checks if the chat channel has a permission set.
|
||||||
|
*
|
||||||
|
* @return true if the permission does not equal
|
||||||
|
* {@link ChatChannel#NO_PERMISSIONS}, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean hasPermission() {
|
||||||
|
return !permission.equalsIgnoreCase(NO_PERMISSIONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isFiltered() {
|
/**
|
||||||
|
* 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 true if the chat channel has the filter enabled, false otherwise.
|
||||||
|
*/
|
||||||
|
public boolean isFiltered() {
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFilter(Boolean filter) {
|
/**
|
||||||
this.filter = filter;
|
* Compares the chat channel by name to determine equality.
|
||||||
}
|
*
|
||||||
|
* @param channel
|
||||||
public boolean isIRC() {
|
* Object to compare for equality.
|
||||||
return irc;
|
* @return true if the objects are equal, false otherwise.
|
||||||
}
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object channel) {
|
public boolean equals(Object channel) {
|
||||||
return channel instanceof ChatChannel && this.name.equals(((ChatChannel) channel).getName());
|
return channel instanceof ChatChannel && this.name.equals(((ChatChannel) channel).getName());
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineverse.Aust1n46.chat.command.chat;
|
package mineverse.Aust1n46.chat.command.chat;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -39,7 +38,7 @@ public class Channel extends MineverseCommand implements Listener {
|
|||||||
}
|
}
|
||||||
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
ChatChannel channel = ChatChannel.getChannel(args[0]);
|
||||||
plugin.getServer().getPluginManager().callEvent(new ChannelJoinEvent(mcp.getPlayer(), channel, LocalizedMessage.SET_CHANNEL.toString()
|
plugin.getServer().getPluginManager().callEvent(new ChannelJoinEvent(mcp.getPlayer(), channel, LocalizedMessage.SET_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName())));
|
.replace("{channel_name}", channel.getName())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
|
|
||||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||||
|
import mineverse.Aust1n46.chat.utilities.Format;
|
||||||
|
|
||||||
public class Channelinfo extends MineverseCommand {
|
public class Channelinfo extends MineverseCommand {
|
||||||
|
|
||||||
@ -30,27 +31,38 @@ public class Channelinfo extends MineverseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.GOLD + "Channel: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getName());
|
sender.sendMessage(ChatColor.GOLD + "Channel: " + chname.getColor() + chname.getName());
|
||||||
sender.sendMessage(ChatColor.GOLD + "Alias: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getAlias());
|
sender.sendMessage(ChatColor.GOLD + "Alias: " + chname.getColor() + chname.getAlias());
|
||||||
sender.sendMessage(ChatColor.GOLD + "Color: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getColor());
|
sender.sendMessage(ChatColor.GOLD + "Color: " + chname.getColor() + chname.getColorRaw());
|
||||||
sender.sendMessage(ChatColor.GOLD + "ChatColor: " + ChatColor.valueOf(chname.getChatColor().toUpperCase()) + chname.getChatColor());
|
sender.sendMessage(ChatColor.GOLD + "ChatColor: " + (chname.getChatColor().equalsIgnoreCase("None") ? Format.DEFAULT_COLOR_CODE : chname.getChatColor()) + chname.getChatColorRaw());
|
||||||
sender.sendMessage(ChatColor.GOLD + "Permission: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getPermission());
|
if(chname.hasPermission()) {
|
||||||
sender.sendMessage(ChatColor.GOLD + "Autojoin: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getAutojoin());
|
sender.sendMessage(ChatColor.GOLD + "Permission: " + chname.getColor() + chname.getPermission());
|
||||||
sender.sendMessage(ChatColor.GOLD + "Default: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.hasDistance());
|
}
|
||||||
|
else {
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "Permission: " + chname.getColor() + "None");
|
||||||
|
}
|
||||||
|
if(chname.hasSpeakPermission()) {
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "Speak Permission: " + chname.getColor() + chname.getSpeakPermission());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "Speak Permission: " + chname.getColor() + "None");
|
||||||
|
}
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "Autojoin: " + chname.getColor() + chname.getAutojoin());
|
||||||
|
sender.sendMessage(ChatColor.GOLD + "Default: " + chname.getColor() + chname.hasDistance());
|
||||||
if(!chname.hasDistance() || chname.getBungee()) {
|
if(!chname.hasDistance() || chname.getBungee()) {
|
||||||
sender.sendMessage(ChatColor.GOLD + "Distance: " + ChatColor.RED + "N/A");
|
sender.sendMessage(ChatColor.GOLD + "Distance: " + ChatColor.RED + "N/A");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(ChatColor.GOLD + "Distance: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getDistance().toString());
|
sender.sendMessage(ChatColor.GOLD + "Distance: " + chname.getColor() + chname.getDistance());
|
||||||
}
|
}
|
||||||
if(!chname.hasCooldown()) {
|
if(!chname.hasCooldown()) {
|
||||||
sender.sendMessage(ChatColor.GOLD + "Cooldown: " + ChatColor.RED + "N/A");
|
sender.sendMessage(ChatColor.GOLD + "Cooldown: " + ChatColor.RED + "N/A");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(ChatColor.GOLD + "Cooldown: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getCooldown());
|
sender.sendMessage(ChatColor.GOLD + "Cooldown: " + chname.getColor() + chname.getCooldown());
|
||||||
}
|
}
|
||||||
sender.sendMessage(ChatColor.GOLD + "Bungeecord: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getBungee().toString());
|
sender.sendMessage(ChatColor.GOLD + "Bungeecord: " + chname.getColor() + chname.getBungee());
|
||||||
sender.sendMessage(ChatColor.GOLD + "Format: " + ChatColor.valueOf(chname.getColor().toUpperCase()) + chname.getFormat());
|
sender.sendMessage(ChatColor.GOLD + "Format: " + chname.getColor() + chname.getFormat());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -34,11 +34,11 @@ public class Chatinfo extends MineverseCommand {
|
|||||||
mcp.getPlayer().sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + mcp.getName());
|
mcp.getPlayer().sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + mcp.getName());
|
||||||
for(String c : mcp.getListening()) {
|
for(String c : mcp.getListening()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(c);
|
ChatChannel channel = ChatChannel.getChannel(c);
|
||||||
listen += ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName() + " ";
|
listen += channel.getColor() + channel.getName() + " ";
|
||||||
}
|
}
|
||||||
for(String c : mcp.getMutes().keySet()) {
|
for(String c : mcp.getMutes().keySet()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(c);
|
ChatChannel channel = ChatChannel.getChannel(c);
|
||||||
mute += ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName() + " ";
|
mute += channel.getColor() + channel.getName() + " ";
|
||||||
}
|
}
|
||||||
for(String bc : mcp.getBlockedCommands()) {
|
for(String bc : mcp.getBlockedCommands()) {
|
||||||
blockedcommands += bc + " ";
|
blockedcommands += bc + " ";
|
||||||
@ -95,11 +95,11 @@ public class Chatinfo extends MineverseCommand {
|
|||||||
sender.sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + p.getName());
|
sender.sendMessage(ChatColor.GOLD + "Player: " + ChatColor.GREEN + p.getName());
|
||||||
for(String c : p.getListening()) {
|
for(String c : p.getListening()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(c);
|
ChatChannel channel = ChatChannel.getChannel(c);
|
||||||
listen += ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName() + " ";
|
listen += channel.getColor() + channel.getName() + " ";
|
||||||
}
|
}
|
||||||
for(String c : p.getMutes().keySet()) {
|
for(String c : p.getMutes().keySet()) {
|
||||||
ChatChannel channel = ChatChannel.getChannel(c);
|
ChatChannel channel = ChatChannel.getChannel(c);
|
||||||
mute += ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName() + " ";
|
mute += channel.getColor() + channel.getName() + " ";
|
||||||
}
|
}
|
||||||
for(String bc : p.getBlockedCommands()) {
|
for(String bc : p.getBlockedCommands()) {
|
||||||
blockedcommands += bc + " ";
|
blockedcommands += bc + " ";
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineverse.Aust1n46.chat.command.chat;
|
package mineverse.Aust1n46.chat.command.chat;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||||
@ -20,14 +19,14 @@ public class Chlist extends MineverseCommand {
|
|||||||
if(chname.hasPermission()) {
|
if(chname.hasPermission()) {
|
||||||
if(sender.hasPermission(chname.getPermission())) {
|
if(sender.hasPermission(chname.getPermission())) {
|
||||||
sender.sendMessage(LocalizedMessage.CHANNEL_LIST_WITH_PERMISSIONS.toString()
|
sender.sendMessage(LocalizedMessage.CHANNEL_LIST_WITH_PERMISSIONS.toString()
|
||||||
.replace("{channel_color}", (ChatColor.valueOf(chname.getColor().toUpperCase())).toString())
|
.replace("{channel_color}", (chname.getColor()).toString())
|
||||||
.replace("{channel_name}", chname.getName())
|
.replace("{channel_name}", chname.getName())
|
||||||
.replace("{channel_alias}", chname.getAlias()));
|
.replace("{channel_alias}", chname.getAlias()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(LocalizedMessage.CHANNEL_LIST.toString()
|
sender.sendMessage(LocalizedMessage.CHANNEL_LIST.toString()
|
||||||
.replace("{channel_color}", (ChatColor.valueOf(chname.getColor().toUpperCase())).toString())
|
.replace("{channel_color}", chname.getColor().toString())
|
||||||
.replace("{channel_name}", chname.getName())
|
.replace("{channel_name}", chname.getName())
|
||||||
.replace("{channel_alias}", chname.getAlias()));
|
.replace("{channel_alias}", chname.getAlias()));
|
||||||
}
|
}
|
||||||
|
@ -76,11 +76,11 @@ public class Chwho extends MineverseCommand {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(pluginManager.isPluginEnabled("Towny") && sender instanceof Player) {
|
if(plugin.getConfig().getBoolean("enable_towny_channel") && pluginManager.isPluginEnabled("Towny") && sender instanceof Player) {
|
||||||
try {
|
try {
|
||||||
|
if(channel.getName().equalsIgnoreCase("Town")) {
|
||||||
Resident r = TownyUniverse.getDataSource().getResident(p.getName());
|
Resident r = TownyUniverse.getDataSource().getResident(p.getName());
|
||||||
Resident pp = TownyUniverse.getDataSource().getResident(((Player) sender).getName());
|
Resident pp = TownyUniverse.getDataSource().getResident(((Player) sender).getName());
|
||||||
if(channel.getName().equalsIgnoreCase("Town")) {
|
|
||||||
if(!pp.hasTown()) {
|
if(!pp.hasTown()) {
|
||||||
if(playerlist.length() + p.getName().length() > linecount) {
|
if(playerlist.length() + p.getName().length() > linecount) {
|
||||||
playerlist += "\n";
|
playerlist += "\n";
|
||||||
@ -103,6 +103,8 @@ public class Chwho extends MineverseCommand {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(channel.getName().equalsIgnoreCase("Nation")) {
|
if(channel.getName().equalsIgnoreCase("Nation")) {
|
||||||
|
Resident r = TownyUniverse.getDataSource().getResident(p.getName());
|
||||||
|
Resident pp = TownyUniverse.getDataSource().getResident(((Player) sender).getName());
|
||||||
if(!pp.hasNation()) {
|
if(!pp.hasNation()) {
|
||||||
if(playerlist.length() + p.getName().length() > linecount) {
|
if(playerlist.length() + p.getName().length() > linecount) {
|
||||||
playerlist += "\n";
|
playerlist += "\n";
|
||||||
@ -129,11 +131,11 @@ public class Chwho extends MineverseCommand {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(pluginManager.isPluginEnabled("Factions") && sender instanceof Player) {
|
if(plugin.getConfig().getBoolean("enable_factions_channel") && pluginManager.isPluginEnabled("Factions") && sender instanceof Player) {
|
||||||
try {
|
try {
|
||||||
|
if(channel.getName().equalsIgnoreCase("Faction")) {
|
||||||
MPlayer mplayer = MPlayer.get(p.getPlayer());
|
MPlayer mplayer = MPlayer.get(p.getPlayer());
|
||||||
MPlayer mplayerp = MPlayer.get((Player) sender);
|
MPlayer mplayerp = MPlayer.get((Player) sender);
|
||||||
if(channel.getName().equalsIgnoreCase("Faction")) {
|
|
||||||
if(!mplayerp.hasFaction()) {
|
if(!mplayerp.hasFaction()) {
|
||||||
if(playerlist.length() + p.getName().length() > linecount) {
|
if(playerlist.length() + p.getName().length() > linecount) {
|
||||||
playerlist += "\n";
|
playerlist += "\n";
|
||||||
@ -177,7 +179,7 @@ public class Chwho extends MineverseCommand {
|
|||||||
playerlist = playerlist.substring(0, playerlist.length() - 2);
|
playerlist = playerlist.substring(0, playerlist.length() - 2);
|
||||||
}
|
}
|
||||||
sender.sendMessage(LocalizedMessage.CHANNEL_PLAYER_LIST_HEADER.toString()
|
sender.sendMessage(LocalizedMessage.CHANNEL_PLAYER_LIST_HEADER.toString()
|
||||||
.replace("{channel_color}", (ChatColor.valueOf(channel.getColor().toUpperCase())).toString())
|
.replace("{channel_color}", (channel.getColor()).toString())
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
sender.sendMessage(playerlist);
|
sender.sendMessage(playerlist);
|
||||||
return;
|
return;
|
||||||
@ -210,7 +212,7 @@ public class Chwho extends MineverseCommand {
|
|||||||
locreceip = p2.getLocation();
|
locreceip = p2.getLocation();
|
||||||
if(locreceip.getWorld() == p1.getWorld()) {
|
if(locreceip.getWorld() == p1.getWorld()) {
|
||||||
diff = locreceip.subtract(locsender);
|
diff = locreceip.subtract(locsender);
|
||||||
if(Math.abs(diff.getX()) > chDistance || Math.abs(diff.getZ()) > chDistance) {
|
if(Math.abs(diff.getX()) > chDistance || Math.abs(diff.getZ()) > chDistance || Math.abs(diff.getY()) > chDistance) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,12 +38,12 @@ public class Kickchannel extends MineverseCommand {
|
|||||||
}
|
}
|
||||||
sender.sendMessage(LocalizedMessage.KICK_CHANNEL.toString()
|
sender.sendMessage(LocalizedMessage.KICK_CHANNEL.toString()
|
||||||
.replace("{player}", args[0])
|
.replace("{player}", args[0])
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
player.removeListening(channel.getName());
|
player.removeListening(channel.getName());
|
||||||
if(player.isOnline()) {
|
if(player.isOnline()) {
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.LEAVE_CHANNEL.toString()
|
player.getPlayer().sendMessage(LocalizedMessage.LEAVE_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -34,7 +34,7 @@ public class Leave extends MineverseCommand {
|
|||||||
}
|
}
|
||||||
mcp.removeListening(channel.getName());
|
mcp.removeListening(channel.getName());
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.LEAVE_CHANNEL.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.LEAVE_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
if(mcp.getListening().size() == 0) {
|
if(mcp.getListening().size() == 0) {
|
||||||
mcp.addListening(ChatChannel.getDefaultChannel().getName());
|
mcp.addListening(ChatChannel.getDefaultChannel().getName());
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineverse.Aust1n46.chat.command.chat;
|
package mineverse.Aust1n46.chat.command.chat;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ public class Listen extends MineverseCommand {
|
|||||||
}
|
}
|
||||||
mcp.addListening(channel.getName());
|
mcp.addListening(channel.getName());
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.LISTEN_CHANNEL.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.LISTEN_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineverse.Aust1n46.chat.command.chat;
|
package mineverse.Aust1n46.chat.command.chat;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.MineverseChat;
|
import mineverse.Aust1n46.chat.MineverseChat;
|
||||||
@ -46,7 +45,7 @@ public class Setchannel extends MineverseCommand {
|
|||||||
player.removeListening(channel.getName());
|
player.removeListening(channel.getName());
|
||||||
sender.sendMessage(LocalizedMessage.SET_CHANNEL_PLAYER_CHANNEL_NO_PERMISSION.toString()
|
sender.sendMessage(LocalizedMessage.SET_CHANNEL_PLAYER_CHANNEL_NO_PERMISSION.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -55,7 +54,7 @@ public class Setchannel extends MineverseCommand {
|
|||||||
player.setCurrentChannel(channel);
|
player.setCurrentChannel(channel);
|
||||||
sender.sendMessage(LocalizedMessage.SET_CHANNEL_SENDER.toString()
|
sender.sendMessage(LocalizedMessage.SET_CHANNEL_SENDER.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
if(player.hasConversation()) {
|
if(player.hasConversation()) {
|
||||||
for(MineverseChatPlayer p : MineverseChat.onlinePlayers) {
|
for(MineverseChatPlayer p : MineverseChat.onlinePlayers) {
|
||||||
@ -74,7 +73,7 @@ public class Setchannel extends MineverseCommand {
|
|||||||
}
|
}
|
||||||
if(player.isOnline())
|
if(player.isOnline())
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
player.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
else
|
else
|
||||||
player.setModified(true);
|
player.setModified(true);
|
||||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -103,8 +102,8 @@ public class VentureChatGui extends MineverseCommand {
|
|||||||
skullMeta.setOwner(target.getName());
|
skullMeta.setOwner(target.getName());
|
||||||
skullMeta.setDisplayName("§b" + target.getName());
|
skullMeta.setDisplayName("§b" + target.getName());
|
||||||
List<String> skullLore = new ArrayList<String>();
|
List<String> skullLore = new ArrayList<String>();
|
||||||
skullLore.add("§7Channel: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName());
|
skullLore.add("§7Channel: " + channel.getColor() + channel.getName());
|
||||||
skullLore.add("§7Hash: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + hash);
|
skullLore.add("§7Hash: " + channel.getColor() + hash);
|
||||||
skullMeta.setLore(skullLore);
|
skullMeta.setLore(skullLore);
|
||||||
skull.setItemMeta(skullMeta);
|
skull.setItemMeta(skullMeta);
|
||||||
skull.setDurability((short) 3);
|
skull.setDurability((short) 3);
|
||||||
@ -162,8 +161,8 @@ public class VentureChatGui extends MineverseCommand {
|
|||||||
skullMeta.setOwner("Scarsz");
|
skullMeta.setOwner("Scarsz");
|
||||||
skullMeta.setDisplayName("§bDiscord_Message");
|
skullMeta.setDisplayName("§bDiscord_Message");
|
||||||
List<String> skullLore = new ArrayList<String>();
|
List<String> skullLore = new ArrayList<String>();
|
||||||
skullLore.add("§7Channel: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + channel.getName());
|
skullLore.add("§7Channel: " + channel.getColor() + channel.getName());
|
||||||
skullLore.add("§7Hash: " + ChatColor.valueOf(channel.getColor().toUpperCase()) + hash);
|
skullLore.add("§7Hash: " + channel.getColor() + hash);
|
||||||
skullMeta.setLore(skullLore);
|
skullMeta.setLore(skullLore);
|
||||||
skull.setItemMeta(skullMeta);
|
skull.setItemMeta(skullMeta);
|
||||||
skull.setDurability((short) 3);
|
skull.setDurability((short) 3);
|
||||||
|
@ -30,16 +30,16 @@ public class Venturechat extends MineverseCommand {
|
|||||||
sender.sendMessage(InternalMessage.VENTURECHAT_AUTHOR.toString());
|
sender.sendMessage(InternalMessage.VENTURECHAT_AUTHOR.toString());
|
||||||
if (sender instanceof Player && plugin.getConfig().getString("loglevel", "info").equals("debug")) {
|
if (sender instanceof Player && plugin.getConfig().getString("loglevel", "info").equals("debug")) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
String title = ChatColor.GOLD + " | " + ChatColor.BLUE.toString() + ChatColor.BOLD + "Click here to begin..." + ChatColor.RESET + ChatColor.GOLD + " | ";
|
String title = ChatColor.GOLD + " | " + ChatColor.BLUE.toString() + ChatColor.BOLD + "SpigotAPI chat message" + ChatColor.RESET + ChatColor.GOLD + " | ";
|
||||||
String spaces = " ";
|
String spaces = " ";
|
||||||
TextComponent tcSpaces = new TextComponent(spaces);
|
TextComponent tcSpaces = new TextComponent(spaces);
|
||||||
TextComponent message = new TextComponent(title);
|
TextComponent message = new TextComponent(title);
|
||||||
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click here to rank up!").create()));
|
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Click here to rank up!").create()));
|
||||||
message.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/rules 1"));
|
message.setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "Sample SpigotAPI Click Event"));
|
||||||
tcSpaces.addExtra(message);
|
tcSpaces.addExtra(message);
|
||||||
player.spigot().sendMessage(tcSpaces);
|
player.spigot().sendMessage(tcSpaces);
|
||||||
|
|
||||||
//sendActionBar(player, "NMS message");
|
// sendActionBar(player, "NMS ActionBar message");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ public class Message extends MineverseCommand {
|
|||||||
String send = "";
|
String send = "";
|
||||||
String echo = "";
|
String echo = "";
|
||||||
String spy = "";
|
String spy = "";
|
||||||
String tellColor = plugin.getConfig().getString("tellcolor", "gray");
|
|
||||||
for(int r = 1; r < args.length; r++) {
|
for(int r = 1; r < args.length; r++) {
|
||||||
msg += " " + args[r];
|
msg += " " + args[r];
|
||||||
}
|
}
|
||||||
@ -62,24 +61,9 @@ public class Message extends MineverseCommand {
|
|||||||
if(mcp.getPlayer().hasPermission("venturechat.format")) {
|
if(mcp.getPlayer().hasPermission("venturechat.format")) {
|
||||||
msg = Format.FormatString(msg);
|
msg = Format.FormatString(msg);
|
||||||
}
|
}
|
||||||
if(plugin.getConfig().getString("tellformatfrom").equalsIgnoreCase("Default")) {
|
|
||||||
send = "{playerfrom} messages you:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
send = Format.FormatStringAll(plugin.getConfig().getString("tellformatfrom")) + msg;
|
send = Format.FormatStringAll(plugin.getConfig().getString("tellformatfrom")) + msg;
|
||||||
}
|
|
||||||
if(plugin.getConfig().getString("tellformatto").equalsIgnoreCase("Default")) {
|
|
||||||
echo = "You message {playerto}:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo = Format.FormatStringAll(plugin.getConfig().getString("tellformatto")) + msg;
|
echo = Format.FormatStringAll(plugin.getConfig().getString("tellformatto")) + msg;
|
||||||
}
|
|
||||||
if(plugin.getConfig().getString("tellformatspy").equalsIgnoreCase("Default")) {
|
|
||||||
spy = "{playerfrom} messages {playerto}:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
spy = Format.FormatStringAll(plugin.getConfig().getString("tellformatspy")) + msg;
|
spy = Format.FormatStringAll(plugin.getConfig().getString("tellformatspy")) + msg;
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
out.writeUTF("Message");
|
out.writeUTF("Message");
|
||||||
out.writeUTF("Send");
|
out.writeUTF("Send");
|
||||||
|
@ -40,28 +40,12 @@ public class Reply extends MineverseCommand {
|
|||||||
String send = "";
|
String send = "";
|
||||||
String echo = "";
|
String echo = "";
|
||||||
String spy = "";
|
String spy = "";
|
||||||
String tellColor = plugin.getConfig().getString("tellcolor", "gray");
|
|
||||||
for(int r = 0; r < args.length; r++) {
|
for(int r = 0; r < args.length; r++) {
|
||||||
msg += " " + args[r];
|
msg += " " + args[r];
|
||||||
}
|
}
|
||||||
if(plugin.getConfig().getString("tellformatfrom").equalsIgnoreCase("Default")) {
|
send = Format.FormatStringAll(plugin.getConfig().getString("replyformatfrom")) + msg;
|
||||||
send = "{playerfrom} replies to you:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
echo = Format.FormatStringAll(plugin.getConfig().getString("replyformatto")) + msg;
|
||||||
}
|
spy = Format.FormatStringAll(plugin.getConfig().getString("replyformatspy")) + msg;
|
||||||
else {
|
|
||||||
send = Format.FormatStringAll(plugin.getConfig().getString("tellformatfrom")) + msg;
|
|
||||||
}
|
|
||||||
if(plugin.getConfig().getString("tellformatto").equalsIgnoreCase("Default")) {
|
|
||||||
echo = "You reply to {playerto}:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo = Format.FormatStringAll(plugin.getConfig().getString("tellformatto")) + msg;
|
|
||||||
}
|
|
||||||
if(plugin.getConfig().getString("tellformatspy").equalsIgnoreCase("Default")) {
|
|
||||||
spy = "{playerfrom} replied to {playerto}:" + ChatColor.valueOf(tellColor.toUpperCase()) + msg;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
spy = Format.FormatStringAll(plugin.getConfig().getString("tellformatspy")) + msg;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
out.writeUTF("Message");
|
out.writeUTF("Message");
|
||||||
out.writeUTF("Send");
|
out.writeUTF("Send");
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineverse.Aust1n46.chat.command.mute;
|
package mineverse.Aust1n46.chat.command.mute;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.MineverseChat;
|
import mineverse.Aust1n46.chat.MineverseChat;
|
||||||
@ -37,7 +36,7 @@ public class Mute extends MineverseCommand {
|
|||||||
if(player.isMuted(channel.getName())) {
|
if(player.isMuted(channel.getName())) {
|
||||||
sender.sendMessage(LocalizedMessage.PLAYER_ALREADY_MUTED.toString()
|
sender.sendMessage(LocalizedMessage.PLAYER_ALREADY_MUTED.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -45,11 +44,11 @@ public class Mute extends MineverseCommand {
|
|||||||
player.addMute(channel.getName(), 0);
|
player.addMute(channel.getName(), 0);
|
||||||
sender.sendMessage(LocalizedMessage.MUTE_PLAYER_SENDER.toString()
|
sender.sendMessage(LocalizedMessage.MUTE_PLAYER_SENDER.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
if(player.isOnline())
|
if(player.isOnline())
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_PLAYER.toString()
|
player.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_PLAYER.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
else
|
else
|
||||||
player.setModified(true);
|
player.setModified(true);
|
||||||
@ -59,7 +58,7 @@ public class Mute extends MineverseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sender.sendMessage(LocalizedMessage.CHANNEL_CANNOT_MUTE.toString()
|
sender.sendMessage(LocalizedMessage.CHANNEL_CANNOT_MUTE.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -72,7 +71,7 @@ public class Mute extends MineverseCommand {
|
|||||||
if(player.isMuted(channel.getName())) {
|
if(player.isMuted(channel.getName())) {
|
||||||
sender.sendMessage(LocalizedMessage.PLAYER_ALREADY_MUTED.toString()
|
sender.sendMessage(LocalizedMessage.PLAYER_ALREADY_MUTED.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -94,13 +93,13 @@ public class Mute extends MineverseCommand {
|
|||||||
keyword = "minute";
|
keyword = "minute";
|
||||||
sender.sendMessage(LocalizedMessage.MUTE_PLAYER_SENDER_TIME.toString()
|
sender.sendMessage(LocalizedMessage.MUTE_PLAYER_SENDER_TIME.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName())
|
.replace("{channel_name}", channel.getName())
|
||||||
.replace("{time}", time + "")
|
.replace("{time}", time + "")
|
||||||
.replace("{units}", keyword));
|
.replace("{units}", keyword));
|
||||||
if(player.isOnline())
|
if(player.isOnline())
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_PLAYER_TIME.toString()
|
player.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_PLAYER_TIME.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName())
|
.replace("{channel_name}", channel.getName())
|
||||||
.replace("{time}", time + "")
|
.replace("{time}", time + "")
|
||||||
.replace("{units}", keyword));
|
.replace("{units}", keyword));
|
||||||
@ -121,7 +120,7 @@ public class Mute extends MineverseCommand {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sender.sendMessage(LocalizedMessage.CHANNEL_CANNOT_MUTE.toString()
|
sender.sendMessage(LocalizedMessage.CHANNEL_CANNOT_MUTE.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package mineverse.Aust1n46.chat.command.mute;
|
package mineverse.Aust1n46.chat.command.mute;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import mineverse.Aust1n46.chat.MineverseChat;
|
import mineverse.Aust1n46.chat.MineverseChat;
|
||||||
@ -36,19 +35,19 @@ public class Unmute extends MineverseCommand {
|
|||||||
if(!player.isMuted(channel.getName())) {
|
if(!player.isMuted(channel.getName())) {
|
||||||
sender.sendMessage(LocalizedMessage.PLAYER_NOT_MUTED.toString()
|
sender.sendMessage(LocalizedMessage.PLAYER_NOT_MUTED.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.removeMute(channel.getName());
|
player.removeMute(channel.getName());
|
||||||
sender.sendMessage(LocalizedMessage.UNMUTE_PLAYER_SENDER.toString()
|
sender.sendMessage(LocalizedMessage.UNMUTE_PLAYER_SENDER.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
if(player.isOnline()) {
|
if(player.isOnline()) {
|
||||||
player.getPlayer().sendMessage(LocalizedMessage.UNMUTE_PLAYER_PLAYER.toString()
|
player.getPlayer().sendMessage(LocalizedMessage.UNMUTE_PLAYER_PLAYER.toString()
|
||||||
.replace("{player}", player.getName())
|
.replace("{player}", player.getName())
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -227,7 +227,7 @@ public class ChatListener implements Listener {
|
|||||||
timedMute = " for " + remaining + " more " + keyword;
|
timedMute = " for " + remaining + " more " + keyword;
|
||||||
}
|
}
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.CHANNEL_MUTED.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.CHANNEL_MUTED.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", eventChannel.getColor() + "")
|
||||||
.replace("{channel_name}", eventChannel.getName())
|
.replace("{channel_name}", eventChannel.getName())
|
||||||
.replace("{time}", timedMute));
|
.replace("{time}", timedMute));
|
||||||
mcp.setQuickChat(false);
|
mcp.setQuickChat(false);
|
||||||
@ -243,7 +243,12 @@ public class ChatListener implements Listener {
|
|||||||
mcp.setCurrentChannel(ChatChannel.getDefaultChannel());
|
mcp.setCurrentChannel(ChatChannel.getDefaultChannel());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
curColor = eventChannel.getChatColor().toUpperCase();
|
if(eventChannel.hasSpeakPermission() && !mcp.getPlayer().hasPermission(eventChannel.getSpeakPermission())) {
|
||||||
|
mcp.getPlayer().sendMessage(LocalizedMessage.CHANNEL_NO_SPEAK_PERMISSIONS.toString());
|
||||||
|
mcp.setQuickChat(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
curColor = eventChannel.getChatColor();
|
||||||
bungee = eventChannel.getBungee();
|
bungee = eventChannel.getBungee();
|
||||||
|
|
||||||
int time = (int) (System.currentTimeMillis() / 1000);
|
int time = (int) (System.currentTimeMillis() / 1000);
|
||||||
@ -294,7 +299,7 @@ public class ChatListener implements Listener {
|
|||||||
}
|
}
|
||||||
mcp.getSpam().get(eventChannel).set(0, 0);
|
mcp.getSpam().get(eventChannel).set(0, 0);
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_SPAM.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.MUTE_PLAYER_SPAM.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(eventChannel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", eventChannel.getColor() + "")
|
||||||
.replace("{channel_name}", eventChannel.getName())
|
.replace("{channel_name}", eventChannel.getName())
|
||||||
.replace("{time}", timedmute));
|
.replace("{time}", timedmute));
|
||||||
mcp.setQuickChat(false);
|
mcp.setQuickChat(false);
|
||||||
@ -323,7 +328,7 @@ public class ChatListener implements Listener {
|
|||||||
chDistance = eventChannel.getDistance();
|
chDistance = eventChannel.getDistance();
|
||||||
}
|
}
|
||||||
|
|
||||||
format = PlaceholderAPI.setBracketPlaceholders(mcp.getPlayer(), Format.FormatStringAll(plugin.getConfig().getConfigurationSection("channels." + eventChannel.getName()).getString("format")));
|
format = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(mcp.getPlayer(), Format.FormatStringAll(plugin.getConfig().getConfigurationSection("channels." + eventChannel.getName()).getString("format"))));
|
||||||
if(plugin.getConfig().getBoolean("formatcleaner", false)) {
|
if(plugin.getConfig().getBoolean("formatcleaner", false)) {
|
||||||
format = format.replace("[]", " ");
|
format = format.replace("[]", " ");
|
||||||
format = format.replace(" ", " ").replace(" ", " ").replace(" ", " ");
|
format = format.replace(" ", " ").replace(" ", " ").replace(" ", " ");
|
||||||
@ -350,9 +355,9 @@ public class ChatListener implements Listener {
|
|||||||
}
|
}
|
||||||
if(plugin.getConfig().getBoolean("enable_towny_channel") && pluginManager.isPluginEnabled("Towny")) {
|
if(plugin.getConfig().getBoolean("enable_towny_channel") && pluginManager.isPluginEnabled("Towny")) {
|
||||||
try {
|
try {
|
||||||
|
if(eventChannel.getName().equalsIgnoreCase("Town")) {
|
||||||
Resident r = TownyUniverse.getDataSource().getResident(p.getName());
|
Resident r = TownyUniverse.getDataSource().getResident(p.getName());
|
||||||
Resident pp = TownyUniverse.getDataSource().getResident(mcp.getName());
|
Resident pp = TownyUniverse.getDataSource().getResident(mcp.getName());
|
||||||
if(eventChannel.getName().equalsIgnoreCase("Town")) {
|
|
||||||
if(!pp.hasTown()) {
|
if(!pp.hasTown()) {
|
||||||
recipients.remove(p.getPlayer());
|
recipients.remove(p.getPlayer());
|
||||||
recipientCount--;
|
recipientCount--;
|
||||||
@ -370,6 +375,8 @@ public class ChatListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(eventChannel.getName().equalsIgnoreCase("Nation")) {
|
if(eventChannel.getName().equalsIgnoreCase("Nation")) {
|
||||||
|
Resident r = TownyUniverse.getDataSource().getResident(p.getName());
|
||||||
|
Resident pp = TownyUniverse.getDataSource().getResident(mcp.getName());
|
||||||
if(!pp.hasNation()) {
|
if(!pp.hasNation()) {
|
||||||
recipients.remove(p.getPlayer());
|
recipients.remove(p.getPlayer());
|
||||||
recipientCount--;
|
recipientCount--;
|
||||||
@ -394,9 +401,9 @@ public class ChatListener implements Listener {
|
|||||||
|
|
||||||
if(plugin.getConfig().getBoolean("enable_factions_channel") && pluginManager.isPluginEnabled("Factions")) {
|
if(plugin.getConfig().getBoolean("enable_factions_channel") && pluginManager.isPluginEnabled("Factions")) {
|
||||||
try {
|
try {
|
||||||
|
if(eventChannel.getName().equalsIgnoreCase("Faction")) {
|
||||||
MPlayer mplayer = MPlayer.get(mcp.getPlayer());
|
MPlayer mplayer = MPlayer.get(mcp.getPlayer());
|
||||||
MPlayer mplayerp = MPlayer.get(p.getPlayer());
|
MPlayer mplayerp = MPlayer.get(p.getPlayer());
|
||||||
if(eventChannel.getName().equalsIgnoreCase("Faction")) {
|
|
||||||
if(!mplayer.hasFaction()) {
|
if(!mplayer.hasFaction()) {
|
||||||
recipients.remove(p.getPlayer());
|
recipients.remove(p.getPlayer());
|
||||||
recipientCount--;
|
recipientCount--;
|
||||||
@ -420,7 +427,7 @@ public class ChatListener implements Listener {
|
|||||||
locreceip = p.getPlayer().getLocation();
|
locreceip = p.getPlayer().getLocation();
|
||||||
if(locreceip.getWorld() == mcp.getPlayer().getWorld()) {
|
if(locreceip.getWorld() == mcp.getPlayer().getWorld()) {
|
||||||
diff = locreceip.subtract(locsender);
|
diff = locreceip.subtract(locsender);
|
||||||
if(Math.abs(diff.getX()) > chDistance || Math.abs(diff.getZ()) > chDistance) {
|
if(Math.abs(diff.getX()) > chDistance || Math.abs(diff.getZ()) > chDistance || Math.abs(diff.getY()) > chDistance) {
|
||||||
recipients.remove(p.getPlayer());
|
recipients.remove(p.getPlayer());
|
||||||
recipientCount--;
|
recipientCount--;
|
||||||
continue;
|
continue;
|
||||||
@ -457,7 +464,7 @@ public class ChatListener implements Listener {
|
|||||||
chat = Format.getLastCode(format) + chat;
|
chat = Format.getLastCode(format) + chat;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
chat = ChatColor.valueOf(curColor) + chat;
|
chat = curColor + chat;
|
||||||
}
|
}
|
||||||
|
|
||||||
String globalJSON = Format.convertToJson(mcp, format, chat);
|
String globalJSON = Format.convertToJson(mcp, format, chat);
|
||||||
|
@ -150,7 +150,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
if(!channel.hasPermission() || mcp.getPlayer().hasPermission(channel.getPermission())) {
|
if(!channel.hasPermission() || mcp.getPlayer().hasPermission(channel.getPermission())) {
|
||||||
if(message.equals("/" + channel.getAlias())) {
|
if(message.equals("/" + channel.getAlias())) {
|
||||||
mcp.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
mcp.getPlayer().sendMessage(LocalizedMessage.SET_CHANNEL.toString()
|
||||||
.replace("{channel_color}", ChatColor.valueOf(channel.getColor().toUpperCase()) + "")
|
.replace("{channel_color}", channel.getColor() + "")
|
||||||
.replace("{channel_name}", channel.getName()));
|
.replace("{channel_name}", channel.getName()));
|
||||||
if(mcp.hasConversation()) {
|
if(mcp.hasConversation()) {
|
||||||
for(MineverseChatPlayer p : MineverseChat.onlinePlayers) {
|
for(MineverseChatPlayer p : MineverseChat.onlinePlayers) {
|
||||||
@ -262,7 +262,7 @@ public class CommandListener implements CommandExecutor, Listener {
|
|||||||
if(target != null) {
|
if(target != null) {
|
||||||
command = command.replace("{player_name}", target.getName());
|
command = command.replace("{player_name}", target.getName());
|
||||||
if(target.isOnline()) {
|
if(target.isOnline()) {
|
||||||
command = PlaceholderAPI.setBracketPlaceholders(target.getPlayer(), command);
|
command = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(target.getPlayer(), command));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -28,7 +28,7 @@ public class PacketListener extends PacketAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer(event.getPlayer());
|
MineverseChatPlayer mcp = MineverseChatAPI.getOnlineMineverseChatPlayer(event.getPlayer());
|
||||||
if(mcp == null) {
|
if(mcp == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ public class Localization {
|
|||||||
private static MineverseChat plugin = MineverseChat.getInstance();
|
private static MineverseChat plugin = MineverseChat.getInstance();
|
||||||
private static FileConfiguration localization;
|
private static FileConfiguration localization;
|
||||||
|
|
||||||
private static final String VERSION = "2.18.2";
|
private static final String VERSION = "2.20.0";
|
||||||
|
|
||||||
public static void initialize() {
|
public static void initialize() {
|
||||||
File localizationFile = new File(plugin.getDataFolder().getAbsolutePath(), "Messages.yml");
|
File localizationFile = new File(plugin.getDataFolder().getAbsolutePath(), "Messages.yml");
|
||||||
|
@ -21,6 +21,7 @@ public enum LocalizedMessage {
|
|||||||
CHANNEL_LIST_WITH_PERMISSIONS("ChannelListWithPermissions"),
|
CHANNEL_LIST_WITH_PERMISSIONS("ChannelListWithPermissions"),
|
||||||
CHANNEL_NO_PERMISSION("ChannelNoPermission"),
|
CHANNEL_NO_PERMISSION("ChannelNoPermission"),
|
||||||
CHANNEL_NO_PERMISSION_VIEW("ChannelNoPermissionView"),
|
CHANNEL_NO_PERMISSION_VIEW("ChannelNoPermissionView"),
|
||||||
|
CHANNEL_NO_SPEAK_PERMISSIONS("ChannelNoSpeakPermissions"),
|
||||||
CHANNEL_PLAYER_LIST_HEADER("ChannelPlayerListHeader"),
|
CHANNEL_PLAYER_LIST_HEADER("ChannelPlayerListHeader"),
|
||||||
CHANNEL_MUTED("ChannelMuted"),
|
CHANNEL_MUTED("ChannelMuted"),
|
||||||
COMMAND_INVALID_ARGUMENTS("CommandInvalidArguments"),
|
COMMAND_INVALID_ARGUMENTS("CommandInvalidArguments"),
|
||||||
|
@ -26,6 +26,13 @@ import mineverse.Aust1n46.chat.versions.VersionHandler;
|
|||||||
public class Format {
|
public class Format {
|
||||||
private static MineverseChat plugin = MineverseChat.getInstance();
|
private static MineverseChat plugin = MineverseChat.getInstance();
|
||||||
|
|
||||||
|
public static final int LEGACY_COLOR_CODE_LENGTH = 2;
|
||||||
|
public static final int HEX_COLOR_CODE_LENGTH = 14;
|
||||||
|
public static final String DEFAULT_COLOR_CODE = String.valueOf(ChatColor.WHITE);
|
||||||
|
public static final String HEX_COLOR_CODE_PREFIX = "#";
|
||||||
|
public static final String BUKKIT_COLOR_CODE_PREFIX = "§";
|
||||||
|
public static final String BUKKIT_HEX_COLOR_CODE_PREFIX = "x";
|
||||||
|
|
||||||
public static String convertToJson(MineverseChatPlayer sender, String format, String chat) {
|
public static String convertToJson(MineverseChatPlayer sender, String format, String chat) {
|
||||||
JsonFormat JSONformat = MineverseChat.jfInfo.getJsonFormat(sender.getJsonFormat());
|
JsonFormat JSONformat = MineverseChat.jfInfo.getJsonFormat(sender.getJsonFormat());
|
||||||
String f = format.replace("\\", "\\\\").replace("\"", "\\\"");
|
String f = format.replace("\\", "\\\\").replace("\"", "\\\"");
|
||||||
@ -36,10 +43,11 @@ public class Format {
|
|||||||
try {
|
try {
|
||||||
prefix = FormatStringAll(MineverseChat.chat.getPlayerPrefix(sender.getPlayer()));
|
prefix = FormatStringAll(MineverseChat.chat.getPlayerPrefix(sender.getPlayer()));
|
||||||
suffix = FormatStringAll(MineverseChat.chat.getPlayerSuffix(sender.getPlayer()));
|
suffix = FormatStringAll(MineverseChat.chat.getPlayerSuffix(sender.getPlayer()));
|
||||||
if(suffix.equals("")) {
|
//Don't apply JSON if the prefix or suffix is just a color code
|
||||||
|
if(suffix.isEmpty() || (suffix.length() == 2 && suffix.substring(1).matches("[0-9a-fA-F]"))) {
|
||||||
suffix = "venturechat_no_suffix_code";
|
suffix = "venturechat_no_suffix_code";
|
||||||
}
|
}
|
||||||
if(prefix.equals("")) {
|
if(prefix.isEmpty() || (prefix.length() == 2 && prefix.substring(1).matches("[0-9a-fA-F]"))) {
|
||||||
prefix = "venturechat_no_prefix_code";
|
prefix = "venturechat_no_prefix_code";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,26 +99,26 @@ public class Format {
|
|||||||
String hover = "";
|
String hover = "";
|
||||||
if(placeholder.contains(prefix)) {
|
if(placeholder.contains(prefix)) {
|
||||||
action = format.getClickPrefix();
|
action = format.getClickPrefix();
|
||||||
text = PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), format.getClickPrefixText());
|
text = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), format.getClickPrefixText()));
|
||||||
for(String st : format.getHoverTextPrefix()) {
|
for(String st : format.getHoverTextPrefix()) {
|
||||||
hover += Format.FormatStringAll(st) + "\n";
|
hover += Format.FormatStringAll(st) + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(placeholder.contains(nickname)) {
|
if(placeholder.contains(nickname)) {
|
||||||
action = format.getClickName();
|
action = format.getClickName();
|
||||||
text = PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), format.getClickNameText());
|
text = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), format.getClickNameText()));
|
||||||
for(String st : format.getHoverTextName()) {
|
for(String st : format.getHoverTextName()) {
|
||||||
hover += Format.FormatStringAll(st) + "\n";
|
hover += Format.FormatStringAll(st) + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(placeholder.contains(suffix)) {
|
if(placeholder.contains(suffix)) {
|
||||||
action = format.getClickSuffix();
|
action = format.getClickSuffix();
|
||||||
text = PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), format.getClickSuffixText());
|
text = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), format.getClickSuffixText()));
|
||||||
for(String st : format.getHoverTextSuffix()) {
|
for(String st : format.getHoverTextSuffix()) {
|
||||||
hover += Format.FormatStringAll(st) + "\n";
|
hover += Format.FormatStringAll(st) + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hover = PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), hover.substring(0, hover.length() - 1));
|
hover = Format.FormatStringAll(PlaceholderAPI.setBracketPlaceholders(icp.getPlayer(), hover.substring(0, hover.length() - 1)));
|
||||||
temp += convertToJsonColors(lastCode + placeholder, ",\"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + text + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(hover) + "]}}") + ",";
|
temp += convertToJsonColors(lastCode + placeholder, ",\"clickEvent\":{\"action\":\"" + action + "\",\"value\":\"" + text + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(hover) + "]}}") + ",";
|
||||||
lastCode = getLastCode(lastCode + placeholder);
|
lastCode = getLastCode(lastCode + placeholder);
|
||||||
remaining = remaining.substring(indexEnd);
|
remaining = remaining.substring(indexEnd);
|
||||||
@ -143,7 +151,7 @@ public class Format {
|
|||||||
String https = "";
|
String https = "";
|
||||||
if(ChatColor.stripColor(link).contains("https://"))
|
if(ChatColor.stripColor(link).contains("https://"))
|
||||||
https = "s";
|
https = "s";
|
||||||
temp += convertToJsonColors(lastCode + link, ",\"underlined\":\"" + plugin.getConfig().getBoolean("underlineurls", true) + "\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http" + https + "://" + ChatColor.stripColor(link.replace("http://", "").replace("https://", "")) + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(lastCode + link) + "]}}") + ",";
|
temp += convertToJsonColors(lastCode + link, ",\"underlined\":\"" + underlineURLs() + "\",\"clickEvent\":{\"action\":\"open_url\",\"value\":\"http" + https + "://" + ChatColor.stripColor(link.replace("http://", "").replace("https://", "")) + "\"},\"hoverEvent\":{\"action\":\"show_text\",\"value\":{\"text\":\"\",\"extra\":[" + convertToJsonColors(lastCode + link) + "]}}") + ",";
|
||||||
lastCode = getLastCode(lastCode + link);
|
lastCode = getLastCode(lastCode + link);
|
||||||
remaining = remaining.substring(indexLinkEnd);
|
remaining = remaining.substring(indexLinkEnd);
|
||||||
}
|
}
|
||||||
@ -160,10 +168,20 @@ public class Format {
|
|||||||
String ts = "";
|
String ts = "";
|
||||||
char[] ch = s.toCharArray();
|
char[] ch = s.toCharArray();
|
||||||
for(int a = 0; a < s.length() - 1; a ++) {
|
for(int a = 0; a < s.length() - 1; a ++) {
|
||||||
if(String.valueOf(ch[a + 1]).matches("[lkonmr0123456789abcdef]") && ch[a] == '§') {
|
if(String.valueOf(ch[a + 1]).matches("[lkomnLKOMN]") && ch[a] == '§') {
|
||||||
ts += String.valueOf(ch[a]) + ch[a + 1];
|
ts += String.valueOf(ch[a]) + ch[a + 1];
|
||||||
if(String.valueOf(ch[a + 1]).matches("[0123456789abcdefr]")) {
|
a ++;
|
||||||
|
}
|
||||||
|
else if(String.valueOf(ch[a + 1]).matches("[0123456789abcdefrABCDEFR]") && ch[a] == '§') {
|
||||||
ts = String.valueOf(ch[a]) + ch[a + 1];
|
ts = String.valueOf(ch[a]) + ch[a + 1];
|
||||||
|
a ++;
|
||||||
|
}
|
||||||
|
else if(ch[a + 1] == 'x' && ch[a] == '§') {
|
||||||
|
if(ch.length > a + 13) {
|
||||||
|
if(String.valueOf(ch[a + 3]).matches("[0123456789abcdefABCDEF]") && String.valueOf(ch[a + 5]).matches("[0123456789abcdefABCDEF]") && String.valueOf(ch[a + 7]).matches("[0123456789abcdefABCDEF]") && String.valueOf(ch[a + 9]).matches("[0123456789abcdefABCDEF]") && String.valueOf(ch[a + 11]).matches("[0123456789abcdefABCDEF]") && String.valueOf(ch[a + 13]).matches("[0123456789abcdefABCDEF]") && ch[a + 2] == '§' && ch[a + 4] == '§' && ch[a + 6] == '§' && ch[a + 8] == '§' && ch[a + 10] == '§' && ch[a + 12] == '§') {
|
||||||
|
ts = String.valueOf(ch[a]) + ch[a + 1] + ch[a + 2] + ch[a + 3] + ch[a + 4] + ch[a + 5] + ch[a + 6] + ch[a + 7] + ch[a + 8] + ch[a + 9] + ch[a + 10] + ch[a + 11] + ch[a + 12] + ch[a + 13];
|
||||||
|
a += 13;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,46 +202,65 @@ public class Format {
|
|||||||
boolean bold = false;
|
boolean bold = false;
|
||||||
boolean obfuscated = false;
|
boolean obfuscated = false;
|
||||||
boolean italic = false;
|
boolean italic = false;
|
||||||
boolean underlined = false;
|
|
||||||
boolean strikethrough = false;
|
boolean strikethrough = false;
|
||||||
|
boolean underlined = false;
|
||||||
String previousColor = "";
|
String previousColor = "";
|
||||||
|
int colorLength = LEGACY_COLOR_CODE_LENGTH;
|
||||||
do {
|
do {
|
||||||
if(remaining.length() < 2) {
|
if(remaining.length() < LEGACY_COLOR_CODE_LENGTH) {
|
||||||
temp = "{\"text\":\"" + remaining + "\"},";
|
temp = "{\"text\":\"" + remaining + "\"},";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
modifier = "";
|
modifier = "";
|
||||||
indexColor = remaining.indexOf("§");
|
indexColor = remaining.indexOf(BUKKIT_COLOR_CODE_PREFIX);
|
||||||
previousColor = color;
|
previousColor = color;
|
||||||
color = remaining.substring(1, indexColor + 2);
|
|
||||||
if(!color.matches("[0123456789abcdef]")) {
|
color = remaining.substring(1, indexColor + LEGACY_COLOR_CODE_LENGTH);
|
||||||
switch(color) {
|
if(color.equals(BUKKIT_HEX_COLOR_CODE_PREFIX)) {
|
||||||
case "l": {
|
if(remaining.length() >= HEX_COLOR_CODE_LENGTH) {
|
||||||
bold = true;
|
color = HEX_COLOR_CODE_PREFIX + remaining.substring(LEGACY_COLOR_CODE_LENGTH, indexColor + HEX_COLOR_CODE_LENGTH).replace(BUKKIT_COLOR_CODE_PREFIX, "");
|
||||||
break;
|
colorLength = HEX_COLOR_CODE_LENGTH;
|
||||||
}
|
|
||||||
case "k": {
|
|
||||||
obfuscated = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "o": {
|
|
||||||
italic = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "n": {
|
|
||||||
underlined = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "m": {
|
|
||||||
strikethrough = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "r": {
|
|
||||||
bold = false;
|
bold = false;
|
||||||
obfuscated = false;
|
obfuscated = false;
|
||||||
italic = false;
|
italic = false;
|
||||||
underlined = false;
|
|
||||||
strikethrough = false;
|
strikethrough = false;
|
||||||
|
underlined = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!color.matches("[0123456789abcdefABCDEF]")) {
|
||||||
|
switch(color) {
|
||||||
|
case "l":
|
||||||
|
case "L": {
|
||||||
|
bold = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "k":
|
||||||
|
case "K": {
|
||||||
|
obfuscated = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "o":
|
||||||
|
case "O": {
|
||||||
|
italic = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "m":
|
||||||
|
case "M": {
|
||||||
|
strikethrough = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "n":
|
||||||
|
case "N": {
|
||||||
|
underlined = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "r":
|
||||||
|
case "R": {
|
||||||
|
bold = false;
|
||||||
|
obfuscated = false;
|
||||||
|
italic = false;
|
||||||
|
strikethrough = false;
|
||||||
|
underlined = false;
|
||||||
color = "f";
|
color = "f";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -237,8 +274,8 @@ public class Format {
|
|||||||
bold = false;
|
bold = false;
|
||||||
obfuscated = false;
|
obfuscated = false;
|
||||||
italic = false;
|
italic = false;
|
||||||
underlined = false;
|
|
||||||
strikethrough = false;
|
strikethrough = false;
|
||||||
|
underlined = false;
|
||||||
}
|
}
|
||||||
if(bold)
|
if(bold)
|
||||||
modifier += ",\"bold\":\"true\"";
|
modifier += ",\"bold\":\"true\"";
|
||||||
@ -250,12 +287,13 @@ public class Format {
|
|||||||
modifier += ",\"underlined\":\"true\"";
|
modifier += ",\"underlined\":\"true\"";
|
||||||
if(strikethrough)
|
if(strikethrough)
|
||||||
modifier += ",\"strikethrough\":\"true\"";
|
modifier += ",\"strikethrough\":\"true\"";
|
||||||
remaining = remaining.substring(2);
|
remaining = remaining.substring(colorLength);
|
||||||
indexNextColor = remaining.indexOf("§");
|
colorLength = LEGACY_COLOR_CODE_LENGTH;
|
||||||
|
indexNextColor = remaining.indexOf(BUKKIT_COLOR_CODE_PREFIX);
|
||||||
if(indexNextColor == -1) {
|
if(indexNextColor == -1) {
|
||||||
indexNextColor = remaining.length();
|
indexNextColor = remaining.length();
|
||||||
}
|
}
|
||||||
temp += "{\"text\":\"" + remaining.substring(0, indexNextColor) + "\",\"color\":\"" + hexidecimalToJsonColor(color) + "\"" + modifier + extensions + "},";
|
temp += "{\"text\":\"" + remaining.substring(0, indexNextColor) + "\",\"color\":\"" + hexidecimalToJsonColorRGB(color) + "\"" + modifier + extensions + "},";
|
||||||
remaining = remaining.substring(indexNextColor);
|
remaining = remaining.substring(indexNextColor);
|
||||||
}
|
}
|
||||||
while(remaining.length() > 1 && indexColor != -1);
|
while(remaining.length() > 1 && indexColor != -1);
|
||||||
@ -264,7 +302,8 @@ public class Format {
|
|||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String hexidecimalToJsonColor(String c) {
|
private static String hexidecimalToJsonColorRGB(String c) {
|
||||||
|
if(c.length() == 1) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case "0": return "black";
|
case "0": return "black";
|
||||||
case "1": return "dark_blue";
|
case "1": return "dark_blue";
|
||||||
@ -276,14 +315,25 @@ public class Format {
|
|||||||
case "7": return "gray";
|
case "7": return "gray";
|
||||||
case "8": return "dark_gray";
|
case "8": return "dark_gray";
|
||||||
case "9": return "blue";
|
case "9": return "blue";
|
||||||
case "a": return "green";
|
case "a":
|
||||||
case "b": return "aqua";
|
case "A": return "green";
|
||||||
case "c": return "red";
|
case "b":
|
||||||
case "d": return "light_purple";
|
case "B": return "aqua";
|
||||||
case "e": return "yellow";
|
case "c":
|
||||||
case "f": return "white";
|
case "C": return "red";
|
||||||
|
case "d":
|
||||||
|
case "D": return "light_purple";
|
||||||
|
case "e":
|
||||||
|
case "E": return "yellow";
|
||||||
|
case "f":
|
||||||
|
case "F": return "white";
|
||||||
|
default: return "white";
|
||||||
}
|
}
|
||||||
return "";
|
}
|
||||||
|
if(isValidHexColor(c)) {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
return "white";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String convertPlainTextToJson(String s, boolean convertURL) {
|
public static String convertPlainTextToJson(String s, boolean convertURL) {
|
||||||
@ -387,62 +437,42 @@ public class Format {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Pattern chatColorPattern = Pattern.compile("(?i)&([0-9A-F])");
|
protected static Pattern chatColorPattern = Pattern.compile("(?i)&([0-9])");
|
||||||
protected static Pattern chatMagicPattern = Pattern.compile("(?i)&([K])");
|
|
||||||
protected static Pattern chatBoldPattern = Pattern.compile("(?i)&([L])");
|
|
||||||
protected static Pattern chatStrikethroughPattern = Pattern.compile("(?i)&([M])");
|
|
||||||
protected static Pattern chatUnderlinePattern = Pattern.compile("(?i)&([N])");
|
|
||||||
protected static Pattern chatItalicPattern = Pattern.compile("(?i)&([O])");
|
|
||||||
protected static Pattern chatResetPattern = Pattern.compile("(?i)&([R])");
|
|
||||||
|
|
||||||
public static String FormatStringColor(String string) {
|
public static String FormatStringColor(String string) {
|
||||||
String allFormated = string;
|
String allFormated = string;
|
||||||
allFormated = chatColorPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
allFormated = chatColorPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
||||||
|
|
||||||
|
allFormated = allFormated.replaceAll("&[x]", "§x");
|
||||||
|
allFormated = allFormated.replaceAll("&[aA]", "§a");
|
||||||
|
allFormated = allFormated.replaceAll("&[bB]", "§b");
|
||||||
|
allFormated = allFormated.replaceAll("&[cC]", "§c");
|
||||||
|
allFormated = allFormated.replaceAll("&[dD]", "§d");
|
||||||
|
allFormated = allFormated.replaceAll("&[eE]", "§e");
|
||||||
|
allFormated = allFormated.replaceAll("&[fF]", "§f");
|
||||||
|
|
||||||
allFormated = allFormated.replaceAll("%", "\\%");
|
allFormated = allFormated.replaceAll("%", "\\%");
|
||||||
|
|
||||||
|
allFormated = convertHexColorCodeStringToBukkitColorCodeString(allFormated);
|
||||||
return allFormated;
|
return allFormated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatString(String string) {
|
public static String FormatString(String string) {
|
||||||
String allFormated = string;
|
String allFormated = string;
|
||||||
allFormated = chatMagicPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
allFormated = allFormated.replaceAll("&[kK]", "§k");
|
||||||
allFormated = chatBoldPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
allFormated = allFormated.replaceAll("&[lL]", "§l");
|
||||||
allFormated = chatStrikethroughPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
allFormated = allFormated.replaceAll("&[mM]", "§m");
|
||||||
allFormated = chatUnderlinePattern.matcher(allFormated).replaceAll("\u00A7$1");
|
allFormated = allFormated.replaceAll("&[nN]", "§n");
|
||||||
allFormated = chatItalicPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
allFormated = allFormated.replaceAll("&[oO]", "§o");
|
||||||
allFormated = chatResetPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
allFormated = allFormated.replaceAll("&[rR]", "§r");
|
||||||
|
|
||||||
allFormated = allFormated.replaceAll("%", "\\%");
|
allFormated = allFormated.replaceAll("%", "\\%");
|
||||||
return allFormated;
|
return allFormated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String FormatPlayerName(String playerPrefix, String playerDisplayName, String playerSuffix) {
|
|
||||||
playerPrefix = chatColorPattern.matcher(playerPrefix).replaceAll("\u00A7$1");
|
|
||||||
playerPrefix = chatMagicPattern.matcher(playerPrefix).replaceAll("\u00A7$1");
|
|
||||||
playerPrefix = chatBoldPattern.matcher(playerPrefix).replaceAll("\u00A7$1");
|
|
||||||
playerPrefix = chatStrikethroughPattern.matcher(playerPrefix).replaceAll("\u00A7$1");
|
|
||||||
playerPrefix = chatUnderlinePattern.matcher(playerPrefix).replaceAll("\u00A7$1");
|
|
||||||
playerPrefix = chatItalicPattern.matcher(playerPrefix).replaceAll("\u00A7$1");
|
|
||||||
playerPrefix = chatResetPattern.matcher(playerPrefix).replaceAll("\u00A7$1");
|
|
||||||
|
|
||||||
playerSuffix = chatColorPattern.matcher(playerSuffix).replaceAll("\u00A7$1");
|
|
||||||
playerSuffix = chatMagicPattern.matcher(playerSuffix).replaceAll("\u00A7$1");
|
|
||||||
playerSuffix = chatBoldPattern.matcher(playerSuffix).replaceAll("\u00A7$1");
|
|
||||||
playerSuffix = chatStrikethroughPattern.matcher(playerSuffix).replaceAll("\u00A7$1");
|
|
||||||
playerSuffix = chatUnderlinePattern.matcher(playerSuffix).replaceAll("\u00A7$1");
|
|
||||||
playerSuffix = chatItalicPattern.matcher(playerSuffix).replaceAll("\u00A7$1");
|
|
||||||
playerSuffix = chatResetPattern.matcher(playerSuffix).replaceAll("\u00A7$1");
|
|
||||||
return playerPrefix + playerDisplayName.trim() + playerSuffix;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String FormatStringAll(String string) {
|
public static String FormatStringAll(String string) {
|
||||||
String allFormated = string;
|
String allFormated = Format.FormatString(string);
|
||||||
allFormated = chatColorPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
allFormated = Format.FormatStringColor(allFormated);
|
||||||
allFormated = chatMagicPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
|
||||||
allFormated = chatBoldPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
|
||||||
allFormated = chatStrikethroughPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
|
||||||
allFormated = chatUnderlinePattern.matcher(allFormated).replaceAll("\u00A7$1");
|
|
||||||
allFormated = chatItalicPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
|
||||||
allFormated = chatResetPattern.matcher(allFormated).replaceAll("\u00A7$1");
|
|
||||||
allFormated = allFormated.replaceAll("%", "\\%");
|
|
||||||
return allFormated;
|
return allFormated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +495,7 @@ public class Format {
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boolean isValidColor(String color) {
|
public static boolean isValidColor(String color) {
|
||||||
Boolean bFound = false;
|
Boolean bFound = false;
|
||||||
for(ChatColor bkColors : ChatColor.values()) {
|
for(ChatColor bkColors : ChatColor.values()) {
|
||||||
if(color.equalsIgnoreCase(bkColors.name())) {
|
if(color.equalsIgnoreCase(bkColors.name())) {
|
||||||
@ -475,7 +505,39 @@ public class Format {
|
|||||||
return bFound;
|
return bFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isValidHexColor(String color) {
|
||||||
|
Pattern pattern = Pattern.compile("(^#[0-9a-fA-F]{6}\\b)");
|
||||||
|
Matcher matcher = pattern.matcher(color);
|
||||||
|
return matcher.find();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertHexColorCodeToBukkitColorCode(String color) {
|
||||||
|
StringBuilder bukkitColorCode = new StringBuilder(BUKKIT_COLOR_CODE_PREFIX + BUKKIT_HEX_COLOR_CODE_PREFIX);
|
||||||
|
for(int a = 1; a < color.length(); a++) {
|
||||||
|
bukkitColorCode.append(BUKKIT_COLOR_CODE_PREFIX + color.charAt(a));
|
||||||
|
}
|
||||||
|
return bukkitColorCode.toString().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertHexColorCodeStringToBukkitColorCodeString(String string) {
|
||||||
|
Pattern pattern = Pattern.compile("(#[0-9a-fA-F]{6})");
|
||||||
|
Matcher matcher = pattern.matcher(string);
|
||||||
|
while(matcher.find()) {
|
||||||
|
int indexStart = matcher.start();
|
||||||
|
int indexEnd = matcher.end();
|
||||||
|
String hexColor = string.substring(indexStart, indexEnd);
|
||||||
|
String bukkitColor = convertHexColorCodeToBukkitColorCode(hexColor);
|
||||||
|
string = string.replaceAll(hexColor, bukkitColor);
|
||||||
|
matcher.reset(string);
|
||||||
|
}
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
public static String escapeAllRegex(String input) {
|
public static String escapeAllRegex(String input) {
|
||||||
return input.replace("[", "\\[").replace("]", "\\]").replace("{", "\\{").replace("}", "\\}").replace("(", "\\(").replace(")", "\\)").replace("|", "\\|").replace("+", "\\+").replace("*", "\\*");
|
return input.replace("[", "\\[").replace("]", "\\]").replace("{", "\\{").replace("}", "\\}").replace("(", "\\(").replace(")", "\\)").replace("|", "\\|").replace("+", "\\+").replace("*", "\\*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean underlineURLs() {
|
||||||
|
return plugin.getConfig().getBoolean("underlineurls", true);
|
||||||
|
}
|
||||||
}
|
}
|
@ -81,6 +81,10 @@ public class VersionHandler {
|
|||||||
return Bukkit.getVersion().contains("1.15");
|
return Bukkit.getVersion().contains("1.15");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean is1_16() {
|
||||||
|
return Bukkit.getVersion().contains("1.16");
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isCauldron() {
|
public static boolean isCauldron() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: VentureChat
|
name: VentureChat
|
||||||
version: 2.18.4
|
version: 2.20.0
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
main: mineverse.Aust1n46.chat.MineverseChat
|
main: mineverse.Aust1n46.chat.MineverseChat
|
||||||
depend: [Vault, ProtocolLib, PlaceholderAPI]
|
depend: [Vault, ProtocolLib, PlaceholderAPI]
|
||||||
@ -162,8 +162,8 @@ commands:
|
|||||||
aliases: [cb,vcommandblock]
|
aliases: [cb,vcommandblock]
|
||||||
description: Toggle a player blocked from entering a command
|
description: Toggle a player blocked from entering a command
|
||||||
permission-message: You don't have <permission>
|
permission-message: You don't have <permission>
|
||||||
nick:
|
setnickname:
|
||||||
usage: /nick {player} [nickname]
|
usage: /setnickname {player} [nickname]
|
||||||
aliases: [vnick]
|
aliases: [vnick]
|
||||||
description: Set a players nickname
|
description: Set a players nickname
|
||||||
permission-message: You don't have <permission>
|
permission-message: You don't have <permission>
|
||||||
|
140
test/mineverse/Aust1n46/chat/utilities/FormatTest.java
Normal file
140
test/mineverse/Aust1n46/chat/utilities/FormatTest.java
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
package mineverse.Aust1n46.chat.utilities;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.Mockito;
|
||||||
|
import org.powermock.api.mockito.PowerMockito;
|
||||||
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
|
import org.powermock.modules.junit4.PowerMockRunner;
|
||||||
|
|
||||||
|
import mineverse.Aust1n46.chat.MineverseChat;
|
||||||
|
|
||||||
|
@RunWith(PowerMockRunner.class)
|
||||||
|
@PrepareForTest( { MineverseChat.class })
|
||||||
|
public class FormatTest {
|
||||||
|
|
||||||
|
private MineverseChat mockPlugin;
|
||||||
|
private FileConfiguration mockConfig;
|
||||||
|
|
||||||
|
private List<String> filters;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
filters = new ArrayList<String>();
|
||||||
|
filters.add("ass,donut");
|
||||||
|
|
||||||
|
mockPlugin = Mockito.mock(MineverseChat.class);
|
||||||
|
mockConfig = Mockito.mock(FileConfiguration.class);
|
||||||
|
|
||||||
|
PowerMockito.mockStatic(MineverseChat.class);
|
||||||
|
PowerMockito.when(MineverseChat.getInstance()).thenReturn(mockPlugin);
|
||||||
|
Mockito.when(mockPlugin.getConfig()).thenReturn(mockConfig);
|
||||||
|
Mockito.when(mockConfig.getStringList("filters")).thenReturn(filters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mockPlugin = null;
|
||||||
|
mockConfig = null;
|
||||||
|
filters = new ArrayList<String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetLastCodeSingleColor() {
|
||||||
|
String input = "§cHello";
|
||||||
|
String expectedResult = "§c";
|
||||||
|
|
||||||
|
String result = Format.getLastCode(input);
|
||||||
|
|
||||||
|
assertEquals(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetLastCodeColorAfterFormat() {
|
||||||
|
String input = "§o§cHello";
|
||||||
|
String expectedResult = "§c";
|
||||||
|
|
||||||
|
String result = Format.getLastCode(input);
|
||||||
|
|
||||||
|
assertEquals(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetLastCodeColorBeforeFormat() {
|
||||||
|
String input = "§c§oHello";
|
||||||
|
String expectedResult = "§c§o";
|
||||||
|
|
||||||
|
String result = Format.getLastCode(input);
|
||||||
|
|
||||||
|
assertEquals(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFilterChat() {
|
||||||
|
String test = "I am an ass";
|
||||||
|
String expectedResult = "I am an donut";
|
||||||
|
|
||||||
|
String result = Format.FilterChat(test);
|
||||||
|
assertEquals(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsValidColor() {
|
||||||
|
String color = "red";
|
||||||
|
|
||||||
|
boolean result = Format.isValidColor(color);
|
||||||
|
assertTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsInvalidColor() {
|
||||||
|
String color = "randomString";
|
||||||
|
|
||||||
|
boolean result = Format.isValidColor(color);
|
||||||
|
assertFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsValidHexColor() {
|
||||||
|
String hexColor = "#ff00ff";
|
||||||
|
|
||||||
|
boolean result = Format.isValidHexColor(hexColor);
|
||||||
|
assertTrue(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsInvalidHexColor() {
|
||||||
|
String hexColor = "#random";
|
||||||
|
|
||||||
|
boolean result = Format.isValidHexColor(hexColor);
|
||||||
|
assertFalse(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConvertHexColorCodeToBukkitColorCode() {
|
||||||
|
String hexColor = "#ff00ff";
|
||||||
|
String expectedResult = "§x§f§f§0§0§f§f";
|
||||||
|
|
||||||
|
String result = Format.convertHexColorCodeToBukkitColorCode(hexColor);
|
||||||
|
assertEquals(expectedResult, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConvertHexColorCodeStringToBukkitColorCodeString() {
|
||||||
|
String input = "#ff00ffHello§cThere#00ff00Austin";
|
||||||
|
String expectedResult = "§x§f§f§0§0§f§fHello§cThere§x§0§0§f§f§0§0Austin";
|
||||||
|
|
||||||
|
String result = Format.convertHexColorCodeStringToBukkitColorCodeString(input);
|
||||||
|
assertEquals(expectedResult, result);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user