Vote Kick/ban plugin

Discussion in 'Plugin Suggestions' started by Draxter, Jan 22, 2012.

  1. Draxter New Member

    Since it's impossible to have an admin/moderator online on the server to enforce the rules letting people vote to kick or temporarily ban a player would be useful.
  2. k0rd TShock developer

    sounds useful!
  3. nicatronTg TShock Founder

  4. Olink TShock Developer

    I know a developer did this on the server I play minecraft in. I'll ask him and see if he wants to work on C# instead of java ^_^
  5. nicatronTg TShock Founder

    That's interesting. I have a file laying around for Minecraft that does that exact thing!

    Code:
    if (commandName.equals("voteban"))
    {
    if (plugin.VoteEngine != null)
    {
    if (!plugin.VoteEngine.type.equals("ban"))
    {
    return true;
    }
    plugin.VoteEngine.votesYes++;
    plugin.getServer().broadcastMessage(ChatColor.GOLD + "[SS] " + ply.getDisplayName() + ChatColor.RED + " voted to ban " + ChatColor.GOLD + plugin.VoteEngine.target + ".");
    return true;
    }
    if (args.length > 0 && ply.hasPermission("shankshock.voteban"))
    {
    if (plugin.getServer().getOnlinePlayers().length < 3)
    {
    sply.sendMessage("Unfortunately, you need more than 3 players before you can start a voteban.");
    //return true;
    }
     
    if (plugin.banLockedOut)
    {
    sply.sendMessage("This command was recently run. Please try again later.");
    return true;
    }
     
    plugin.getServer().broadcastMessage(ChatColor.GOLD + "[SS] " + ply.getDisplayName() + " (" + ply.getName() + ") would like to voteban " + ChatColor.RED + args[0] + ChatColor.GOLD + ".");
    plugin.getServer().broadcastMessage(ChatColor.GOLD + "[SS] " + "Need at least one player to motion the voteban. Type" + ChatColor.RED + " /motion " + ChatColor.GOLD + "if you wish to motion the voteban.");
    plugin.VoteEngine = new VoteEngine();
    plugin.VoteEngine.initiator = ply.getName();
    plugin.VoteEngine.target = args[0];
    plugin.VoteEngine.type = "ban";
    plugin.banLockedOut = true;
    int cooldown = Integer.parseInt(plugin.conn.keyValues.get("votebancooldown"));
    plugin.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new VotebanMotionCheck(plugin), 600);
    plugin.getServer().getScheduler().scheduleSyncDelayedTask(this.plugin, new VotebanTimeoutUpdate(plugin), cooldown);
    return true;
    }
    sply.sendMessage("Voteban syntax: /voteban <playern name>");
    return true;
    }
    
  6. ZeDingo TShock Plugin Developer

    Interesting... I shall look into this.
  7. ZeDingo TShock Plugin Developer

    Code:
    public int PercentForKickBan = 50;
    public string PercentForKickBan_description = "Percent of users with kick or ban permission needed to kick or ban (Rounds up)";
    public int VotesFromIP = 3;
    public string VotesFromIP_description = "Max number of votes from 1 IP address.";
    public bool DisableVoteWhenGroup = false;
    public string DisableVoteWhenGroup_description = "Disable votekick|voteban when any user in the specified group is logged in.";
    public string DisableVoteWhenGroupName = "";
    public string DisableVoteWhenGroupName_description = "Name of group (or groups) for the above setting. Comma separated without spaces.";
    public bool DisableVoteWhenUser = false;
    public string DisableVoteWhenUser_description = "Disable votekick|voteban when a user is logged in.";
    public string DisableVoteWhenUserName = "";
    public string DisableVoteWhenUserName_description = "Name of user (or users) for the above setting. Comma separated without spaces (Ex: \"Dingo,Emmett Brown,Inglip\")";
    public int ActiveVoteTime = 60;
    public string ActiveVoteTime_description = "Time (in seconds) that the vote remains active.";
    
    Any other ideas for settings that should be in the config file?

    Edit: Added ActiveVoteTime, at Rosen's suggestion.
    k0rd likes this.
  8. Rosen TShock Plugin Developer

    Something like ActiveVoteTime = 30
    Time in seconds that current vote is active. Then cancels it.
  9. ZeDingo TShock Plugin Developer

    That could work. My idea was to remove a user's vote when they disconnect. I suppose your way is less 27th Amendmenty.
  10. Draxter New Member

    so, did anyone pursue this idea?
  11. Wolfe Member

    I guess this thread died then...
  12. aMoka Member

    Does anyone want to try to pick this up?

    Edit: Somehow maybe add to the Polls/Easy Vote Plugin?
  13. ZeDingo TShock Plugin Developer

    Honestly, I would do it, but my friend and I have moved on from playing Terraria. I'm working on Darkstar Project (I didn't name it. Yes I know it's ridiculous.) and some Ashita stuff for FFXI.

    Without my friend's server, I don't really have a place to test my plugins. Best of luck in finding a votekick, or someone to make one!
  14. aMoka Member

    -insert some raging about how tshock community and devs suck-
    :p

    I was excited to see this thread, and I'll probably steal your config options if I manage to make it, as I might try to dev it myself. Although it might be a while as it would be my first TShock plugin I would make. (°─ °)
  15. ZeDingo TShock Plugin Developer

    Just look at the current plugins and start from there. Luckily with HousingDistricts I had a basic starting point, despite Olink never committing his newer changes >.>

    I dunno, I might come back one day. But I've got FFXI to work on, DSP is actually a private FFXI server project, a ton of new games, and a once-again-restarted-from-scratch life to live. At least TShock was fairly straightforward, and in an easy language. DSP is C++/LUA, Ashita is C++/C#/LUA, and they're both giving me thought cancer.
  16. aMoka Member

    Well, that sounds delightful! :'D (my soul cries for you)
    I took a look at your github and saw that you had voteban. Looked inside, and there was only an empty readme. ):
    Aww well.... Thanks for the pointers. :D I'll probably take a look at polls to see how to create a voting system.
    My Lua experience is pretty much all based in the quest system. x)

    I look forward to the day of your return! :)
  17. Mr White TShock Plugin Developer

    I swear I saw this as an actual plugin once... But apparently not D:
  18. aMoka Member

    It's such a logical thing to have, right? xD
    I only realized this after watching a friend play some Chivalry....
  19. Mr White TShock Plugin Developer

    Honestly though, I swear SpectreWiz or someone made one... x people vote, and it kicks them. But I can't find it anywhere. Maybe I'm just crazy
  20. aMoka Member

Share This Page