Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[B+C] Add API to use 1.7 chat features. Adds BUKKIT-5245 #1111

Open
wants to merge 72 commits into
base: master
Choose a base branch
from

Conversation

Ribesg
Copy link

@Ribesg Ribesg commented Aug 25, 2014

The Issue:

There are currently no easy way to use the new chat features introduced in 1.7.

Justification for this PR:

As said before, there are currently no way (except from directly using the /tellraw command and passing your own generated json to it) to use the 1.7 chat features.

PR Breakdown:

This PR adds a builder interface based on a Message to which you append Parts to build a rich chat message containing (or not):

  • a ChatColor compatible text, a localized text, an ItemStack name or an Achievement name ;
  • an optional Hover text (showing a multi-color multi-line text, an ItemStack description or an Achievement description) ;
  • an optional Click action (executing commands / sending chat message, proposing commands / proposing chat message, or opening urls (actually opens the prompt)).

These messages handle colors and formatting using ChatColor just like standard messages, internally using the existing algorithm built by the great @mbax.

Many (many) shortcuts have been added to Message to make it easier to append specific elements, see Message static constructors, append methods and insert methods.

Message and Part will be ConfigurationSerializable making it easy to save and load them from a config file.

This PR also adds methods to Player to send a Message and two methods to Server and Bukkit to broadcast a Message. Those methods are closed to the standards String methods.

Usage examples can be found in the TestPlugin after this line. You can get builds of all of this and test it yourself using the link below.

This PR is a complete rewrite based on the previous one and on @feildmaster's work on the subject.

Testing Results and Materials:

Test Plugin Source
Build everything yourself to test it as we're not allowed to link CB builds here.

Quick build & test:

BRANCH=BUKKIT-5245-v2
mkdir ./build
cd ./build

git clone https://github.com/Ribesg/Bukkit.git -b $BRANCH
git clone https://github.com/Ribesg/CraftBukkit.git -b $BRANCH
git clone https://github.com/Ribesg/TestPlugin.git -b $BRANCH

cd ./Bukkit && mvn install
cd ../CraftBukkit && mvn install
cd ../TestPlugin && mvn install

cd ../..
mkdir ./run
mkdir ./run/plugins
cp ./build/CraftBukkit/target/craftbukkit-1.7.10-R0.1-SNAPSHOT.jar ./run
cp ./build/TestPlugin/target/TestPlugin.jar ./run/plugins

cd ./run
java -jar craftbukkit-1.7.10-R0.1-SNAPSHOT.jar
Relevant PR(s):

CB-1413 - Associated CraftBukkit PR
B-1065 & CB-1378 - Old PRs

JIRA Ticket:

BUKKIT-5245 - https://bukkit.atlassian.net/browse/BUKKIT-5245

Authors

Of the previous PRs and of this one

  • @bendem did a lot of things (Mostly Bukkit part)
  • @Ribesg did a lot of other things (CB part and Bukkit part)
  • @ST-DDT did the Javadocs for multiple Bukkit files

@Ribesg
Copy link
Author

Ribesg commented Aug 25, 2014

Opened PR for further discussion and development.
TODO:

  • Document Part
  • Make all classes in org.bukkit.chat ConfigurationSerializable
  • Integrate all of this with the various events involving Chat messages (AsyncPlayerChatEvent, but also things like PlayerJoinEvent and PlayerQuitEvent, etc)

@ST-DDT
Copy link
Contributor

ST-DDT commented Aug 30, 2014

Another ToDo:
Add the ability to create/devilver a plugin managed message set as resource package to the client, to allow plugins to create custom messages without the need to merge the language packs on the server side by hand.

@Ribesg
Copy link
Author

Ribesg commented Aug 30, 2014

@ST-DDT I have no idea what you're talking about

@ST-DDT
Copy link
Contributor

ST-DDT commented Sep 6, 2014

Anything left on the Bukkit side?

@ST-DDT
Copy link
Contributor

ST-DDT commented Sep 9, 2014

@Ribesg
May i create a PR in https://github.com/SpongePowered/SpongeAPI using this PR's content as MessageAPI?
SpongeAPI is currently created as a replacement for Bukkit to avoid all the trouble CraftBukkit bumped into.
This would require using the MIT license.

Are there other participants that have contributed to this and i have to ask for permission too?
Example: @turt2live

@Ribesg
Copy link
Author

Ribesg commented Sep 9, 2014

This PR will be merged into https://github.com/GlowstoneMC/Glowkit as soon as https://github.com/SpaceManiac/Glowstone is ready to implement it.

@Ribesg
Copy link
Author

Ribesg commented Sep 9, 2014

I, Ribesg, give permission to relicense the content of this PR under the MIT License for it to be integrated into SpongeAPI.

@bendem

@bendem
Copy link
Contributor

bendem commented Sep 9, 2014

I, bendem, give permission to relicense the content of this PR under the MIT License for it to be integrated into SpongeAPI.

@ST-DDT
Copy link
Contributor

ST-DDT commented Sep 9, 2014

I, ST-DDT, give permission to relicense the content of this PR under the MIT License for it to be integrated into SpongeAPI.

@nightpool
Copy link

You do realize bukkit is dead?

On Wed, Sep 2, 2015 at 7:28 AM RandomAltThing notifications@github.com
wrote:

You do realise its String broadcast not int?


Reply to this email directly or view it on GitHub
#1111 (comment).

@Ribesg
Copy link
Author

Ribesg commented Sep 2, 2015

@randomaltthing

  1. Why the hell are you reading this, commenting on this... now?
  2. Why the hell would that return a String?
  3. What the fuck?

@ST-DDT
Copy link
Contributor

ST-DDT commented Sep 2, 2015

it returns an int (number if players it was send too).
But it takes a message as argument.

Or which method are you referring to?

@nightpool
Copy link

Isjsjdodkdi can we stop having the cs 101 discussion in everybodies inboxes

thanks y'all.
On Wed, Sep 2, 2015 at 8:59 AM ST-DDT notifications@github.com wrote:

it returns an int (number if players it was send too).
But it takes a message as argument.


Reply to this email directly or view it on GitHub
#1111 (comment).

@mbax
Copy link
Member

mbax commented Sep 3, 2015

Did you know Bukkit is dead?

@cburschka
Copy link

I would like to unsubscribe from BukkitFacts, please.

(But seriously, I'm enjoying these issue threads too much to unsub the repository.)

@fynntimes
Copy link

This repository is depressing now, all I see are the ruins of a once bustling repository, that now sits idly, unable to continue, with PRs that will never be merged and updates that will never be released.

RIP Bukkit
December 21st, 2010 to August/September 2014
Cause of death: DMCA takedown is the primary cause of death, though it was caused by something that ran much deeper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet