đź—Ł GallupPoll show server Rules, send announcements, make your own commands

GallupPoll is an essential server plugin for especially kit pvp or avatar bender mod type servers but can be used in any server…

It has 3 fully configurable functions;

  1. LoginMessages: Do you want to show server RULES with teleporting player, giving some items, giving some permissions etc.? LoginMessages part activates after a player joins in server and helps you to manage your server…

  2. ScheduledMessages: Do you want to make announcements or send questions to all players and give them rewards or run some commands? This part works on an interval and shows messages and questions in order…

  3. CommandSystem: Do you want to prepare some commands or maybe want to change some commands? In this part you can make commands that will override usual ones and run your own commands…

Also its compatible with FlexibleLogin…
In config i tried to tell everything i have added but if you have any questions send a reply from here…
#Download Links

#Source Code
https://github.com/ZpknTr/galluppoll

#Commands
gploginresetme ------------------------- Resets players own login sequence and starts again.
gploginresetplayer <player> ------- Resets defined players login sequence and starts again.
gploginresetall -------------------------- Resets all players login sequence and starts again.

CommandSystem adds new commands and you can define that command’s name so these commands are up to you…

#Permissions
galluppoll.command.resetme ------------------ Permission node for gploginresetme command.
galluppoll.command.resetplayer -------------- Permission node for gploginresetplayer command.
galluppoll.command.resetallplayers ---------- Permission node for gploginresetall command.
galluppoll.loginpartcompleted ----------------- This Perm. node makes player override LoginMessage part.
galluppoll.scheduledpartoverride ------------- This Perm. node makes player override Scheduled Messages part.

CommandSystem adds new commands with permission nodes an example would be like this:
galluppoll.command.examplecmd ----------------- Permission node for command named examplecmd.

#Tips and Informations
CommandSystem commands can be run directly with arguments
Example: If you create a kit command and add this answer:starter
Player can run /kit command and reply to a question OR directly run /kit starter

Commands can be run as player with <asplayer> before command but for some commands player might not have permission…
For these situations Commands are executed with order…
Example:
permgiver is a command like pex that gives permission
command is a command needs permission
permtaker is a command like pex that takes permission back

In config command lines you can use them in correct order to execute command without letting player have that permission…
CmdAfterAnswer=“permgiver$$<asplayer>command$$permtaker”

Edit: Added full text format support in version 1.1

3 Likes

A few things:

  • It’s a good idea to use a normal version number. If you want to specify what API release you’re using, you can put in your build.gradle:
