[Abandoned] Spongy - A Very Spongy, Essential Plugin! v0.4

#This plugin is abandoned. :3

Spongy!


Permissions (and possibly help entrys) coming soon…

Spongy is a plugin that, very much like the old Essentials from Bukkit, has many basic commands that people will use in just day-to-day use on the server. Right now most of the commands aren’t yet implemented, but so far there is some implemented stuff.


Please, keep in mind that this plugin is in development. It’s plenty stable for regular server use, but it doesn’t have everything it needs to be your “swiss army knife” of commands.


/broadcast [channelname] [content] (This command is changing to /news soon)
Allows you to broadcast (somewhat anonymously) a message to all users connected to the server.

/tp and /tphere
Great, useful commands everyone loves. Soon, lazy type will be implemented (As in lokio == Lokio27).


/asConsole - Execute commands as Console!
CAUTION! ONLY GIVE TO PEOPLE YOU TRUST!
Execute commands as console. Do awesome things like “say Hello!” and “op”!


Join Notification Sounds
Plays a “ding” when a player joins the server. By default it’s disabled. To enable, config/Spongy/Spongy.conf and change playJoinSound to true.


Color Code Formatting we’re all used to!
You know, the whole &6 &8 &5 &k stuff we all love.
Once I know how to make permissions work on Sponge, there will be permissions required for normal use of the plugin and special things like bold and such.


Coming Soon…

(In no specific order)

  1. /home and /sethome
  2. /warp and /setwarp
  3. Lazy Type
  4. Other… basic essential commands. :slight_smile:
  5. More Config Params

Anyway, this is my first dive into making Minecraft plugins, and also one of my first attempts of making something worth-while in Java.

(Using my own webserver just because :smile:)
Download Stable Build (Updated 5/31/2015)
Download Dev Build (Updated 6/1/2015)
Spongy’s Official Repo


Change Log

Version 0.1
inital release
Version 0.1.1

  • Improved inline chat color code formatting’s code

  • Added some restrictions to /broadcast that prevent people from using it incorrectly.
    Version 0.1.2

  • Some more changes to color code formatting and such.
    Version 0.2

  • /asConsole created

  • /tp and /tphere implemented

  • added JoinSound feature
    Version 0.3 and 0.4

  • /warp and /setwarp
    (More changelog stuff coming soon)

7 Likes

Is there a github page somewhere?

I’ll put one up, one second.

Just a suggestion. The code below is a bit… insane. There isn’t any overlap in the codes, so they could be easily replaced.

original = original.replaceAll("&4", "§4");
original = original.replaceAll("&c", "§c");
original = original.replaceAll("&6", "§6");
original = original.replaceAll("&e", "§e");
original = original.replaceAll("&2", "§2");
original = original.replaceAll("&a", "§a");
original = original.replaceAll("&b", "§b");
original = original.replaceAll("&3", "§3");
original = original.replaceAll("&1", "§1");
original = original.replaceAll("&9", "§9");
original = original.replaceAll("&d", "§d");
original = original.replaceAll("&8", "§8");
original = original.replaceAll("&5", "§5");
original = original.replaceAll("&f", "§f");
original = original.replaceAll("&7", "§7");
original = original.replaceAll("&l", "§l");
original = original.replaceAll("&n", "§n");
original = original.replaceAll("&o", "§o");
original = original.replaceAll("&k", "§k");
original = original.replaceAll("&m", "§m");
original = original.replaceAll("&r", "§r");

Switch to

original = original.replaceAll("&", "§");
1 Like

The only problem with that is if I type
“I like milk & cookies”
The code will replace the & with a symbol and the client will see
“I like milk cookies”
which is weird.

Fair enough. You could use regex to match, though.

3 Likes

It would be mostly checking to see if it matched the list of color code letters/numbers, and if it did then it would just format it. Having it just go switchy if there is a character in front of it isn’t good either.

original = original.replaceAll(“&([0-9a-fA-FkKlLmMnNoOrR])”, “§$1”);

6 Likes

Thanks, Deamon. I’ve barely touched on regex, so this really helps :smile:

… Or you could simply use Texts.replaceCodes(original, '&') which is provided by Sponge’s Text API. Generally you should not use color codes directly anymore. If you’re giving color codes (e.g. §c) to Texts.of() you’re sending the messages in a wrong way. It’s just a matter of time until that will break, color codes were completely deprecated in Minecraft as of 1.7/1.8. They do already break when you have longer messages because the colors will not be applied after new lines.

Instead of this, there is Texts.fromLegacy(original) which creates a Text from a string with color codes, or you could even use Texts.fromLegacy(original, '&') to skip the replacing step completely. Unlike creating messages with Texts.of() this will convert the color codes properly into the new format.

As for creating texts to send, SpongeAPI provides a simple way to create them using a similar way as Bukkit. Instead of this:

https://github.com/MikaalSky/Spongy/blob/master/src/main/java/com/terminalbit/spongy/BroadcastCMD.java#L65

… you can simply do:

Texts.of(TextColors.DARK_RED, "Error: ", TextColors.RED, "Format: /broadcast <channel name> <content>")
3 Likes

Ah. I wasn’t aware of that. I knew Minecraft had some changes regarding coloring, but I wasn’t aware that it was like that. I’ll start to update my code to these standards, thanks.

Texts.fromLegacy() is axing the usernames.
Edit:
Nevermind, I used the wrong thing.

This is basically what I mean:

If you use Texts.fromLegacy() it should work fine for all lines, and not just for the one line.

3 Likes

The problem with Texts.fromLegacy() should be fixed now, it was not including the first part of the message:

pirate, nice.<no

1 Like

I’m using a different method now I believe.
Edit:
Will do, thanks for the bug fix.

0.4 Dev Release!

3 Likes

Nice job Loki! :slight_smile:

1 Like

I seem to be crashing randomly after a week of using your mod, I used the dev version and havent touched it. I did update forge, and sponge today has that caused this issue? Heres a crash log: http://pastebin.com/vWxDbiQP

yep, updating sponge caused the issue.