Giter VIP home page Giter VIP logo

couriernew's Introduction

Logo

CourierNew

About

CourierNew is a physical mail system for Spigot Minecraft servers that allows users to send letters in the form of books and receive them through couriers. Admins can use this to send letters to all players at once as a way of sending a message that people will be sure to see.

Purpose

CourierNew is a built-from-scratch partial remake of an abandoned Bukkit plugin called Courier. This was written as a means to bring similar functionality of the original plugin to more modern versions of Minecraft, as well as improve on the logic behind it.

Usage

  • /letter <message> - Compose a new letter with the specified message. Minecraft color codes and \n linebreaks are allowed in the message. If holding a not-sent letter written by you, this command will append the specified message to the letter.
  • /post <player> - Send a letter to a specified player. You can list multiple players by separating their usernames with a comma. Use the command with only * to send to all online players, or ** to send to all players who have ever joined the server.
  • /unread - Retrieve unread mail, if any.
  • /shred - Delete the letter in your hand.
  • /shredall - Delete all letters in your inventory.
  • /couriernew help - Show the help message.
  • /couriernew reload - Reload all configuration files.

Requirements

  • Spigot or Paper 1.14 - 1.18
  • Java 8 or higher

Installation

  1. Download the latest release.
  2. Put the jar in your plugins folder.
  3. Start or restart your server.

Configuration

After running for the first time, the default configs will be generated. The main configuration will look like this:

receive-delay: 100
resend-delay: 2400
remove-delay: 200
spawn-distance: 5
protected-courier: true
courier-entity-type: VILLAGER
blocked-gamemodes: []
blocked-worlds: []
  • receive-delay - This is the delay, in ticks, for when a letter should be received. This is used on join, after sending, and after leaving a blocked world or gamemode.
  • resend-delay - How long to wait, in ticks, before trying to resend a letter when the mail was not taken
  • remove-delay - How long to wait, in ticks, after the courier spawns before removing it
  • spawn-distance - How far away to spawn the courier from the player in blocks
  • protected-courier - This will determine whether other players can grab their mail from a courier that isn't theirs.
  • blocked-gamemodes - Gamemodes that receiving mail isn't allowed in. (SURVIVAL, CREATIVE, ADVENTURE, SPECTATOR)
  • blocked-worlds - Names of worlds that receiving is blocked in

For the message configuration, you can use color codes. You can also use the placeholder $PLAYER$ in messages that have it by default to replace it with player name(s). The messages and their names should explain what they are used for.

The third configuration file is actually used to store outgoing mail. Don't modify this file unless you know exactly what you are doing!

Permissions

  • couriernew.letter - Allows players to write/edit letters
  • couriernew.post.one - Allows players to send letters to one player at a time
  • couriernew.post.multiple - Allows players to send letters to multiple players at a time
  • couriernew.post.allonline - Allows players to send letters to all online players
  • couriernew.post.all - Allows players to send letters to all players who ever joined the server
  • couriernew.unread - Allows players to retrieve unread mail
  • couriernew.shred - Allows players to shred a letter
  • couriernew.shredall - Allows players to shred all in their inventory
  • couriernew.help - Allows players to use the help command
  • couriernew.reload - Allows for reloading of configs

Demonstration

Demonstration

Building

  1. Clone or download this repository.
  2. Run ./gradlew shadowJar in the directory of the project.
  3. /build/libs/CourierNew.jar should have been generated.

You can also grab CourierNew.jar from the latest releases.

Troubleshooting

Courier not spawning?

  • In the WorldGuard config, set block-plugin-spawning to false.
  • Set allow-npcs to true in server.properties.
  • If you are using EssentialsProtect, make sure to not block villager spawning.
  • Also check to make sure that no other plugins block mob spawning.

Notice

This project is no longer in development.

couriernew's People

Contributors

jeremynoesen avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

maeeeeee

couriernew's Issues

Enchants aren't stripped from books

In servers with a creative world this can allow players to bring hacked books with impossible enchants into the server.
By getting a written book with enchants (for example, looting 255) in a creative world, you can /post this to yourself (or others) and quickly go to the survival world to get it.

This can be remedied by denying /post permissions in creative worlds/gamemodes if the permission plugin has this functionality, but I'm of the opinion that the plugin could deal with this too.

I think the ideal solution here is to have a permission that strips the enchants of the book if it isn't set. This can be done with https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#hasEnchants() and https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/ItemMeta.html#removeEnchant(org.bukkit.enchantments.Enchantment)

CourierNew does not allow login.

I’m using CourierNew on the server, but when someone tries to log in while holding the book, the message ‘you do not have permission to use this command’ appears instead, and the player can’t log in. Can you help me? The name of the login plugin is OpeNLogin.

Fix courier spawn radius check

The check does not also test who owns the courier. It should check for one of the players own couriers. Otherwise, a different player will never get their courier and the logic to spawn it again will not run. Also move these checks to the canSpawn function.

Immortal Postmen/Infinite Mob Creation

Describe the bug
Postmen can be infinitely spawned and will not despawn.

Steps to reproduce

  1. Send a letter to yourself or receive a letter from someone else
  2. Do /unread to summon the postman
  3. Relog
  4. The postman will now be invincible and will never despawn.

Rework handling of item metadata when sending letters

As it is, the send method dangerously relies on non-malicious item metadata being passed through it. This is supposed to be prevented through the letter checker, but the way this check is handled means that currently, letters with things like attributes, custom lore, custom display names, et cetera can be sent. Because of Minecraft being a game that receives frequent updates, more kinds of abusable item metadata being added in the future is likely, meaning that using the letter checker to manually go through all of this metadata becomes tedious and difficult to maintain.

Instead, sending a letter should create a new letter ItemStack that only takes exactly the metadata that it needs from the letter the player is sending, which in this case is the book author and the book's contents. All other metadata should be added to that ItemStack at the time that it's sent, rather than adding it to a letter during its creation, as to ensure that letters do not have player-modified metadata.

In essence, how the send method should look:

  • Verify that a letter is being sent by its original creator through the letter check
  • Create a new ItemStack that takes the page and author data directly from the sender's original item*
  • Apply lore and title based on the contents of the letter, the letter's recipients, the letter author, and the current date and time (and any other metadata that's used, but this is all that comes to mind right now)
  • Send letter

*We know that the author is valid based on step 1. Validating page content for things like exploits is outside the scope of this issue, but should be investigated (as an example, I know there used to be books that ran commands if you clicked them -- should see if they are still possible).

Some usernames are not able to be used when sending letters

Hi, I am using a spigot 1.14.2 server and some of the players can receive but some can't because the command says "They do not exist" even though they very well do. I tried looking it up on other places to try and find a quick similar fix but I have been unable to find similar problems. I was wondering if there was a way to send letters to these players using either their UUID or if there was another easy fix I could tell others to do when sending letters to the unable to receive players.
Thank you!

(If you need any more issues please feel free to let me know)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.