Solved World Edit Issue

Discussion in 'Plugin Development' started by Coopah, Jan 3, 2016.

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

    Coopah

    @teej107 @Areoace
    I'll tell you again... and to tell you both the truth, I've repeated myself too many times.
    This does not get an edit session, it creates a NEW one!
    Code:
    EditSession es =new EditSession(BWf, 2000000);
    How do you propose I get a session? The only thing you have told me to do, is to create a new session and supposedly save it. You haven't told me anything remotely useful that I haven't already tried.
     
    Last edited: Jan 12, 2016
  2. Offline

    Areoace

    @Coopah stop having a tantrum and think please, we're only trying to guide you through it.

    Step one:

    Code:
    BukkitWorld BWf = new BukkitWorld(x.getWorld())
    Step two:

    Code:
    EditSession es = new EditSession(BWf, 2000000);,
    Step three: Do what you want, if you can paste using the edit session then why can't you undo with the edit session?
     
  3. Offline

    teej107

    Assign it to a field :p
    aka
    I've told you what you need to do and you aren't doing it.
     
  4. Offline

    Coopah

    @Areoace @teej107
    Sorry boys, I wasn't quite explaining myself correctly. I was trying to undo it via another class/event, you were just telling me how to create an EditSession, not how to acquire one.
     
  5. Offline

    teej107

    I'm not telling you how to create an EditSession. You know how to create an EditSession. It's in your code! Now save the damn EditSession for later use.
    EDIT: Oh..... it's solved.
     
  6. Offline

    Coopah

    @teej107
    You're even worse at explaining yourself than me lmao.
     
  7. Offline

    teej107

    I doubt it. My instructions were pretty clear.
     
  8. Offline

    tommyhoogstra

    Why don't you just use a Getter to return the edit session so you can access from wherever you need, granted you could still do that without a getter, but it does make it a whole lot simpler.

    I would, however, consider making your own object to store an edit session with an ID

    Code:
    
    public class Session{
    
    private List<Session> sessions = new ArrayList<>();
    private String ID;
    private EditSession es;
    
             public Session(String ID, EditSession es){
                     this.ID = ID;
                     this.es = es;
                     sessions.add(this);
             }
    
             public EditSession getEditSession(){
                    return es;
              }
    
              public String getID(){
                   return ID;
              }
    
    
              public static Session getSession(String id){
                        for(Session s : sessions){
                             if(s.getID().equals(id)){
                                  return s;
                              }
                        }
    
              return null;
               }
    }
    
    Then you could just be like

    new Session("Battle Arena", new EditSession(etc etc));

    And then when you want the session

    Session.getSession("Battle Arena").getEditSession();
     
    Coopah likes this.
Thread Status:
Not open for further replies.

Share This Page