jar {
    classifier = 'API4.0.0'
}
  • Don’t initialize your injected fields with null, that’s pointless. Just leave them uninitialized.
  • Path and java.nio are preferred over File and java.io when using filesystem operations or injection.
  • Rather than capitals, the HOCON spec defines key names as being all lowercase, with hyphens separating words.
  • The description field of CommandSpec is supposed to describe what the command does. Adding a CamelCase programmatic-ish name just makes it more confusing.
  • If you’re going to keep all executors in one class file, using separate classes for each becomes pointless; why not just use a :: lambda?
  • In /gploginresetplayer, since you’re trying to get a player, why not use GenericArguments.player(key) instead of GenericArguments.string(key)? Or, since you’re trying to get a User, GenericArguments.user(key). Also, to get the type you’re looking for from the arguments, you’d do args.<String>getOne(key).get() (or args.<User> or args.<Player> depending on which type the argument returns
  • Your current command system depends on a chat listener. However, you could very easily dynamically register commands - i.e. read the configuration, and make CommandSpecs and executors to match.
  • In the configuration, instead of naming objects Message1, Message2 etc., it’s a much better idea to not define the names ahead of time, and then just use getChildrenMap() to get all the nodes.
  • In the configuration, it’s recommended, rather than using color codes, to use Text objects directly in the configuration. Then, you can just call getValue(TypeToken.of(Text.class)), and it’ll return a Text. This also means people can put click actions and such in the text on their own, while the current implementation only allows for colors.
  • When working with ConfigurationNodes, rather than getting the value and checking if it’s null, it’s a much better idea to call isVirtual() on the node. This is especially good with fields like int and boolean, where the default value is also a valid value (e.g. getInt() returns 0, and you don’t know whether it means undefined or a literal 0).
2 Likes

Having a problem, when anyone types a command twice or 2 different commands, it throws up an error in the console after the first command. If they relog they can type one command again and if they type another is throws an error on the console. Also is there a way to run commands without having the chat message come up?

Can u please attach ur configuration file here? i tried using commands multiple times i dont think its relevant… And sadly No, there should be Message1 text for command to work… But they dont have to answer… :neutral_face:

Here is the config file… http://pastebin.com/YVZBkUjn
And here is the error message… http://pastebin.com/05cdLRXv

I have found the solution but i get an error and its really interesting :slight_smile:
Error says there is no [email protected]
But im sure there is… Also it doesnt give this error for old builds of galluppoll…
When i fix this problem i will release a new version…

1 Like

The problem is about loginmessage part…
give default users galluppoll.loginpartcompleted true
this will fix at themoment…
im trying to upload fixed release but it seems Ore has no upload button for new releases…

GallupPoll 1.2 is released…
Bugs fixed :slight_smile:

When I download the file it is 0k in size!

this problem is not from my plugin… every download gives an error at Ore right now…
Try downloading other plugins they are 0Kb too…

1 Like

Can you provide a mirror link that is not in Ore since it is down?

mirror links added thanks for warning :slight_smile:

1 Like

Is it possible to make it so multiple commands run from a single input?

And to determine whether the commands are ran as if from the console or the player?

Yes! Exactly… This options are explained in the config file…

commands are divided with $$ and if u want to run command as player use <asplayer> before command

1 Like

Ah cool.

Installed it and had a play with it.

A smidge unsure on somethings at the moment but I feel I can work it out.

Would it be feasible to add an option for there to be a pool of questions to draw from at random? And another option that only the first to reply correctly gets the commands ran for them?

I’d see that as being useful for setting up random lotto type events alongside more typical broadcasts.

One thing I’ve yet to test - if we name a command as say … test.command1 and have another as test.command2, then the permissions for those commands would be galluppoll.command.test.command1 and galluppoll.command.test.command2.

Would denying galluppoll.command.test. then deny access to both of those commands? Or are the command names not able to follow the Sponge inheritance paths.

Sponge permissions’ inheritance works automatically. If I ask if the player has the permission test.perm1, and they have the permission test, then I am told yes, the player does have the permission. Doesn’t matter the circumstances.

3 Likes

i understand u want some lotto type event but i didnt make this plugin for lottery :sweat:
This plugins aims to test players knowledge about rules etc…
And im sry to say but i cant work on this plugin anymore cuz i dont have a job and need money…
Also i dont want to earn money by getting hired to make plugins…
I really like Sponge and i really want to make a server at 1.10.2 but Flan’s Mod doesnt release 1.10.2 so im gonna focus on 1.7.10 atm and wait for a good gun mod…
If i could make a Sponge server later, I definitely continue to this project and make some other plugins (btw i have some cool plugin ideas)
And about permissions i dont think it would work like that cuz this plugins command system is a little bit lame :frowning:
GallupPoll checks for permissions itself and looks directly to the permission like test.permission1… and i didnt remember how the permissionex like plugins work atm… It might work but im not %100 sure…
So thank you for your ideas i hope that i find more time to improve my plugins and add new options like u said… If u find that permission works like that pls give me feedback :slight_smile:

Any option of a config variable to change the GallupPoll from appearing beside every sent message?
Or at least to alter the colour of it to something more sedate :slight_smile:

As an addendum to that, the text appears to be automatically coloured to match that of the [GallupPoll]: tag