Solved Making new thread

Discussion in 'Spigot Plugin Development' started by Domboing, Jun 12, 2018.

  1. Working on kitpvp

    View attachment 348146

    and i want it to be seperate to the player

    Code (Text):
    package gg.kisurimc.kitpvp.state;

    import java.util.UUID;

    public enum PlayerState
    {

        LOBBY, FIGHTING,
        PRAC_LOBBY, PRAC_FIGHTING;

        private static PlayerState currentState;

        public static PlayerState setType(PlayerState state, UUID uuid)
        {
            return PlayerState.currentState = state;
        }
       
        public static PlayerState getState(UUID uuid)
        {
            return currentState;
        }
    }
     
     
    #1 Domboing, Jun 12, 2018
    Last edited: Jun 12, 2018
  2. Create a player manager and wrapper for your custom state:
    Code (Text):
    public class CustomPlayer {

        Player player'
        State state

        #your constuctor here

        #getters and setters

    }
     
    • Agree Agree x 1
  3. This would work for my kitpvp becuase im setting there state to fighting which will change the scoreboard because at the moment it does it globally and need it for each player
     
  4. That is for each player, unless I'm not catching your meaning. Register a new CustomPlayer for everyone that joins. Or are you trying to do like it for multiple servers? If that's the case you're (obviously) going to have to communicate through bungee or some sort.
     
  5. Will you learn from what people tell you?
    This code
    Enumeration Help
    This is your 3rd thread regarding a similar issue.
    [​IMG] And by get some help I mean go and learn Java.
    Basically @MartenM gave you a pretty good example or idea of how you should implement this.
     
    • Friendly Friendly x 1
  6. You dont understand right when a player gets a kit it changes for them both
    upload_2018-6-12_18-7-38.png

    and i want it to be seperate to the player

    http://prntscr.com/ju4ol1

    Code (Text):
    package gg.kisurimc.kitpvp.state;

    import java.util.UUID;

    public enum PlayerState
    {

        LOBBY, FIGHTING,
        PRAC_LOBBY, PRAC_FIGHTING;

        private static PlayerState currentState;

        public static PlayerState setType(PlayerState state, UUID uuid)
        {
            return PlayerState.currentState = state;
        }
     
        public static PlayerState getState(UUID uuid)
        {
            return currentState;
        }
    }
     
     
  7. it needs to be unique to the player so they all dont have the same sb
     
  8. If you would have said suggested Player Manager with said CustomPlayer class, you could have individual Kits. Of course everyone will have the same Kit if you all assign them from a single, static variable.
    This is not a Spigot problem. This problem results of your lacking Java knowledge.
     
    • Agree Agree x 1