Thread: Double Experience Event Has Ended spamming in Global

Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1 Double Experience Event Has Ended spamming in Global 
    Registered Member
    Join Date
    May 2016
    Posts
    16
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    Here's my DoubleExperience.Java

    I really can't see why it's spamming this none stop, the code originally was lacking a 'return;' after the final string but that has apparently done nothing.. Any ideas?


    Code:
    public class DoubleExperience extends Event {
    	
    	private int ticks = 0;
    
    	@Override
    	public boolean start() {
    		World.sendGlobalMessage("<img=1><col=ff0000>[EVENT]: Double Experience is now active for 30 minutes.");
    		return true;
    	}
    
    	@Override
    	public boolean preStartupCheck() {
    		return true;
    	}
    
    	@Override
    	public int process() {	
    		ticks++;
    		if (ticks >= 500)
    			stop();
    		return 1;
    	}
    
    	@Override
    	public void stop() {
    		World.sendGlobalMessage("<img=1><col=ff0000>[EVENT]: Double Experience has now ended.");
    		return;
    	}
    
    }
    Attached image
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Oct 2012
    Posts
    4,710
    Thanks given
    1,679
    Thanks received
    1,105
    Rep Power
    0
    Remove the return;

    Code:
    @Override
    	public int process() {	
    		ticks++;
    		if (ticks >= 500)
    			this.stop();
    		return 1;
    	}
    Reply With Quote  
     

  3. #3  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    post the event class
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    May 2016
    Posts
    16
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by _Patrick_ View Post
    Remove the return;

    Code:
    @Override
    	public int process() {	
    		ticks++;
    		if (ticks >= 500)
    			this.stop();
    		return 1;
    	}
    I tried this but i was getting an error saying that
    Code:
    public int process() {
    must return a result?

    Quote Originally Posted by Professor Oak View Post
    post the event class
    Sorry is this what you're meaning? This is the EventManager.java

    Code:
    	//Getters and setters
    	
    	/**
    	 * Gets the delay.
    	 * @return The delay.
    	 */
    	public int getEventDelay() {
    		return delay;
    	}
    	 
    	/**
    	 * Adds delay the the event processing. 
    	 * @param delay The event.
    	 */
    	public void addEventDelay(int delay) {
    		this.delay += delay;
    	}
    
    	/**
    	 * Sets the delay.
    	 * @param delay The delay.
    	 */
    	public void setEventDelay(int delay) {
    		this.delay = delay;
    	}
    	
    	/**
    	 * Sets the current event and stops the previous one.
    	 * @param event {@link Event} The event.
    	 * @return
    	 */
    	public boolean setEvent(Event event) {
    		forceStop();
    		if (!event.start())
    			return false;
    		this.event = event;
    		return true;
    	}
    	
    	/**
    	 * Gets the {@link Event} event.
    	 * @return the event.
    	 */
    	public Event getEvent() {
    		return event;
    	}
    	
    	/**
    	 * Starts event boss timer.
    	 */
    	public void appendTimer() {
    		timer.scheduleAtFixedRate(new TimerTask() {
    			@Override
    			public void run() {	
    				switch (Utility.random(2)) {
    					case 0:
    						setEvent(new BossEvent());
    					    eventAmount[1]++;
    					    System.out.println("Exectuing Event: " + "BossEvent: #" + eventAmount[0]);
    					    break;
    					case 1:
    						setEvent(new DoubleGold());
    					    eventAmount[2]++;
    					    System.out.println("Exectuing Event: " + "DoubleGold: #" + eventAmount[1]);
    						break;
    					case 2:
    						setEvent(new DoubleExperience());
    					    eventAmount[3]++;
    					    System.out.println("Exectuing Event: " + "DoubleExperience: #" + eventAmount[2]);
    						break;
    					default:
    						setEvent(new BossEvent());
    					    eventAmount[1]++;
    					    System.out.println("Exectuing Event: " + "BossEvent: #" + eventAmount[0]);
    				  }
    			  }
    		}, 120 * 60 * 1000, 120 * 60 * 1000); //Execute every 2 hours.
    	}
    	
    }
    Reply With Quote  
     

  5. #5  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Might be because you need super.stop() i cant tell you for sure without looking at the event code, what base is it?
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    May 2016
    Posts
    16
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Stuart View Post
    Might be because you need super.stop() i cant tell you for sure without looking at the event code, what base is it?
    It's Valius, Vencillio based. Which code would that be, I can post it if i know what i'm looking for lol.
    Reply With Quote  
     

  7. #7  
    Donator


    Join Date
    Jul 2011
    Posts
    570
    Thanks given
    135
    Thanks received
    142
    Rep Power
    291
    Quote Originally Posted by BACKPAiiN View Post
    It's Valius, Vencillio based. Which code would that be, I can post it if i know what i'm looking for lol.
    Post event class, it extends DoubleExperience.

    But try putting super.stop(); after your message then i think it should work.

    Code:
    	@Override
    	public void stop() {
    		World.sendGlobalMessage("<img=1><col=ff0000>[EVENT]: Double Experience has now ended.");
    		super.stop();
    	}
    Reply With Quote  
     

  8. Thankful user:


  9. #8  
    Registered Member
    Join Date
    May 2016
    Posts
    16
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Empathy View Post
    Post event class, it extends DoubleExperience.

    But try putting super.stop(); after your message then i think it should work.

    Code:
    	@Override
    	public void stop() {
    		World.sendGlobalMessage("<img=1><col=ff0000>[EVENT]: Double Experience has now ended.");
    		super.stop();
    	}
    Here's my Event.class thought it's saying that there's no source file attached? And it's appearing in eclipse in a plain text style..

    Code:
    // Compiled from Event.java (version 1.8 : 52.0, super bit)
    public abstract class com.mayhem.rs2.content.event.Event {
      
      // Method descriptor #6 ()V
      // Stack: 1, Locals: 1
      public Event();
        0  aload_0 [this]
        1  invokespecial java.lang.Object() [8]
        4  return
          Line numbers:
            [pc: 0, line: 10]
          Local variable table:
            [pc: 0, pc: 5] local: this index: 0 type: com.mayhem.rs2.content.event.Event
      
      // Method descriptor #15 ()Z
      public abstract boolean start();
      
      // Method descriptor #15 ()Z
      public abstract boolean preStartupCheck();
      
      // Method descriptor #18 ()I
      public abstract int process();
      
      // Method descriptor #6 ()V
      public abstract void stop();
      
      // Method descriptor #21 (Lcom/mayhem/rs2/entity/World;I)V
      // Stack: 2, Locals: 3
      protected final void setDelay(com.mayhem.rs2.entity.World world, int delay);
        0  invokestatic com.mayhem.rs2.entity.World.getEventManager() : com.mayhem.rs2.content.event.EventManager [22]
        3  iload_2 [delay]
        4  invokevirtual com.mayhem.rs2.content.event.EventManager.setEventDelay(int) : void [28]
        7  return
          Line numbers:
            [pc: 0, line: 26]
            [pc: 7, line: 27]
          Local variable table:
            [pc: 0, pc: 8] local: this index: 0 type: com.mayhem.rs2.content.event.Event
            [pc: 0, pc: 8] local: world index: 1 type: com.mayhem.rs2.entity.World
            [pc: 0, pc: 8] local: delay index: 2 type: int
      
      // Method descriptor #39 (Ljava/lang/String;)V
      // Stack: 3, Locals: 2
      public void sendMessage(java.lang.String message);
         0  new java.lang.StringBuilder [40]
         3  dup
         4  ldc <String "<img=1><col=ff0000>[EVENT]: "> [42]
         6  invokespecial java.lang.StringBuilder(java.lang.String) [44]
         9  aload_1 [message]
        10  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [46]
        13  ldc <String "</col>"> [50]
        15  invokevirtual java.lang.StringBuilder.append(java.lang.String) : java.lang.StringBuilder [46]
        18  invokevirtual java.lang.StringBuilder.toString() : java.lang.String [52]
        21  invokestatic com.mayhem.rs2.entity.World.sendGlobalMessage(java.lang.String) : void [56]
        24  return
          Line numbers:
            [pc: 0, line: 30]
            [pc: 24, line: 31]
          Local variable table:
            [pc: 0, pc: 25] local: this index: 0 type: com.mayhem.rs2.content.event.Event
            [pc: 0, pc: 25] local: message index: 1 type: java.lang.String
    }
    Reply With Quote  
     

  10. #9  
    Donator


    Join Date
    Jul 2011
    Posts
    570
    Thanks given
    135
    Thanks received
    142
    Rep Power
    291
    I can't tell based off that but i'll take a guess. Even though you called the stop method, its still looping through process so there has to be a way to stop it. Try returning -1.

    Code:
    @Override
    	public int process() {	
    		ticks++;
    		if (ticks >= 500) {
    			stop();
                            return -1;
                    }
    		return 1;
    	}
    Also post your whole eventmanager class. I wanna see how the process method is called.
    Reply With Quote  
     

  11. Thankful user:


  12. #10  
    Registered Member
    Join Date
    May 2016
    Posts
    16
    Thanks given
    10
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Empathy View Post
    Post event class, it extends DoubleExperience.

    But try putting super.stop(); after your message then i think it should work.

    Code:
    	@Override
    	public void stop() {
    		World.sendGlobalMessage("<img=1><col=ff0000>[EVENT]: Double Experience has now ended.");
    		super.stop();
    	}
    That didn't work and also gave this error in eclipse

    Attached image
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 4
    Last Post: 07-29-2009, 05:51 AM
  2. spamming in the spam section
    By Simon in forum Complaints
    Replies: 4
    Last Post: 06-16-2009, 02:14 AM
  3. PLAYER has just logged in || Text on-screen
    By Hyperventilate in forum Help
    Replies: 12
    Last Post: 04-10-2009, 09:12 PM
  4. Replies: 2
    Last Post: 03-31-2009, 09:47 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •