Filled Punishment GUI [ASAP]

Discussion in 'Plugin Requests' started by OfficerDeveloper, Jul 6, 2015.

Thread Status:
Not open for further replies.
  1. Plugin category: Admin Tools

    Suggested name: PunishmentGUI

    What I want:

    I need a permission based plugin where if a player does /punish or /p <player> <reason> it shows a chest GUI with previous warnings, mutes, bans, etc... and an option to ban/mute them for double the time of their last ban/mute, a perm ban/mute, and a warn option.

    Note: Use this per-user UUID file based please.
    Note: Starting ban time will be 2h. Then doubles as they keep getting banned. Same with mutes.

    Prefix: "&c&lPUNISH "

    Ideas for commands: /p <player> <reason> , /punish <player> <reason>

    Ideas for permissions:

    punish.use
    punish.permban
    punish.permmute
    punish.warn

    (If user has the permission punish.use, make them be able to have the option to mute/ban the player for 2x the time of their last ban.)

    When I'd like it by: ASAP.
     
    Last edited: Jul 6, 2015
  2. Offline

    SuperSniper

    You're a developer yourself, cant you make this yourself?
     
  3. I could, but the way it would be made wouldn't be as well as I feel some people here could do it.
     
  4. Offline

    Tecno_Wizard

  5. Per user UUID file based in the server file.

    Think you can do it?
     
    Last edited: Jul 6, 2015
  6. Offline

    Tecno_Wizard

    @OfficerDeveloper, I know I can, it's time that's the issue. What's your timeline?
     
  7. I just need it ASAP have a time for when you can finish it?
     
  8. Offline

    Tecno_Wizard

    @OfficerDeveloper, I'm almost done my own Database API to make my life (and hopefully others) a whole lot easier. Currently i'm trying to resolve a single bug that will make it complete.
     
  9. @Tecno_Wizard Ok do you have an estimates time for the plgin tonhe finished?
     
  10. Offline

    Tecno_Wizard

    @OfficerDeveloper, hmm. Well let's see.
    I'm assuming you would want the punishments of ban, temp ban, mute, temp mute, and warn. Each of these would need a on and off button, which won't be too bad. Temp ban times would be configurable (time 1, time 2, etc. until perm is the only option)
    A history is a piece of cake.

    I can start now but I can't give a specific end time especially with my API not being functional. I do know a temp fix, but it dramatically slows it.
     
    Last edited: Jul 6, 2015
  11. @Tecno_Wizard Read what I said about the times, there is;

    Perm Ban
    Perm Mute

    Warn

    Ban: Starting Time; 2h, then doubles if banned again, etc..
    Mute: Starting Time; 2h, then doubles if muted again, etc..

    The perm ban would be a redstone enchanted block, which means the ban is active, mute would be a enchanted book, turning unenchantednif the mute expires.

    Then if someone left clicks the book/redstone block it removes the punishment.
    The book lore and ban lore will have the reason, player who banned them, and the date.
     
  12. Offline

    Tecno_Wizard

    @OfficerDeveloper, those would be the defaults, but I like to make things that could be usable by anyone, even if they have slightly different needs.

    I'll set it up the way you requested, but I usually repost plugins I have made for anyone to use. It will likely be different and will receive updates your version will not.

    BTW, just started.
     
  13. @Tecno_Wizard I editted my post, and what do you mean?

    @Tecno_Wizard Also, could you make it an API, so that when I'm building a plugin I can use that to see if someone's banned, muted, etc...

    Oh, and can you make it so when they try to talk it says how long they are muted for, and who muted them with the reason, same with the ban. Using the prefix please :).
     
    Last edited: Jul 6, 2015
  14. Offline

    Tecno_Wizard

  15. @Tecno_Wizard How do I merge posts? And yeah, thanks for making that extra class :).
     
  16. Offline

    Tecno_Wizard

    @OfficerDeveloper, there's this awesome function called copy and paste, then report the post to delete. lol
     
  17. @Tecno_Wizard Ok, thank you :). Do you have an estimated time for when this will be done? Again, thanks a lot for doing this :).
     
  18. Offline

    Tecno_Wizard

    @OfficerDeveloper, i or someone can figure out what is happening with JSON.simple, I can finish it, yes, but it will be laggy.
     
  19. Offline

    Tecno_Wizard

    @OfficerDeveloper, the read time is nearly tripled. I think i'll just use Bukkit's yml systems for now. I don't want you to have to wait for this to be fixed.
     
  20. Offline

    Tecno_Wizard

    @OfficerDeveloper, I think punish.use is a better perm for use at all. How about a perm for temp mute, ban, perm mute, and ban individually?
     
  21. @Tecno_Wizard

    To open GUI: punish.open
    To warn: punish.warn
    To ban/mute (temp): punish.use
    To perm ban/mute: punish.perm

    Better?

    Also could you make like, one page for the punishment, then have a arrow leading to another page with the user's past warns/punishments?
     
  22. Offline

    Tecno_Wizard

    @OfficerDeveloper, lol, already wrote it.
    Code:
    /**
         * Allows use of the plugin
         */
        private static final String PUNISH_USE_PERM = "punish.use";
        /**
         * Allows use of temp mute
         */
        private static final String TEMP_MUTE_PERM = "punish.temp_mute";
        /**
         * Allows use of temp ban
         */
        private static final String TEMP_BAN_PERM = "punish.temp_ban";
        /**
         * Allows use of perm ban
         */
        private static final String PERM_BAN_PERM = "punish.perm_ban";
        /**
         * Allows use of perm mute
         */
        private static final String PERM_MUTE_PERM = "punish.perm_mute";
     
  23. Offline

    Tecno_Wizard

    @OfficerDeveloper, any preference of Material for the buttons? History, temp mute, temp ban, perm mute, perm ban. Clicking any of the punishments again will revoke them if necessary.
     
  24. @Tecno_Wizard

    Perm ban = redstone block
    Perm mute = book
    Temp ban = red dye
    Temp Mute = aqua dye
    warn = paper

    And make sure that it only revokes them if they have the active punishment, or include in the lore that it is active or enchant them to show that it is active C:.
     
  25. Offline

    Tecno_Wizard

    @OfficerDeveloper, redstone block? Come on, something more dramatic. I had endportal. LOL.

    And it will. In addition, I will be requesting after the punishment what the cause was for the history.
     
  26. @Tecno_Wizard What do you mean? And Redstone block please :-:. I want it to always show history no matter what.
     
  27. Offline

    Tecno_Wizard

    @OfficerDeveloper, okay. I'll expand the menu I guess and put them underneath.
    When the menu closes, the plugin will ask the mod to tell why the punishment was given. Possibly. I'll see how time goes.

    EDIT: Here's where I'm stopping for today (it's 10 pm here)
    Code:
    package com.tecno_wizard.plugingui.invgui;
    
    import com.tecno_wizard.plugingui.core.Resources;
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.OfflinePlayer;
    import org.bukkit.entity.Player;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    
    import java.util.ArrayList;
    import java.util.Arrays;
    
    /**
    * Created by Ethan Zeigler on 7/6/2015 for PunismentGUI.
    */
    public class GUIConstructor {
        private ItemStack history;
        private ItemStack warn;
        private ItemStack tempMute;
        private ItemStack tempBan;
        private ItemStack permMute;
        private ItemStack permBan;
    
        public GUIConstructor() {
            // TODO- add in lore whether punishment is currently on, remove history
           
            // note to @OfficerDeveloper, none of this is even close to done. Most of the methods here will disappear. Organizing.
            history = new ItemStack(Material.PAPER, 1);
            editMetadata(history, ChatColor.GOLD + "History",
                    ChatColor.LIGHT_PURPLE + "Displays the infraction history of the player");
            warn = new ItemStack(Material.FEATHER, 1);
            editMetadata(warn, ChatColor.GOLD + "Warn",
                    ChatColor.LIGHT_PURPLE + "Warns the player of improper behavior");
            tempMute = new ItemStack(Material.BOOK, 1);
            editMetadata(tempMute, ChatColor.GOLD + "Temporary Mute",
                    ChatColor.LIGHT_PURPLE + "Temporarily mutes the player");
            tempBan = new ItemStack(Material.INK_SACK, 1, (short)10);
            editMetadata(tempBan, ChatColor.GOLD + "Temporary Ban",
                    ChatColor.LIGHT_PURPLE + "Temporarily bans the player");
            permMute = new ItemStack(Material.BOOK, 1);
            editMetadata(permMute, ChatColor.GOLD + "Permanent Mute",
                    ChatColor.LIGHT_PURPLE + "Permanently mutes the player");
            permBan = new ItemStack(Material.ENDER_PORTAL, 1);
            editMetadata(permBan, ChatColor.GOLD + "Permanent Ban",
                    ChatColor.LIGHT_PURPLE + "Permanently bans the player");
        }
    
        public void openPlayerPunishMenu(OfflinePlayer toBePunished, Player punisher) {
            Inventory menu = Bukkit.createInventory(null, 9, ChatColor.GOLD + "Punish " + toBePunished.getName());
            if (punisher.hasPermission(Resources.PUNISH_USE_PERM)) {
                if(punisher.hasPermission(Resources.PERM_BAN_PERM)) {
                    addPermBans(menu);
                } if(punisher.hasPermission(Resources.PERM_MUTE_PERM)) {
                    addPermMute(menu);
                } if(punisher.hasPermission(Resources.TEMP_BAN_PERM)) {
                    addTempBan(menu);
                } if(punisher.hasPermission(Resources.TEMP_MUTE_PERM)) {
                    addTempMute(menu);
                }
            } else Resources.sendMessage("Unknown console command. Type\"help\" for help.", punisher, ChatColor.WHITE);
        }
    
        private void addPermBans(Inventory inv) {
    
        }
    
        private void addPermMute(Inventory inv) {
    
        }
    
        private void addTempBan(Inventory inv) {
    
        }
    
        private void addTempMute(Inventory inv) {
    
        }
    
    
        private void editMetadata(ItemStack stack, String displayName, String... lore) {
            ArrayList<String> convertedLore = (ArrayList) Arrays.asList(lore);
            ItemMeta meta = stack.getItemMeta();
            meta.setDisplayName(displayName);
            meta.setLore(convertedLore);
            stack.setItemMeta(meta);
        }
    }
    
    Code:
    package com.tecno_wizard.plugingui.core;
    
    import org.bukkit.ChatColor;
    import org.bukkit.OfflinePlayer;
    import org.bukkit.command.CommandSender;
    import org.bukkit.configuration.file.YamlConfiguration;
    import org.bukkit.plugin.java.JavaPlugin;
    
    import java.io.File;
    import java.io.IOException;
    
    /**
    * Created by Ethan on 6/27/2015.
    */
    public class Resources {
        private static String pluginPrefix;
        private static JavaPlugin plugin;
    
        /**
         * Allows use of the plugin
         */
        public static final String PUNISH_USE_PERM = "punish.use";
        /**
         * Allows use of temp mute
         */
        public static final String TEMP_MUTE_PERM = "punish.temp_mute";
        /**
         * Allows use of temp ban
         */
        public static final String TEMP_BAN_PERM = "punish.temp_ban";
        /**
         * Allows use of perm ban
         */
        public static final String PERM_BAN_PERM = "punish.perm_ban";
        /**
         * Allows use of perm mute
         */
        public static final String PERM_MUTE_PERM = "punish.perm_mute";
    
        public Resources(JavaPlugin plugin) {
            Resources.plugin = plugin;
            setDataFields();
            directoryCheck(plugin);
        }
    
        protected void setDataFields() {
            pluginPrefix = plugin.getConfig().getString("PluginPrefix");
        }
    
        private void directoryCheck(JavaPlugin plugin) {
            File file = new File(plugin.getDataFolder().getPath() + "/Players");
            file.mkdirs();
        }
    
        public static YamlConfiguration getPlayerFile(OfflinePlayer player) {
            File file = new File(plugin.getDataFolder().getPath() + "/Players/" + player.getUniqueId() + ".yml");
            try {
                if (!file.exists()) file.createNewFile();
                return YamlConfiguration.loadConfiguration(file);
            } catch (IOException e) {}
            return null;
        }
    
    
    
        public static void sendMessage(String msg, CommandSender recipient, ChatColor startColor){
            recipient.sendMessage(String.format("%s[%s] %s", startColor, pluginPrefix, msg));
        }
    
    
        public String getPluginPrefix() {
            return pluginPrefix;
        }
    }
    
     
    Last edited: Jul 6, 2015
Thread Status:
Not open for further replies.

Share This Page