Advertisement
Guest User

Untitled

a guest
May 24th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.59 KB | None | 0 0
  1. package me.rtn.cee;/*
  2.  * CommandExecutorExample
  3.  * Copyright (C) 2017 RapidTheNerd
  4.  *
  5.  * This program is free software: you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation, either version 3 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  */
  18.  
  19. import org.bukkit.ChatColor;
  20. import org.bukkit.entity.Player;
  21. import org.bukkit.event.Listener;
  22. import org.bukkit.event.player.AsyncPlayerChatEvent;
  23.  
  24. public class staffChat implements Listener {
  25.  
  26.     private static final String STAFF_CHAT_PREIFX = ChatColor.translateAlternateColorCodes('&', "&8[&eSC&8] &b");
  27.     private static final String NO_PERMISSION = ChatColor.RED + "You do not have permission to use this command";
  28.     private static final String PERMISSION_NODE = "litechat.staffchat";
  29.  
  30.     public static void messageStaff(AsyncPlayerChatEvent event){
  31.         Player player = event.getPlayer();
  32.  
  33.         if(player.hasPermission(PERMISSION_NODE)){
  34.             event.setCancelled(true);
  35.             player.sendMessage(STAFF_CHAT_PREIFX + event.getMessage());
  36.         } else {
  37.             player.sendMessage(NO_PERMISSION);
  38.         }
  39.     }
  40.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement