Thread: Apollo command base reversion.

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 Apollo command base reversion. 
    Registered Member
    Join Date
    Jul 2015
    Posts
    150
    Thanks given
    0
    Thanks received
    7
    Rep Power
    0
    I downloaded apollo today and instantly one thing I hated was the use of ruby and I know I'm not alone! Anyways for all of you who wish to remain a java purist I release this...

    This is a command system built on top of Apollo similar to the typical vanilla command handling system it's super simple in every aspect from the code to the configuration to the implementation other then adding one java file the server sided modification is laughable minimal and straight forward.

    Note: This system will not disable the ruby system you won't have any issues running both at the same time using ruby with java does have its own set of benefits which I encourage you to research this the people who made apollo are pretty good at what they do.

    Step 1. Create named org.apollo.game.command.VanillaCommandHandler.java C&P the following

    Spoiler for VanillaCommandHandler.java:

    Code:
    package org.apollo.game.command;
    
    import org.apollo.Settings;
    import org.apollo.game.model.Player;
    
    public class VanillaCommandHandler implements CommandListener {
    
    	private CommandDispatcher dispatch = null;
    
    	public VanillaCommandHandler(CommandDispatcher dispatch) {
    		this.dispatch = dispatch;
    		registerCommands();
    	}
    
    	@Override
    	public void execute(Player player, Command command) {
    		if (processElevatedCommand(player, command)) {
    			return;
    		} else if (processNormalCommand(player, command)) {
    			return;
    		}
    	}
    
    	/**
    	 * This method is used in the elevated commands method as a way of detecting weather or not a player should be
    	 * able to use a elevated or privileged command.
    	 * 
    	 * It is recommended you elaborate on this and create separate sections for admins mods donators etc...
    	 * @return
    	 */
    	private boolean hasRights(Player player) {
    		if (player.getName().equalsIgnoreCase("Developer")) {
    			return true;
    		}
    		return false;
    	}
    
    	/**
    	 * @return boolean - was command successfully ran?
    	 */
    	private boolean processElevatedCommand(Player player, Command command) {
    		if (!hasRights(player)) {
    			return false;
    		}
    		return false;
    	}
    
    	/**
    	 * This is the actual command processing for when a registered command is typed such as ::test
    	 * an example configuration can be seen below.
    	 * @return boolean - was command successfully ran?
    	 */
    	private boolean processNormalCommand(Player player, Command command) {
    		if(command.getName().equalsIgnoreCase("test")) {
    			player.sendMessage("This is a example test command.");
    		}
    		return false;
    	}
    
    	/*
    	 * To create a new command you need to register it so that the class will listen for it.
    	 * This is done here at registerCommands()
    	 */
    	private void registerCommands() {
    		if (dispatch != null) {
    			dispatch.register("test", this);
    		}
    	}
    
    }


    Step 2. In CommandDispatcher.java in the constructor place the following code...
    Code:
    new VanillaCommandHandler(this);
    Mine now looks like this:
    Code:
    public CommandDispatcher() {
         // not in a plugin so it is harder for people to remove!
         listeners.put("credits", new CreditsCommandListener());
    		
         new VanillaCommandHandler(this);
    }
    Reply With Quote  
     

  2. #2  
    Banned
    Join Date
    Apr 2016
    Posts
    100
    Thanks given
    25
    Thanks received
    17
    Rep Power
    0
    thats some trash code lmaoo learn then post
    Reply With Quote  
     

  3. Thankful users:


  4. #3  
    Registered Member
    Join Date
    Jul 2015
    Posts
    150
    Thanks given
    0
    Thanks received
    7
    Rep Power
    0
    Let's see your improvement then. I've been developing in java and rsps for 10 years but I am open to learning.
    Reply With Quote  
     

  5. #4  
    Super Donator


    Join Date
    Feb 2011
    Age
    27
    Posts
    1,126
    Thanks given
    180
    Thanks received
    178
    Rep Power
    243
    Quote Originally Posted by Dark_Nova View Post
    I downloaded apollo today and instantly one thing I hated was the use of ruby and I know I'm not alone! Anyways for all of you who wish to remain a java purist I release this...

    This is a command system built on top of Apollo similar to the typical vanilla command handling system it's super simple in every aspect from the code to the configuration to the implementation other then adding one java file the server sided modification is laughable minimal and straight forward.

    Note: This system will not disable the ruby system you won't have any issues running both at the same time using ruby with java does have its own set of benefits which I encourage you to research this the people who made apollo are pretty good at what they do.

    *REMOVED THE CODE TO MAKE A SHORTER QUOTE*
    Actually this is not what Apollo is intended to be.. Apollo was made to improve the system to be handled through plugins via *RUBY*
    By this way you do not need to change core functionallities that much only scripts and plugins in the *RUBY*, I guess Graham can explain this better since his the one who created it.
    I think most of the people that has been working with Apollo or currently are would say this is an aweful way that destroys the system layout of plugins.. Because this is more built for Hyperion or PI which you just posted above, which is using pure code in the JAVA files instead using plugins as Apollo are.
    Reply With Quote  
     

  6. Thankful user:

    K2

  7. #5  
    Extreme Donator


    Join Date
    Oct 2010
    Posts
    2,853
    Thanks given
    1,213
    Thanks received
    1,622
    Rep Power
    5000
    Doesn't Apollo use a script language called Ruby for content like this?
    Reply With Quote  
     

  8. Thankful user:

    K2

  9. #6  
    SERGEANT OF THE MASTER SERGEANTS MOST IMPORTANT PERSON OF EXTREME SERGEANTS TO THE MAX!

    cube's Avatar
    Join Date
    Jun 2007
    Posts
    8,871
    Thanks given
    1,854
    Thanks received
    4,745
    Rep Power
    5000
    Ruby is one thing you need to accept to use Apollo, this anti-ruby mindset just reverses the goals and ends up making Apollo no different than other rsps

    Attached image

    Reply With Quote  
     

  10. Thankful users:


  11. #7  
    Registered Member
    Join Date
    Jul 2015
    Posts
    150
    Thanks given
    0
    Thanks received
    7
    Rep Power
    0
    You've misunderstood my intentions I know of the ruby system apollo has in place but I don't like it...

    It's confusing, unnecessary, and forces you to use it and I'm not alone in this feeling this is not a friendly setup for anyone who doesn't know ruby I support the idea to include ruby because it adds some versatility to the code but I felt that this should be optional.

    Because of it's benifits I enocurage you to learn ruby as I have been doing the past day or so...

    All of this has been stated before thank you for your feedback.
    Reply With Quote  
     

  12. #8  
    Banned

    Join Date
    Oct 2009
    Posts
    438
    Thanks given
    29
    Thanks received
    108
    Rep Power
    0
    Quote Originally Posted by Ganorah View Post
    thats some trash code lmaoo learn then post
    Judging from your previous posts, you have no idea what the fuck you're talking about.
    Reply With Quote  
     

  13. Thankful users:


  14. #9  
    Java Programmer
    _Jon's Avatar
    Join Date
    Jan 2015
    Age
    30
    Posts
    206
    Thanks given
    36
    Thanks received
    63
    Rep Power
    47
    Quote Originally Posted by S Quare Quxx View Post
    Ruby is one thing you need to accept to use Apollo, this anti-ruby mindset just reverses the goals and ends up making Apollo no different than other rsps
    and if your not a fan of ruby it will support other scripting languages as well.
    Github - Here
    Reply With Quote  
     

  15. #10  
    Registered Member
    Join Date
    Jul 2015
    Posts
    150
    Thanks given
    0
    Thanks received
    7
    Rep Power
    0
    Really Onime? I didn't know that... I actually like ruby though tbh I love lua and it sort of reminds me of Lua... But alas I can only tinker
    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. [377] [apollo] command not working
    By Woosh in forum Help
    Replies: 8
    Last Post: 11-20-2013, 09:50 PM
  2. [Apollo] Commands
    By K2 in forum Snippets
    Replies: 0
    Last Post: 10-14-2012, 02:52 PM
  3. Apollo - Dodian Based Server
    By mute. in forum Advertise
    Replies: 39
    Last Post: 10-31-2010, 07:26 PM
  4. Command Handler - Uses Tjays command base.
    By Greyfield in forum Tutorials
    Replies: 17
    Last Post: 09-19-2009, 11:06 PM
  5. Simple Command Based Clan Maker/Chat?
    By Solid in forum Requests
    Replies: 0
    Last Post: 08-16-2009, 10:14 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
  •