Added checking if inventory is full and dropping when giving rewards ONLY if the command is a give command. (new 'inventory_full' setting in messages.yml)
Made some error handling for getting player points and fastest time
Fixed cancel-message-when-winning when set to false would still cancel
Fixed SQLite database being created and read to from the server's directory causing old database to not be read correctly, now does it from the plugin folder
Fixed plugin.yml version being older causing new update message
There were a few important changes to the configuration files (config, rewards, messages). In an attempt to make it easier to transition into this new update, I've made a GitHub link that shows the things that were added and also removed or changed.
NEW COMMAND: /chatgames <race> <type> <amount> - Starts a manual race with the specified arguments. Uses same permission as starting manual games (chatgames.start.<type> or chatgames.start.*)
Example: /chatgames HUNT ZOMBIE 10
New messages.yml value:
Code (YAML):
type_not_found: '&8
[%prefix%&8] &fUnable to find the type of material/entity for &c%type%'
FIXED
Fixed fish game not detecting correct fish
Removed unused imports and refactored code for organization
Permission needed (
chatgames.manage.points):
/chatgames +points <player> <amount> - Adds points to a player.'
/chatgames -points <player> <amount> - Removes points from a player.'
/chatgames setpoints <player> <amount> - Sets the points for a player'
Permission needed(
chatgames.points):
/chatgames points - Returns your points'
NEW REWARD PARAMETER -
minimum-players parameter is like the chance you assign to each reward
Here's an example on how to use it:
Code (YAML):
unscramble:
rewards:
1:
reward_1:
minimum-players: 2
#Online players-based condition, reward can only be chosen if there are 2 or more players online chance: 50
data: - '10.0
%~ [consolecmd] give %player% diamond_block 3 has:test.permission' - '
[consolecmd
] give
%player% iron_block 5' reward_2:
data: - '
[consolecmd
] give
%player% iron_block 2'
FIXES
Fixed cancel-message-when-winning setting not working
Fixed clickable winner message sometimes being sent twice
All new sections added that are needed to run (add this or re-generate):
messages.yml (New fields and modified help command message)
Code (YAML):
number_not_found_commands: '&8
[%prefix%&8] &cUnable to find number to apply to command' points_added: '&8
[%prefix%&8] &fAdded &a%amount% &fpoints to &c%player%' points_removed: '&8
[%prefix%&8] &fRemoved &a%amount% &fpoints from &c%player%' points_set: '&8
[%prefix%&8] &fSet &c%player%`s &fpoints to &a%amount%' player_points: '&8
[%prefix%&8] &fYou have &a%amount% &fpoints!' in_cooldown: '&8
[%prefix%&8] &cYou can`t use this yet, wait &e%time_left%s &cbefore using the command again' help_command: - '&7&m
-------------------------------------------------'
- '&e&l-ChatGames-'
- '&6'
- '&6&lCOMMANDS:'
- '&6'
- '&a/chatgames
(type
) &f- &3Starts the event type specified instantly.'
- '&a/chatgames top &f- &3Shows the top 10 players with most points.'
- '&a/chatgames fastest &f- &3Shows the top 10 players with fastest times.'
- '&a/chatgames toggle &f- &3Toggle chat games on or off for yourself'
- '&a/chatgames togglesound &f- &3Toggle chat games SOUNDS on or off.'
- '&a/chatgames reload &f- &3Reloads the configuration files.'
- '&a/chatgames +points <player> <amount> &f- &3Adds points to a player.'
- '&a/chatgames -points <player> <amount> &f- &3Removes points from a player.'
- '&a/chatgames setpoints <player> <amount> &f- &3Sets the points for a player'
- '&a/chatgames points &f- &3Returns your points'
- '&6'
- '&2&lGAME TYPES:'
- '&5unscramble, unreverse, reaction, random, fillout, variable, clickable, math, trivia, hoverable, hunt, mine, place, fish, craft, eat, furnace'
- '&7&m
-------------------------------------------------'
Added %winner% and %time% placeholders for the ' winner-field' section which was not there before. This is where the winner is shown on the discord webhook
Fixed FURNACE game and errors
Fixed formatting of winner message for multiple players
Fixed PlaceholderAPI parse command crashing the server
NEEDED New field in config.yml:
Code (YAML):
discord: #If url is empty, this will be ignored as there will be no webhook webhook-url: ''
message-content: 'Latest game results:'
img-url: 'https://www.spigotmc.org/data/resource_icons/107/107781.jpg?1676494289'
username: 'Chat Games'
title: 'Chat Games Result'
description: 'The winner is:'
winner-field: '
%winner% (%time%)' #NEW FIELD
No changes to version number as this update is mainly code-related and not functionality changes to gear up for the next update which will add something new related to rewards.
Refactored some of the task and games enabled code
Made it optional for blacklisted words section to be there to avoid issues when starting games (it can be removed from the file if you don't want this function)
Added blacklisted words check to chat games (will check for blacklisted words, and if found will look for a new word while also informing in console that a blacklisted word was found)
Added new command (/chatgames remove <name>) to completely remove players from the database. Permission: chatgames.remove
Refactored some of the top manager code to ensure better functionality and removed unnecessary methods.
Changes in files: New fields in
messages.yml -
player_deleted: '&8[%prefix%&8] &cThe player &f%player% &chas been removed from the database!'
player_not_found: '&8[%prefix%&8] &fUnable to find the player &c%player%'
MAJOR RECODE - NEW GAME, DISCORD WEBHOOKS, OPTIMIZATIONS This update marks a major RECODE in which a lot of things were modified.
MAJOR RE-CODE with a much better organization in its code
Major Optimization to overall plugin size and performance (Size from 370kb to 195kb)
Added 1 NEW GAME (Furnace/Cooking game) as a race
Added Discord Webhooks Support! Let your server's users know who won in Discord!
Added option 'cancel-message-when-winning' for those wanting to show the message whenever someone wins too
Changed the local placeholders in config.yml and messages.yml to %selection% for most games (not races). Check the default files if you have any doubts
Clickable Game bug fixed
It's likely that there will be some small bugs as it's a whole new code although achieving the same result, but join the discord and I'll help you as fast as I can!
A new field inside config.yml in the 'random' game section has been added which is 'custom_characters'. It will only be used if the chosen type is "CUSTOM". Should not give any problems if you're not using it and it's not there.
New look:
Code (YAML):
#Types available: ALPHA (letters), ALPHANUMERIC (letters and numbers), NUMERIC (numbers), SYMBOLIC (symbols), #LOWERCASE_ALPHA (all lowercase letters), UPPERCASE_ALPHA (all uppercase letters), HEXADECIMAL (hexadecimal chars: 0123456789ABCDEF) #CUSTOM (Uses whatever is at 'custom_characters') character_type: ALPHANUMERIC
#Only if type is "CUSTOM" this line will be used custom_characters: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
Changed CLICKABLE game to be disabled in config by default as the winner message for this game broke with one of the recent updates
Refactored some of the games code for better readability
As I mentioned on Discord, a big re-code of the plugin will be coming likely in the first few days of next month in order to fix issues like the CLICKABLE game and placeholder issue. A new game and maybe a new feature will come with the re-code as well! For more information check out the Discord server announcements.
Added command "/chatgames toggleAll" which toggles all games ON or OFF immediately after executing, so you don't have to be going into config to disable this!
Added "chatgames.toggleAll" permission to execute the command that was added.
Added new message to messages.yml
messages.yml new line (under 'toggle_sound'):
Code (YAML):
toggleAllGames: '&8
[%prefix%&8] &fYou have toggled &a%state% &cALL &fchatgames!'
Made considerable refactoring and re-organization of start game methods to avoid games starting with no values in placeholders which had been a commonly reported issue.
/chatgames convert - ONLY OP/Console. If there is an existent pointsdata.yml from previous versions, it will translate all data to the database that was created on the new version! This might be a bit heavy on performance if there's a lot of data.
Changes in files:
These lines were added to
config.yml at the top of the file under 'lang':
Added 'difficulty' setting for FILLOUT chat game. A percentage from 1-100 can be set. Low number means less letters hidden. Thank you for the suggestion @Noltox
This is how the fillout game looks like in config.yml now:
Code (YAML):
fillout:
enable: true
winners: 1
#This represents the percentage of hidden letters in the fillout game. Values can range from 1 to 100. Low numbers means less letters hidden. difficulty: 30
case-sensitive: true
#The time users will have to guess, solve, write, etc in seconds. timeToGuess_seconds: 20
#__Leave the following 2 empty to disable them__ titleMessage: '&b
%word%' subtitleMessage: '&aFill Out'
Added 'volume' value to GameSounds in config. Now you can set the volume of the sounds the plugin uses. If the value isn't found it will just set to 0.5
It was added in this format if you have to modify your config.yml:
Code (YAML):
#Sound to send to players when a chat event starts! GameSounds:
volume: 0.5
#LEAVE ANY OF THESE EMPTY TO DISABLE THEM win: 'ENTITY_EXPERIENCE_ORB_PICKUP'
game-start: 'ENTITY_PLAYER_LEVELUP'
time-expired: 'ENTITY_VILLAGER_NO'
Updated language files download link. THE OLD LINK FOR OLD VERSIONS WILL BE DELETED SOON, SO UPDATE IF YOU WANT TO KEEP USING THIS FUNCTION.\
Added %chatgames_toggle% PAPI placeholder, will return true/false if player has games toggled or not.
ADDED DEVELOPER EVENT API
Two events are now in place for developers to use them. The events are ChatGamesStartEvent and ChatGamesEndEvent. More events or API tools may be made later to improve this.
Here are examples for both:
Code (Java):
@EventHandler
publicvoid onChatGameEnd
(ChatGamesEndEvent e
){ if(e.
getType()== GameType.
REACTION){ List
<Player
> winners
= e.
getWinners(); for(Player p
: winners
){ p.
sendMessage("You won!"); } } }
@EventHandler
publicvoid onChatGameStart
(ChatGamesStartEvent e
){ if(e.
getType()== GameType.
FILLOUT){ Bukkit.
broadcastMessage("The answer is: "+ e.
getAnswer()+"!"); } }
Fixed error message being sent for races if no race had happened prior to the eat event being called
Now TRIVIA answers when time runs out just sends the first answer in the list as the correct answer not all joined together.
ADDED MORE OPTIONS FOR TOP SYSTEMS
messages.yml: (MUST UPDATE TO THIS FORMAT TO MAKE IT WORK IF YOU ALREADY HAVE A GENERATED YML)
Code (YAML):
top:
header: '&b&m
---------&e&lTOP CHAT&b&m
---------'
#The separators value is that one message that is sent to space out the top 10 players from header and footer! separators: ''
format: '&c
%spot%. &f%player% &8| &e&l%points% &7points' player-stat-format: '&7You`ve got &e&l
%player_points% &7wins' #You can leave the one below empty if you want to disable it! Variable to use is %total_wins% total-stat-format: '&7Total games won globally &e&l
%total_wins%' footer: '&b&m
---------------------------'
no_data_message: '&8
[%prefix%&8] &cThere is no data yet! Win a chat game and get points!' TypersTop:
header: '&b&m
---------&e&lTOP FASTEST&b&m
---------'
separators: ''
format: '&c
%spot%. &f%player% &8| &e&l%time%&6s' player-stat-format: '&7Your fastest time is &e&l
%fastest_time%&6s' footer: '&b&m
------------------------------'
no_data_message: '&8
[%prefix%&8] &cThere is no data yet! Win a chat game and be the fastest!' top_disabled_message: '&8
[%prefix%&8] &cThis function is currently disabled!'
'lang' value added to config.yml. MAKE SURE TO ADD IT IN IF YOU UPDATE OR RACES WILL NOT WORK.
Format:
Code (YAML):
#These translations are for plugin sided things such as material and entity names that are used for races. 118 Language Types Supported! #IT WILL ONLY TRANSLATE THOSE THINGS, CUSTOMIZABLE MESSAGES HAVE TO BE CHANGED MANUALLY. # #See the ID for your language here: https://github.com/nsider4/em-translator/blob/main/language_names.txt # #CHANGES ARE REGISTERED ONLY ON RESTART lang: 'en_us'
- Changes to the 'lang' file only get registered when you restart, RELOAD won't update everything.
BETTER DEFAULT SET UP FOR THE PLUGIN TO BE READY TO USE OUT-OF-THE-BOX
Added customizable message for states ON/OFF of toggle system
Optimized the way rewards.yml looks to occupy less lines on races rewards SEE REWARDS.YML IN RESOURCE PAGE
Fixed first 7 messages on messages.yml not reloading when using /chatgames reload
NEW RACES REWARD FORMAT
Code (YAML):
races:
rewards: #THESE ARE THE REWARDS YOU PUT IN 'chatRaces.yml' reward_1:
chance: 50
data: - '60.0
%~ [consolecmd] give %player% diamond_block 5' #REMOVING 'chance' VALUE WILL MAKE THE REWARD/COMMAND HAPPEN ALWAYS reward_2:
data: - '
[consolecmd
] give
%player% iron_block 5' - '
[playermsg
] &aYou won!'
HUNT - Hunt the monsters as fast as possible
MINE - Mine the blocks as fast as possible
PLACE - Place the blocks as fast as possible
FISH - Fish the fishes as fast as possible
EAT - Eat the food as fast as possible
CRAFT - Craft the item as fast as possible
- They are managed through 'chatRaces.yml', a new YML!
NEW REWARD SYSTEM FOR CHAT GAMES AND RACE GAMES!
Added option to have multiple rewards within a winner of a chat game, and multiple choices to choose from in races. All rewards USED have to add up to a maximum of 100% of their 'chance' value.
hunt:
rewards: #THESE ARE THE REWARDS YOU PUT IN 'chatRaces.yml' reward_1:
chance: 50
data: - '10.0
%~ [consolecmd] give %player% diamond_block 3' #REMOVING 'chance' VALUE WILL MAKE THE REWARD/COMMAND HAPPEN ALWAYS reward_2:
data: - '
[consolecmd
] give
%player% iron_block 5' - '
[playermsg
] &aYou won!'
You can now check for permissions before giving a reward, this can be used to give different rewards to different ranks or per-world-rewards using a permission plugin. ONLY 1 PERMISSION SUPPORTED ATM. Place at the end of command line.
You can now specify different rewards for multiple winners (first, second, etc) through the rewards.yml file
rewards.yml FORMAT EXAMPLE NOW:
Code (YAML):
unscramble:
reward:
1:
data: - '10.0
%~ [consolecmd] give %player% diamond_block 3' - '
[consolecmd
] give
%player% iron_block 5'
Note: See the main resource page 'rewards.yml' spoiler to see the updated look to the format.
YOU HAVE TO UPDATE YOUR REWARDS.YML OR NEW UPDATE WILL NOT WORK WITH AN OLDER VERSION OF THE .YML
NEW RANDOM DELAY BETWEEN GAMES OPTION:
Instead of a fixed interval between games, now you have the option to set a minimum and limit for the time that will be randomly generated.
You can set time unit of seconds or minutes!
config.yml ADDITION:
Code (YAML):
#If this is enabled, everytime a game ends, it will create a random number from 'randomDelay.minimum' to the number in 'randomDelay.limit' as a delay for the next game randomDelay:
enable: false
#Time unit, the other possible value is 'seconds', if you do change it, it's recommended to make the minimum higher than the 'timeToGuess_seconds' for a game timeUnit: 'minutes'
minimum: 1
limit: 25
Note: See the main resource page 'config.yml' spoiler to see the updated look to the default config.yml.
Fixed variable game generating random number between max and min using deprecated method in later Java versions, now using a way that supports all Java versions.