Filled Punishment GUI [ASAP]

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

Thread Status:
Not open for further replies.
  1. Offline

    Tecno_Wizard

  2. Offline

    Tecno_Wizard

    @OfficerDeveloper

    Done! Note that I was not able to test reverting bans because it's just me here.
    https://drive.google.com/open?id=0B6okEWgp3tkcOXQzcVVqRkpjZWc

    If there's anything you want changed, tell me. Here's what i know you will say and i'm going to fix, but I wanted to push this out.
    Say what player gave the punishment
    get back out of the history menu
    use an enchantment instead of lore for activity

    Why not BukkitDev? This project in its current state is not up to my standards, and until it is, it will not be posted. Please note that it is embedded with PluginMetrics.
     
    Last edited: Jul 22, 2015
  3. It said that I don't have permission to open, PM me, also those bugs yeah I want fixed xF.
     
  4. Offline

    Tecno_Wizard

    @OfficerDeveloper, my fault for not posting perms... sry.
    Code:
    name: PunishmentGUI
    version: 0.1
    description: Gives a GUI window to punish players
    author: Tecno_Wizard
    main: com.tecno_wizard.plugingui.core.Main
    commands:
      punish:
        description: 'Punishes the given player'
        usage: '§cIncorrect usage. /punish <PlayerName> <Reason>'
        permission: 'punishment.use'
        permission-message: ''
    permissions:
      punish.use:
        description: 'Gives the ability to use the punish GUI'
      punish.temp_mute:
        description: 'Gives the ability to temp mute a player in the GUI'
      punish.temp_ban:
        description: 'Gives the ability to temp ban a player in the GUI'
      punish.perm_ban:
        description: 'Gives the ability to perm ban a player in the GUI'
      punish.perm_mute:
        description: 'Gives the ability to perm mute a player in the GUI'
    
    commented out config
    Code:
    Updater:
      #engages the system that checks for updates. This alone will not automatically update the system.
      UpdateNotificationsOn: true
      #engages the system that updates the plugin automatically. UpdateNotificationsOn must be true for the auto-update to work
      AutomaticallyGetLatestVersion: true
    #prefix that will be displayed to players
    PluginPrefix: 'Punish'
    #number of minutes that a temp ban starts at. Increases by an exponential factor of 2 with each offense.
    SeedTempBanTime: 120
    #number of minutes that a temp mute starts at. Increases by an exponential factor of 2 with each offense.
    SeedTempMuteTime: 120
    #the message said after being blocked for being banned
    PunishMessageSuffix: 'If you feel that this is a mistake, contact us.'
    the updater fields do not work. They're there for when I use bukkit dev.
     
  5. Still don't have permission on google drive
     
  6. Offline

    Tecno_Wizard

    @OfficerDeveloper, Oh. Could have been a bit more specific. lol.

    EDIT: fixed above link.
     
  7. Offline

    Tecno_Wizard

  8. Offline

    Tecno_Wizard

  9. Ahh.. Thank you xD. Can you re-decompile it? I made a few changes :p.

    Also, I want a permission for perm ban/mute.

    So that certian people with punishment.use can't use perm mute/ban and if they try to, it will deny them access and post 'You cannot do this' or something in chat.

    Perm TO do it: punishment.permban and punishment.permmute

    Ok, so when I open the GUI only the option to warn pops up, and reasons don't space out: http://prntscr.com/7w6rws

    And there's this wierd "Punishment is enabled" thing.

    Also, can I add the jar to my plugin and use it as an API for my custom chat?
     
    Last edited: Jul 23, 2015
  10. Offline

    Tecno_Wizard

    @OfficerDeveloper,

    Let me clean up a few things first in the API. I'll tell you when and explain what to do.

    The reason you only get warn is you didn't give yourself the rest of the perms... Please read the perms...
     
  11. Oh ok. And for history, again like you said a back button, and I want the LATEST history to show up first in the slot.

    Also want this to be capitalized like Temp. Mute: http://prntscr.com/7w6vpd
    And I want to be able to have multiple word reason :).
    When I temp muted myself, it muted me for a split second then said Im unmuted also same with temp ban
    In the history doesn't say if it's active or not (enchanted mechanism I told you about)

    ASAP:
    If you tempmute someone, they stay muted UNTIL they try to talk. Then it unmutes them


    Can I add the jar to my plugin as an API to have custom chat? because the muting currently doesn't work due to my custom chat, So I was wondering if you made it API-able.

    Thanks! Once you're done just PM me the link for the jar
     
    Last edited: Jul 23, 2015
  12. Offline

    Tecno_Wizard

    @OfficerDeveloper, and this is why i asked if you wanted an event listener before I wrote things.

    You can have a multiple word reasons. Just keep typing.
    Yes, there are a lot of debug messages in it still. Those will be removed, don't worry.
    OOf. Getting whether the punishment is active in the history is going to be very hard. Do you really need that?
    I know the cause of the cooldown issue. Calculated in mins, but added as milliseconds. Oops. Well, that same kind of mistake did screw over the first mars mission...
    Right now muting is saved as a few values inside of the MetadataHandler singleton. You can tap into that without any problems, just don't reassign values.
    Playerfile file = new PlayerFile(UUID id) will give you access to all player data. Yes, the file is empty, but it uses default values when there are no set fields. Storage management.

    Also, please stop adding prefixes everywhere. Use Resources.sendMessage() if you want to have prefixes.
     
    Last edited: Jul 23, 2015
  13. The punishment history thing is a MUST.
    The cooldown un-punish thing must be fixed, and I really don't have time to do it.

    The multiple line reason thing IS a bug. That reason was spaced out in the command, but it wasn't in the GUI,

    Sorry, but I just normally coded like that with adding prefixes.
     
  14. Offline

    Tecno_Wizard

    @OfficerDeveloper, Oh, I get the one word thing now. Fixing that (It seems that IntelliJ is having difficulty pushing to github atm, not sure why)

    I'll have to get the punish history expirations in the entries, that's easy. The issue is checking if a punishment was reverted because right now entries are immutable and the punishment entry itself is not mapped to the punishment effect.
     
  15. @Tecno_Wizard Ok, well for the history;

    If the punishment is active: Have the item be enchanted with Unbr 1 or something
    If player left clicks the punishment, the item is no longer enchanted, and the punishment is not active, and on the lore it adds " Remove Reason: " with the arg 1 and "Removed by: " woth the person who removed it.

    When a punishment expires, the item becomes non-enchanted and thats it

    (Includes evrrything except warnings)
     
  16. Offline

    Tecno_Wizard

  17. Ok, sorry about that. Give me the jar right before you leave though, so that I have an updated version for messages and design and everything.

    Also will the time issue for temp ban/mute be fixed soon?
    And for history: everything is a book. For history, I want the punishment type to be the actual thing.

    One more thing: How do I remove it?

    Like past perm ban = Redstone block, Warning = Paper, etc...

    And I want this to be on another line, like a \n thing:
    http://prntscr.com/7w7zu0
     
    Last edited: Jul 23, 2015
  18. Offline

    Tecno_Wizard

    @OfficerDeveloper, not sure that I can put it on another line, but I'll try. Punishments still can't be removed. I'm not houdini, things take time.
    Please stop hard coding color strings. Not only is it ugly, it's unreadable...

    Switching back to my data lib. If it's any consideration to why I've been slow, check out this baby...
    Code:
    /**
         * Gets the value mapped to the key. Note that this is generic, meaning that all types are immediately casted to the Class type
         *  If the mapped value does not exist or is not an instance of type, null will be returned with the exception of classes implementing DatabaseSerializable,
         *   which will be converted back from a map if possible.
         * @param key key to get the mapped value of
         * @param <T> Class type to return.
         * @param type Class to attempt cast to
         * @return
         */
        public <T> T get(String key, Class<T> type) {
            Object obj = jsonObject.get(key);
            if(type.isInstance(obj)) return (T)obj;
            else if(obj instanceof Map){
                Class[] clazzes = type.getInterfaces();
                for(Class clazz: clazzes) {
                    if(clazz.equals(DatabaseSerializable.class)) {
                        try {
                            return (T)type.getMethod("deserialize", Map.class).invoke(null, (Map<String, Object>) obj);
                        } catch (Exception exception) {
                            System.out.println("Error: Deserialization of class " + type.getName() + " was attempted but" +
                                    " failed. \"deserialize\" has not been implemented correctly or the key is not mapped" +
                                    " to the object that was specified for deserialization.");
                            return null;
                        }
                    }
                }
            } return null;
        }
    Code:
    package com.tecno_wizard.datalib;
    
    import java.util.Map;
    
    /**
    * DatabaseSerializable is the interface necessary needed to serialize the object in a database entry.
    *
    * In addition to implementing serialize, the implementing class <b><I>must</I></b> also implement these methods which
    *  are not included in the interface:
    *  <ul style="list-style-type:circle">
    <li>A static method accepting a Map of the generic <String, Object> and returning an instance of the implementing class named <b><i>deserialize.</i></b></li>
    <li>A static method accepting a Map of the generic <String, Object> and returning whether the serialized data is of the class named <b><i>isValueOf.</i></b> A simple
    way to check this is to have index 0 of the map hold the class name and path as a string (Ex. com.name.project.ClassName) mapped to the Object's hex code</li></li>
    </ul>
    <p>Not sure if you have done this correctly? Go to <a href="url">Tecno_Wizard's site</a> for a detailed explanation of this process.</p>
    <p>This process is necessary because Java Objects cannot be directly serialized into JSON. Their values as a map is the only valid input.
    java.lang is exempt.</p>
    */ //TODO update to contain testing class and correct URL
    public interface DatabaseSerializable {
        public Map<String, Object> serialize();
    }
    
     
    Last edited: Jul 23, 2015
  19. Ok sorry if I was being pushy. I just really need this done.
     
  20. Offline

    Tecno_Wizard

  21. What do you mean to hack it?
     
  22. Offline

    Tecno_Wizard

  23. @Tecno_Wizard Ahh ok. So here is a full list of what I want done:

    History to be newest-latest format
    History item to be the actual punishment eg: Redstone blocks for perm bans
    History to be enchsnted if active
    If enchanted history item is left clicked then it removes the punishment and the lore adds who removed it and the arg1 reason
    Back button on history menu

    I want the Unfairly Punished? stc... thing to be on a \n thing: http://prntscr.com/7w7zu0
     
  24. Offline

    Tecno_Wizard

    @OfficerDeveloper
    1. fixed
    2. easier fix
    3. difficult, will require rewrite of history
    4. Punishments are removed by clicking on the punishment in the main menu. That I can whip up.
    5. The AmpMenu API will be helping me with this, but it won't be quick.
     
  25. @Tecno_Wizard

    1. Mk
    2. Double mk
    3. Needed asap ;)
    4. That won't work, I need the 3rd and 4th option to replace it
    5. kk

    Also, need to fix that time issue where it un-punishes them if they talk while muted or join banned

    Also, when I 'undo' the punishment the current way by clicking the tempban thing when it says punishment disabled, it's still enabled.

    And I don't want this to be in military time: http://prntscr.com/7wkke1

    And the messages are messed up from what I set them as: http://prntscr.com/7wkh1p

    Also want the message for when they try to talk while muted or join when banned be the same format as the kick and chat messages in the PunishmentDealer class.

    Are those edits in the latest jar?
     
    Last edited: Jul 24, 2015
  26. Offline

    Chiller

    @OfficerDeveloper So last night I forked @Tecno_Wizard 's repo and started modifying it quite a bit.
    I have changed and added many things! Most of his bugs should be squashed and all the features you requested should be implemented!

    Github: https://github.com/TheChillerCraft/PunismentGUI/releases/tag/v1.0.0-beta

    I also added the messages to the config file so feel free to edit the messages all you want!
    Please reply if you have any questions/bug reports!

    Thanks!

    P.S. I am not taking full credit for this plugin, just for the things I modified!
     
  27. Offline

    Tecno_Wizard

    @Chiller, I saw the forked repo. Can I pull and merge? Credit will be given, and if you have any other changes, Resources.sendMessage() adds and formats messages with the plugin prefix.
    And thank you. I've been too busy to just sit down and work.
     
    Last edited: Jul 24, 2015
  28. Offline

    Chiller

    @Tecno_Wizard Ya go ahead and merge it in with yours, doesn't bother me!
    My build seems pretty stable at the moment, if you find any bugs go ahead and fix them or reply and I can fix them!

    Since I integrated maven into my project, it does not use the src dir in the parent...
    So you might have a few problems with merging it...
     
Thread Status:
Not open for further replies.

Share This Page