Plugin request

Discussion in 'Plugin Requests' started by mrxqware, Sep 30, 2015.

Thread Status:
Not open for further replies.
  1. Dear guys and girls,

    I would like to have a plugin which detects IF a player wears a red wool (item 35:14) in the helmet slot (slot: 103) THEN I want it to color the player's nametag to red and a chatprefix "&4[Red]"

    and IF the player wears a blue wool block (item 35:11) in the helmet slot (slot: 103) THEN I want it to color the player's nametag to blue and a chatprefix "&4[Blue]"

    - It doesn't matter if the player has changed the wool block into a helmet or other /hat.
    - If the player switches to another world named "Hub" then I would like the plugin to remove the tagcolor (or make it white) and the chatprefix

    I hope you could help me!


    Kind regards,
    Mike
     
    Last edited: Oct 2, 2015
  2. Offline

    tcvs

    @mrxqware If you would like to attract people to your post, I would recommend you change the title to something meaningful. We know this is a request because your are in the plugin request forum.
     
    timtower likes this.
  3. thank you for the tip, idk how to edit the title atm, but I will keep it in mind for next time. I hope someone could help me with this.
     
  4. Offline

    tkuiyeager1

    @mrxqware in your request you said you want the players with the red wool on thier head, thier name tag will become to red and thier prefix become to &4[Red], but you said the same about the blue wool. did you mean that thier name tag will become to blue and thier prefix will be &b[Blue]?
     
  5. @tkuiyeager1 yes you are right! I've edited it. Could you help me please?
     
  6. Offline

    tkuiyeager1

    @mrxqware i will try but how do you want the plugin will be called?
     
  7. @tkuiyeager1 EzTeams (if you like the name of course ^^)
     
  8. Offline

    tkuiyeager1

    @mrxqware why did you say slot: 103? slot 5 is the helmet slot no?
     
  9. @tkuiyeager1 the command with commandblocks looks like:

    /testfor @p {Inventory:[{Slot:103b,id:"minecraft:wool",Damage:14s}]}
    (that will check if a player has a red woolblock in the helmet slot)

    that's why I thought the slot would be 103
     
  10. Offline

    tkuiyeager1

    @mrxqware nvm in coding you can do getHelmet() and then you can check if the helmet is the wool. also im almost finish. to use the plugin with the tags thing you will need to install other plugin. when i finish the plugin i will tell you.
     
  11. Offline

    tkuiyeager1

    ok @mrxqware so the plugin is ready, you need to download 2 plugins:
    this one - the plugin i made.
    and <Edit by Moderator: Redacted not allowed paid resource url>

    Note: i didnt tested out the tag thing so please let me know if there are any bugs.
    Enjoy The Plugin!
     
    Last edited by a moderator: Dec 5, 2016
  12. @tkuiyeager1 I've tried it, but I'm getting this error:

    Code:
    [14:30:31] [Server thread/ERROR]: Could not load 'plugins\EzTeams.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/tkuiyeager1/ezteams/Main : Unsupported major.minor version 52.0
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit.jar:git-Bukkit-33d5de3]
    at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:328) ~[craftbukkit.jar:git-Bukkit-33d5de3]
    at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [craftbukkit.jar:git-Bukkit-33d5de3]
    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugins(CraftServer.java:288) [craftbukkit.jar:git-Bukkit-33d5de3]
    at org.bukkit.craftbukkit.v1_8_R1.CraftServer.<init>(CraftServer.java:250) [craftbukkit.jar:git-Bukkit-33d5de3]
    at net.minecraft.server.v1_8_R1.PlayerList.<init>(PlayerList.java:69) [craftbukkit.jar:git-Bukkit-33d5de3]
    at net.minecraft.server.v1_8_R1.DedicatedPlayerList.<init>(SourceFile:14) [craftbukkit.jar:git-Bukkit-33d5de3]
    at net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.java:133) [craftbukkit.jar:git-Bukkit-33d5de3]
    at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:484) [craftbukkit.jar:git-Bukkit-33d5de3]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_05]
    Caused by: java.lang.UnsupportedClassVersionError: me/tkuiyeager1/ezteams/Main : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.7.0_05]
    at java.lang.ClassLoader.defineClass(Unknown Source) ~[?:1.7.0_05]
    at java.security.SecureClassLoader.defineClass(Unknown Source) ~[?:1.7.0_05]
    at java.net.URLClassLoader.defineClass(Unknown Source) ~[?:1.7.0_05]
    at java.net.URLClassLoader.access$100(Unknown Source) ~[?:1.7.0_05]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_05]
    at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_05]
    at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_05]
    at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.7.0_05]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:77) ~[craftbukkit.jar:git-Bukkit-33d5de3]
    at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:62) ~[craftbukkit.jar:git-Bukkit-33d5de3]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_05]
    at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_05]
    at java.lang.Class.forName0(Native Method) ~[?:1.7.0_05]
    at java.lang.Class.forName(Unknown Source) ~[?:1.7.0_05]
    at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[craftbukkit.jar:git-Bukkit-33d5de3]
    at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:129) ~[craftbukkit.jar:git-Bukkit-33d5de3]
    ... 9 more
    
    Am I doing something wrong?
     
  13. Offline

    timtower Administrator Administrator Moderator

    @mrxqware Plugin is compiled with java 8, you are running java 7, something the developer has to fix.
    @tkuiyeager1
     
  14. Offline

    tkuiyeager1

    @mrxqware im trying to fix it.
    @timtower when i change it to 1.7 it shows me some errors in the plugin. and i dont think im changing the correct value
    Edit:
    it want me to change player itemstack and more variables to final, the plugin will still work?

    Edit:
    Ok @mrxqware here is the updated link.
    Thank you @timtower
    @mrxqware please reply if you find any bugs.
     
    Last edited: Oct 2, 2015
  15. @tkuiyeager1 it's really awesome I love it alot! It does exactly what I requested.
    There's one thing; the tag turns red (just as I wanted) but it also copies the name twice. in tab I'll see AxelTecAxelTec also the tag above my head is AxelTecAxelTec. (my game name is AxelTec).

    I'm extremely happy that you helped me out and that you succeeded to do it that fast! I can't thank you enough ;)

    Would you like to send me the sourcecode? It's for personal use only, I really want to learn to code bukkit plugins so maybe one day I could achieve your awesome skills.
     
  16. Offline

    tkuiyeager1

    @mrxqware i could not fix the problem.
    Here is the code:
    Code:
    package me.tkuiyeager1.ezteams;
    
    import net.playerforcehd.nametags.TagManager.TagManager;
    import net.playerforcehd.nametags.TagManager.TagPlayer;
    
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.AsyncPlayerChatEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin implements Listener {
    
        @Override
        public void onEnable() {
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
        }
    
        @EventHandler
        public void Check(AsyncPlayerChatEvent e) {
            Player p = e.getPlayer();
            String redprefix = "§4[Red] §r";
            String blueprefix = "§1[Blue] §r";
            ItemStack redwool = new ItemStack(Material.WOOL, 1, (short) 14);
            ItemStack bluewool = new ItemStack(Material.WOOL, 1, (short) 11);
            if (p.getInventory().getHelmet() == null) {
                return;
            }
            if (p.getInventory().getHelmet().hasItemMeta())
                return;
            if (p.getInventory().getHelmet().isSimilar(redwool)) {
                e.setFormat(redprefix + "§4" + p.getName() + "§7: §r"
                        + e.getMessage());
    
            } else if (p.getInventory().getHelmet().isSimilar(bluewool)) {
                e.setFormat(blueprefix + "§1" + p.getName() + "§7: §r"
                        + e.getMessage());
            } else {
                return;
            }
            if(p.getLocation().getWorld().getName().equals("Hub")) {
                e.setFormat(p.getName() + ": " + e.getMessage());
            }
        }
    
        @SuppressWarnings({ "deprecation", "static-access" })
        @EventHandler
        public void OnJoin(PlayerJoinEvent e) {
            final Player p = e.getPlayer();
            final ItemStack redwool = new ItemStack(Material.WOOL, 1, (short) 14);
            final ItemStack bluewool = new ItemStack(Material.WOOL, 1, (short) 11);
            TagPlayer tagplayer = new TagPlayer(p);
            final TagManager tagmanager = new TagManager(tagplayer);
            Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
               
                public void run() {
                    if (p.getInventory().getHelmet() == null) {
                        return;
                    }
                    if (p.getInventory().getHelmet().hasItemMeta())
                        return;
                    if (p.getInventory().getHelmet().isSimilar(redwool)) {
                        tagmanager.setTag(ChatColor.RED + p.getName());
    
                    } else if (p.getInventory().getHelmet().isSimilar(bluewool)) {
                        tagmanager.setTag(ChatColor.BLUE + p.getName());
                    } else {
                        return;
                    }
                    if(p.getLocation().getWorld().getName().equals("Hub")) {
                        tagmanager.resetTag(p);
                    }
                }
            }, 2, 2);
        }
    
    }
    
    @timtower Can you help me with this? It Writes the player name twice example: TKUIYEAGER1TKUIYEAGER1
    and i use 1.8 NameTags API
     
  17. @tkuiyeager1 no problem! I hope that @timtower knows how to fix it. But I'm really thankful for what you did! Thanks a lot for helping me with this awesome plugin. I love it!
     
  18. Offline

    tkuiyeager1

  19. Offline

    timtower Administrator Administrator Moderator

    @tkuiyeager1 I don't know how to fix the name, I do know that you are using setFormat wrong.
     
  20. Offline

    tkuiyeager1

    @timtower what do you mean? what is wrong?

    Edit:
    @timtower and @mrxqware i fix it.
    Here is the link.

    Note: @mrxqware 1.8Tags set the op color name in to red, to cancel it you need to go in the folder 1.8Tags you need to change in the config,
    Code:
    OPcolor: 'f'
     
    Last edited: Oct 3, 2015
  21. Offline

    timtower Administrator Administrator Moderator

    @tkuiyeager1 Check the original format, then to what you set it, no plugin can change the message anymore with your method.
    That is all that I am gonna say about it on this thread.
     
  22. Offline

    tkuiyeager1

    ok @timtower but when i tested it, it worked as i wanted so i will keep it like this i think.
     
  23. Offline

    timtower Administrator Administrator Moderator

    Run PwnFilter behind it and it isn't working anymore.
     
  24. Offline

    tkuiyeager1

  25. Offline

    timtower Administrator Administrator Moderator

    Spam / bad language filter that changes the message. For more information: please make a thread for this.
     
  26. @tkuiyeager1 I love it the way it is right now! Could you send me the code with the fix, so I could learn how you did it? ^^
     
  27. Offline

    tkuiyeager1

    ok @mrxqware here is the link for the next updated version of the plugin (If you see that player's prefix is [Blue] and his name is in red it because he is an op. please use the updated version.)
    Here Is The Code:
    Code:
    package me.tkuiyeager1.ezteams;
    
    import net.playerforcehd.nametags.TagManager.TagManager;
    import net.playerforcehd.nametags.TagManager.TagPlayer;
    
    import org.bukkit.Bukkit;
    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.player.AsyncPlayerChatEvent;
    import org.bukkit.event.player.PlayerJoinEvent;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class Main extends JavaPlugin implements Listener {
    
        @SuppressWarnings("deprecation")
        @Override
        public void onEnable() {
            Bukkit.getServer().getPluginManager().registerEvents(this, this);
            Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(),
                    "/tag resetall");
            Bukkit.getServer().getScheduler()
                    .scheduleAsyncRepeatingTask(this, new Runnable() {
    
                        @SuppressWarnings("static-access")
                        public void run() {
                            for (Player p : Bukkit.getOnlinePlayers()) {
                                final ItemStack redwool = new ItemStack(
                                        Material.WOOL, 1, (short) 14);
                                final ItemStack bluewool = new ItemStack(
                                        Material.WOOL, 1, (short) 11);
                                TagPlayer tagplayer = new TagPlayer(p);
                                final TagManager tagmanager = new TagManager(
                                        tagplayer);
                                if (p.getInventory().getHelmet() == null) {
                                    return;
                                }
                                if (p.getInventory().getHelmet().hasItemMeta())
                                    return;
                                if (p.getInventory().getHelmet().isSimilar(redwool)) {
                                    tagmanager.setTag("§c");
                                    return;
    
                                } else if (p.getInventory().getHelmet()
                                        .isSimilar(bluewool)) {
                                    tagmanager.setTag("§1");
                                    return;
                                } else if (p.getLocation().getWorld().equals("Hub")) {
                                    tagmanager.resetTag(p);
                                    return;
                                } else {
                                    tagmanager.resetTag(p);
                                    return;
                                }
                            }
                        }
                    }, 2, 2);
    
        }
    
        @EventHandler
        public void Check(AsyncPlayerChatEvent e) {
            Player p = e.getPlayer();
            String redprefix = "§4[Red] §r";
            String blueprefix = "§1[Blue] §r";
            ItemStack redwool = new ItemStack(Material.WOOL, 1, (short) 14);
            ItemStack bluewool = new ItemStack(Material.WOOL, 1, (short) 11);
            if (p.getInventory().getHelmet() == null) {
                return;
            }
            if (p.getInventory().getHelmet().hasItemMeta())
                return;
            if (p.getInventory().getHelmet().isSimilar(redwool)) {
                e.setFormat(redprefix + "%s: %s");
    
            } else if (p.getInventory().getHelmet().isSimilar(bluewool)) {
                e.setFormat(blueprefix + "%s: %s");
            } else {
                return;
            }
            if (p.getLocation().getWorld().getName().equals("Hub")) {
                e.setFormat("%s: %s");
            }
        }
    
        @EventHandler
        public void OnJoin(PlayerJoinEvent e) {
            Player p = e.getPlayer();
            TagPlayer tagplayer = new TagPlayer(p);
            final TagManager tagmanager = new TagManager(tagplayer);
            tagmanager.setTag("§f");
    
        }
    
    }
    
    Note:
    I used 1.NameTags API

    @mrxqware did you try to use the plugin?

    Edit:
    @timtower i know i need to use the edit button and not use double posting sorry

    EDIT by Timtower: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 3, 2015
  28. @tkuiyeager1 I've tried it and it's amazing! Could you help me with 1 more thing? I would like some kind of playervariables.

    Something like this:

    Code:
                                if (p.getInventory().getHelmet().hasItemMeta())
                                    return;
                                if (p.getInventory().getHelmet().isSimilar(redwool)) {
                                    tagmanager.setTag("§c");
    
                    SET SOMEPLAYERVARIABLENAME = 1;
                       
                                    return;
    
                                } else if (p.getInventory().getHelmet()
                                        .isSimilar(bluewool)) {
                                    tagmanager.setTag("§1");
    
                       SET SOMEPLAYERVARIABLENAME = 2;
       
                                    return;
    
                                } else if (SOMEPLAYERVARIABLENAME == 1) {
                                    tagmanager.setTag("§c");   
                                    return;
                                } else if (SOMEPLAYERVARIABLENAME == 2) {
                                    tagmanager.setTag("§1");   
                                    return;
    
                                } else if (p.getLocation().getWorld().equals("Hub")) {
                                    tagmanager.resetTag(p);
    
                    SET SOMEVARIABLENAME = 0;
    
                                    return;
                                } else {
                                    tagmanager.resetTag(p);
                    SET SOMEPLAYERVARIABLENAME = 0;
                                    return;
                                }
    
    And the same for the prefixes.

    I would like to have this so the player could switch to other 'helmets' but still stays in the red or blue team.
     
  29. Offline

    tkuiyeager1

    @mrxqware i dont understand. you want that if player is wearing red wool and then he will wear leather helmet he will still be in the red team, but if he wear a blue wool so he will go to the red team?
     
Thread Status:
Not open for further replies.

Share This Page