Thread: [PI]::yell System Revamp

Results 1 to 10 of 10
  1. #1 [PI]::yell System Revamp 
    Registered Member Queen Vi's Avatar
    Join Date
    Aug 2013
    Posts
    28
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    Before you crazies go berserk on me, I am fairly new to coding and worked to the best of my ability, a lot of it looks sloppy, while I wont deny that it isn't please leave constructive criticism, this is more only to read what you guys say in the comments on my mistakes and what I could have done better. I know this has been released many times before. This is my own personal take on it.

    Difficulty: 1/10 C+P

    What you're adding: Attached image

    Files needed to edit: Commands.java, Playersave.java, player.java


    Spoiler for Player.java:
    First, in Player.java and find:
    Code:
     public int FishID;
    Under it add all of these
    Code:
     	public String customYellTag = "Default";
    	public String customYellCol = "<col=0>";
    	public String customYellShad = "";
    	public String customNameCol = "<col=255>";
    	public String customNameShad = "";
    Save that file and onto next



    Spoiler for PlayerSave.java:
    Find:
    Code:
     } else if (token.equals
    You should see something that looks similar to:
    Code:
     } else if (token.equals("xpLock")) {
    						p.xpLock = Boolean.parseBoolean(token2);
    Under
    Code:
     p.xpLock = Boolean.parseBoolean(token2);
    Add these:
    Code:
     } else if (token.equals("Yell-tag")) {
    						p.customYellTag = token2;
    						} else if (token.equals("Yell-color")) {
    						p.customYellCol = token2;
    						} else if (token.equals("Yell-shade")) {
    						p.customYellShad = token2;
    						} else if (token.equals("Yell-tagCol")) {
    						p.customNameCol = token2;
    						} else if (token.equals("Yell-tagShade")) {
    						p.customNameShad = token2;
    Next, still in PlayerSave search for:

    Code:
    characterfile.write("character-rights = ", 0, 19);
    You should see
    Code:
     characterfile.write("character-rights = ", 0, 19);
    			characterfile.write(Integer.toString(p.playerRights), 0, Integer.toString(p.playerRights).length());
    			characterfile.newLine();
    Under
    Code:
     characterfile.newLine();
    Add
    Code:
     			characterfile.write("Yell-tag = ", 0, 11);
    			characterfile.write(p.customYellTag, 0, p.customYellTag.length());
    			characterfile.newLine();
    			characterfile.write("Yell-tagShade = ", 0, 16);
    			characterfile.write(p.customNameShad, 0, p.customNameShad.length());
    			characterfile.newLine();
    			characterfile.write("Yell-tagCol = ", 0, 14);
    			characterfile.write(p.customNameCol, 0, p.customNameCol.length());
    			characterfile.newLine();
    			characterfile.write("Yell-shade = ", 0, 13);
    			characterfile.write(p.customYellShad, 0, p.customYellShad.length());
    			characterfile.newLine();
    			characterfile.write("Yell-color = ", 0, 13);
    			characterfile.write(p.customYellCol, 0, p.customYellCol.length());
    			characterfile.newLine();
    Save that and move onto next


    Now open up Commands.java
    (This part is up to you where you would like it, if you wish for these commands to be donator only, add them under donatorCommands or however you have it setup)


    Spoiler for Yell Command:
    Code:
    if (playerCommand.startsWith("yell")) {
    			if (Connection.isMuted(c)) {
    			c.sendMessage("You are muted and cannot yell.");
    			return;
    			}
    				for (int j = 0; j < Server.playerHandler.players.length; j++) {
    					if (Server.playerHandler.players[j] != null) {
    						Client c2 = (Client)Server.playerHandler.players[j];
    
    							if (c.playerRights == 0){
    								c.sendMessage("<col=255>You must be a donator+ to use this command!</col>");												
                                }else if (c.playerRights == 1){ //Moderator
    								c2.sendMessage(""+ c.customNameCol +""+ c.customNameShad +"["+ c.customYellTag +"] "+ Misc.optimizeText(c.playerName) +":</col></shad> "+ c.customYellCol +""+ c.customYellShad +""
    												+ Misc.optimizeText(playerCommand.substring(5)) +"");
    							}else if (c.playerRights == 2){ //Admin
    								c2.sendMessage(""+ c.customNameCol +""+ c.customNameShad +"["+ c.customYellTag +"] "+ Misc.optimizeText(c.playerName) +":</col></shad> "+ c.customYellCol +""+ c.customYellShad +""
    												+ Misc.optimizeText(playerCommand.substring(5)) +"");
    							}else if (c.playerRights == 3){ //Owner
    								c2.sendMessage(""+ c.customNameCol +""+ c.customNameShad +"["+ c.customYellTag +"] "+ Misc.optimizeText(c.playerName) +":</col></shad> "+ c.customYellCol +""+ c.customYellShad +""
    												+ Misc.optimizeText(playerCommand.substring(5)) +"");
    							}else if (c.playerRights == 4){ //Donator
    								c2.sendMessage(""+ c.customNameCol +""+ c.customNameShad +"["+ c.customYellTag +"] "+ Misc.optimizeText(c.playerName) +":</col></shad> "+ c.customYellCol +""+ c.customYellShad +""
    												+ Misc.optimizeText(playerCommand.substring(5)) +"");
    						}
    						}
    					}
    				}
    
    
        }


    Spoiler for Set Tag Command:
    Code:
    if (playerCommand.startsWith("settag") && playerCommand.length() > 7) {
    			String tag = playerCommand.substring(7);
    			if (tag.length() < 1 || tag.length() > 150) {
    				c.sendMessage("Yell tag must up to 150 characters long!");
    				return;
    			}
    			String[] blocked = {"owner", "mod", "moderator", "admin"};
    			for (int i = 0; i < blocked.length; i++) {
    				if (tag.toLowerCase().contains(blocked[i])) {
    					c.sendMessage("Tag Blocked: Abuse = Ban");
    					return;
    				}
    			}
    			c.customYellTag = playerCommand.substring(7);
    			c.sendMessage("You changed your YellTag to: " + c.customYellTag);
    			return;
            }


    Spoiler for Set Tag Color:
    Code:
    if (playerCommand.startsWith("setnamecol") && playerCommand.length() > 11) {
    			String tag = playerCommand.substring(11);
    			if (tag.length() < 1 || tag.length() > 150) {
    				c.sendMessage("Yell tag must up to 150 characters long!");
    				return;
    			}
    			String[] blocked = {"a", "b", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "?", ";", ":", "'", "[", "{", "]", "}", "", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "`", "~"," "};
    			for (int i = 0; i < blocked.length; i++) {
    				if (tag.toLowerCase().contains(blocked[i])) {
    					c.sendMessage("Usage of illegal charaters, use only as ::setnamecol <col=800000000>");
    					return;
    				}
    			}
    			c.customNameCol = playerCommand.substring(11);
    			c.sendMessage("You have set your name and tag color.");
    			return;
            }


    Spoiler for Set Tag Shade:
    Code:
    if (playerCommand.startsWith("setnameshad") && playerCommand.length() > 12) {
    			String tag = playerCommand.substring(12);
    			if (tag.length() < 1 || tag.length() > 150) {
    				c.sendMessage("Yell tag must up to 150 characters long!");
    				return;
    			}
    			String[] blocked = {"b", "c", "e", "f", "g", "i", "j", "k", "l", "m", "n", "p", "q", "r", "t", "u", "v", "w", "x", "y", "z", "?", ";", ":", "'", "[", "{", "]", "}", "", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "`", "~"," "};
    			for (int i = 0; i < blocked.length; i++) {
    				if (tag.toLowerCase().contains(blocked[i])) {
    					c.sendMessage("Usage of illegal charaters, use only as ::setnameshad col=800000000");
    					c.sendMessage("Make sure you wrap your col code around greater than and less than symbols.");
    					return;
    				}
    			}
    			c.customNameShad = playerCommand.substring(12);
    			c.sendMessage("You have set your name and tag shade.");
    			return;
            }



    Spoiler for Set Yell Color:
    Code:
    		if (playerCommand.startsWith("setyellcolor") && playerCommand.length() > 13) {
    			String tag = playerCommand.substring(13);
    			if (tag.length() < 1 || tag.length() > 150) {
    				c.sendMessage("Yell tag must up to 150 characters long!");
    				return;
    			}
    			String[] blocked = {"a", "b", "d", "e", "f", "g", "h", "i", "j", "k", "m", "n", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "?", ";", ":", "'", "[", "{", "]", "}", "", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "`", "~"," "};
    			for (int i = 0; i < blocked.length; i++) {
    				if (tag.toLowerCase().contains(blocked[i])) {
    					c.sendMessage("Usage of illegal charaters, use only as ::setyellcolor <col=800000000>");
    					return;
    				}
    			}
    			c.customYellCol = playerCommand.substring(13);
    			c.sendMessage("You have set your yell color.");
    			return;
            }


    Spoiler for Set Yell Shade:
    Code:
    			if (playerCommand.startsWith("setyellshad") && playerCommand.length() > 12) {
    			String tag = playerCommand.substring(12);
    			if (tag.length() < 1 || tag.length() > 150) {
    				c.sendMessage("Yell tag must up to 150 characters long!");
    				return;
    			}
    			String[] blocked = {"b", "c", "e", "f", "g", "i", "j", "k", "l", "m", "n", "p", "q", "r", "t", "u", "v", "w", "x", "y", "z", "?", ";", ":", "'", "[", "{", "]", "}", "", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "+", "`", "~"," "};
    			for (int i = 0; i < blocked.length; i++) {
    				if (tag.toLowerCase().contains(blocked[i])) {
    					c.sendMessage("Usage of illegal charaters, use only as ::setyellshad col=800000000");
    					c.sendMessage("Make sure you wrap your col code around greater than and less than symbols.");
    					return;
    				}
    			}
    			c.customYellShad = playerCommand.substring(12);
    			c.sendMessage("You have set your yell shade.");
    			return;
            }


    Additional command to get color codes on the fly.
    Spoiler for Color Codes:
    Code:
    if (playerCommand.startsWith("colorcodes")) {
    			c.sendMessage("<col=255> Blue: 255");
    			c.sendMessage("<col=20451204> Purple: 20451204");
    			c.sendMessage("<col=16724639> Pink: 16724639");
    			c.sendMessage("<col=255125000> Green: 255125000");
    			c.sendMessage("<col=3145631> Light Green: 3145631");
    			c.sendMessage("<col=330000> Black: 330000");
    			c.sendMessage("<col=616582400> Orange: 616582400");
    			c.sendMessage("<col=200000000> Yellow: 200000000");
    			c.sendMessage("<col=800000000> Red: 800000000");
    			c.sendMessage("<col=99999999> White: 99999999");
    			}


    Once again I know this is horrible and messy please provide constructive criticism in the comments as I am looking to better myself.

    Credits: Tiggy (for the customtag base)
    https://www.rune-server.ee/runescape...r-command.html
    Last edited by Queen Vi; 03-30-2017 at 09:57 PM. Reason: picture
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Registered Member
    Join Date
    May 2016
    Posts
    639
    Thanks given
    260
    Thanks received
    66
    Rep Power
    56
    I will use thanks for this.
    Reply With Quote  
     

  4. #3  
    Registered Member
    Andys1814's Avatar
    Join Date
    Feb 2013
    Posts
    974
    Thanks given
    688
    Thanks received
    455
    Rep Power
    727
    I dont understand how this is "revamped"
    Reply With Quote  
     

  5. Thankful user:


  6. #4  
    Registered Member
    Zivik's Avatar
    Join Date
    Oct 2007
    Age
    28
    Posts
    4,421
    Thanks given
    891
    Thanks received
    1,527
    Rep Power
    3285
    Thanks for the share. Hope you learned something
    Reply With Quote  
     

  7. #5  
    Registered Member Queen Vi's Avatar
    Join Date
    Aug 2013
    Posts
    28
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Andys1814 View Post
    I dont understand how this is "revamped"
    Wasn't so much as a revamp, just add-ons. Struggled with a title so I just said whatever.
    Reply With Quote  
     

  8. #6  
    Theory Wins?
    Greyfield's Avatar
    Join Date
    Nov 2008
    Age
    32
    Posts
    1,585
    Thanks given
    61
    Thanks received
    265
    Rep Power
    310
    Didn't do it for all of your commands because I'm on my phone, but a lot of this can be cut down.

    Code:
    	if (playerCommand.startsWith("yell")) {
    		
    		if (Connection.isMuted(c)) {
    			
    			c.sendMessage("You are muted and cannot yell.");
    			return;
    		}
    		
    		if (c.playerRights < 1) {
    			
    			c.sendMessage("<col=255>You must be a donator+ to use this command!</col>");	
    			return;
    		}
    		
    		final String message = ""+ c.customNameCol +""+ c.customNameShad +"["+ c.customYellTag +"] "+ Misc.optimizeText(c.playerName) +":</col></shad> "+ c.customYellCol +""+ c.customYellShad +""+ Misc.optimizeText(playerCommand.substring(5)) +"";
    		
    		Stream.of(Server.playerHandler.players).filter(Objects::nonNull).forEach(p -> p.sendMessage(message));
    	
    	}



    Reply With Quote  
     

  9. #7  
    Registered Member
    Join Date
    May 2016
    Posts
    639
    Thanks given
    260
    Thanks received
    66
    Rep Power
    56
    i am having issue changing the color of the yell
    Reply With Quote  
     

  10. #8  
    Theory Wins?
    Greyfield's Avatar
    Join Date
    Nov 2008
    Age
    32
    Posts
    1,585
    Thanks given
    61
    Thanks received
    265
    Rep Power
    310
    Quote Originally Posted by TheAmerican View Post
    i am having issue changing the color of the yell
    Probably because of this part in his code for setting a color -
    Code:
    #"
    Should have another quotation mark.



    Reply With Quote  
     

  11. #9  
    Registered Member
    Join Date
    May 2016
    Posts
    639
    Thanks given
    260
    Thanks received
    66
    Rep Power
    56
    Quote Originally Posted by Greyfield View Post
    Probably because of this part in his code for setting a color -
    Code:
    #"
    Should have another quotation mark.
    well idk i will contact a good mate of mine and have him lookat it
    Reply With Quote  
     

  12. #10  
    Registered Member Queen Vi's Avatar
    Join Date
    Aug 2013
    Posts
    28
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by Greyfield View Post
    Didn't do it for all of your commands because I'm on my phone, but a lot of this can be cut down.

    Code:
    	if (playerCommand.startsWith("yell")) {
    		
    		if (Connection.isMuted(c)) {
    			
    			c.sendMessage("You are muted and cannot yell.");
    			return;
    		}
    		
    		if (c.playerRights < 1) {
    			
    			c.sendMessage("<col=255>You must be a donator+ to use this command!</col>");	
    			return;
    		}
    		
    		final String message = ""+ c.customNameCol +""+ c.customNameShad +"["+ c.customYellTag +"] "+ Misc.optimizeText(c.playerName) +":</col></shad> "+ c.customYellCol +""+ c.customYellShad +""+ Misc.optimizeText(playerCommand.substring(5)) +"";
    		
    		Stream.of(Server.playerHandler.players).filter(Objects::nonNull).forEach(p -> p.sendMessage(message));
    	
    	}
    Hey thanks! That definitely looks much better.
    Reply With Quote  
     


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: 50
    Last Post: 10-07-2015, 04:22 AM
  2. (pi) yell system needed(:
    By lmfaojasonn in forum Help
    Replies: 1
    Last Post: 07-01-2014, 04:59 AM
  3. PI yell system
    By jalyn in forum Help
    Replies: 1
    Last Post: 01-05-2013, 10:26 PM
  4. [PI] Customizable Yell Tags > Better Yell System
    By I try too hard in forum Help
    Replies: 6
    Last Post: 08-04-2011, 03:59 PM
  5. [PI] yell system help.
    By divinescape99 in forum Help
    Replies: 4
    Last Post: 05-27-2011, 10:59 PM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •