How to override server features?

Discussion in 'Plugin Development' started by Terrav, Sep 8, 2020.

  1. Offline

    Terrav

    Hello, I was wondering how I could remove the following features and implement them myself:
    • Delivering player messages
    • Player join/leave messages
    • Supplying the MOTD
    and I also want to know how to implement these features:
    • Custom crafting
    • Adding new items (and managing their behavior)
    • Adding hover information in chat
    • Showing players a leaderboard
    • Multiple worlds
    I can't seem to easily find anything about this on any wiki or even a Google search.
     
  2. What do you mean? Do you want to send a message to a player, or maybe change the message format?

    The PlayerJoinEvent and PlayerQuitEvent has methods for setting the messages.

    As in the MOTD on the server list or in the chat when a player joins? The first one can be achieved using the ServerListPingEvent and the second one can be achieved by just sending the player a message when they join.

    What do you mean by "custom"? Do you want your own GUI or do you just want custom recipes?

    You cannot create new items but, i believe you can create custom recipes for items with custom data, such as name, lore, NBT, etc.

    Hover information? Like the possibilities with tellraw in vanilla? You can achieve this using Spigot's ChatComponent API and the HoverEvent from it.

    Do you mean a scoreboard set to display in the sidebar? If so, you can create a new scoreboard using Bukkit#getScoreboardManager()#getNewScoreboard(), then you can do whatever you want from there.

    Could you elaborate on this part? Multiple worlds what? Do you want to create new worlds? Support multiple worlds? If you want to create a new world, you can do that using Bukkit#createWorld(WorldCreator).
     
  3. Offline

    xelatercero

    I am not pretending to be mean , but i just googled everything in that list and i found it , just type "bukkit player join/leave messages", i mean i even found youtube tutorials ;)
     
    Newdel likes this.
  4. Offline

    Terrav

    For Delivering Player messages, I meant intercepting a message from a player (before it is sent) and broadcast messages myself, as in taking a player's message and concatenating it with their values (from other features).
    For Custom Crafting, I meant modifying existing crafting recipes.
    And as for Multiple Worlds, I meant holding completely separate worlds (dimensions, maybe?) in memory, with players in different ones, and the ability to transfer a player between them.
     
  5. Listen to the AsyncPlayerChatEvent.

    I've never really worked with recipes, as i've had no need to, so i can't help you with this.

    You can teleport a player to a different world using Player#teleport(Location).
     
  6. Offline

    Terrav

    How many dimensions can I have?
     
  7. Offline

    timtower Moderator Moderator

    Your server will complain when you have too many.
    But there is no coded limit as far as I am aware.
     
  8. Offline

    Shqep

    I'm gonna be very quick because others have put in a few words already, this is just a summary.

    Listen to AsyncPlayerChatEvent.

    Listen to PlayerQuitEvent and PlayerJoinEvent.

    If you meant MOTD that gets sent when a player joins, again, PlayerJoinEvent. If you meant as in the server's MOTD, uhhh, server.properties?

    Create and add Recipe(s) (there are a handful of recipe types) and add them to the server.
    If you want to remove existing recipes, iterate through them and remove. Resetting can be done by Bukkit#resetRecipes.

    You can't do that server-side, afaik.
    If you meant, custom item names, lores, and behaviours within Minecraft's limitations, ItemStack, ItemMeta and NBTTags (not sure about this one being implemented yet because I don't work much with newer versions).

    Send a message with a JSON compartment. Hovering information is stored in hoverEvent tag.

    If you meant similar to economy leaderboards, sort values and then display.

    Bukkit.createWorld(args...);

    Not trying to be mean but how? Most of this information was taken from Wikis and Javadocs.
     
    Xp10d3 and Kars like this.
  9. Offline

    Terrav

    Well, I have the player join messages set up now, but it still shows the default message in addition to my new one. How do I disable this?
     

    Attached Files:

  10. You're probably sending them a message, instead of setting the join message through the event.
     
    Xp10d3 likes this.

Share This Page