Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.KingLinux01;
- import java.util.Arrays;
- import org.bukkit.GameMode;
- import org.bukkit.Material;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.BookMeta;
- import org.bukkit.permissions.Permission;
- import org.bukkit.plugin.java.JavaPlugin;
- public class FedoraCraftMain extends JavaPlugin {
- private ItemStack rulebook;
- // set permissions to mainplayer and it = fedoracraft.main
- public Permission mainplayer = new Permission("fedoracraft.main");
- public Permission op = new Permission("fedoracraft.op");
- public Permission helper = new Permission("fedoracraft.helper");
- @Override
- public void onEnable() {
- getLogger().info("FedoraCraft Plugin is Enabled");
- ItemStack rulebook = new ItemStack(Material.WRITTEN_BOOK);
- BookMeta rulebookdata = (BookMeta) rulebook.getItemMeta();
- rulebookdata.setTitle("RuleBook");
- rulebookdata.setPages(Arrays.asList("Rules"));
- rulebookdata.setAuthor("KingLinux01");
- rulebookdata.addPage("1. No Swearing \n" +
- "2. No Griefing \n" +
- "3. No scamming \n" +
- "4. No Bulling \n"+
- "5. don't be mean to staff \n"+
- "6. No spamming \n"+
- "7. No Caps \n"+
- "8. Don't beg for ranks \n "+
- "9. no Inappropriate Usernames or skin \n"+
- "10. keep polotics to a minimal\n" +
- "11. no advertising Server");
- rulebook.setItemMeta(rulebookdata);
- }
- @Override
- public void onDisable() {
- getLogger().info("onDisable has been invoked!");
- }
- @SuppressWarnings("deprecation")
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- Player player = (Player) sender;
- // checks if thing typed into the chat with a / before it = fedoracraft
- if (cmd.getName().equalsIgnoreCase("fedoracraft")) {
- //checks if plater has permissions
- if (player.hasPermission(mainplayer)){
- Player man = (Player) sender;
- //send player some info about the server
- man.sendMessage("Welcome to FedoraCraft "
- + "the owner is KingLinux01. "
- + "We have a staff team if you need anything. "
- + "Do /owner to check if owner is on. "
- + "Do /staff to check of staff are on. "
- + "do /site to see all the websites. ");
- }
- return true;
- }
- //checks if command entered was owner
- if (cmd.getName().equalsIgnoreCase("owner")) {
- //set variable owner to KingLinux01
- Player owner = getServer().getPlayerExact("KingLinux01");
- if (player.hasPermission(mainplayer)){
- //checks if owner is online
- if(owner != null){
- //if he is online they will be msg this below
- player.sendMessage("The owner is online. "
- + "KingLinux01 is the owner.");
- }
- else{
- // else they will be messsaged this
- player.sendMessage("The owner is offline. "
- + "See if staff is on to help. do /staff");
- }
- return true;
- }
- }
- //checks if command entered was staff
- if (cmd.getName().equalsIgnoreCase("staff")){
- //set staff1 to little_wes
- Player staff1 = getServer().getPlayerExact("little_wes");
- if (player.hasPermission(mainplayer)){
- //checks if staff1 is online
- if (staff1 != null){
- Player p = (Player) sender;
- //sends them a msg
- p.sendMessage("little_wes "
- + "Is on "
- + "You can msg him for problems"
- + "He is Co-Owner");
- }
- else{
- Player p = (Player) sender;
- //msg the player he is offline
- p.sendMessage("little_wes is offline.");
- }
- // set a varible staff2 to Nacho_Master99
- Player staff2 = getServer().getPlayerExact("Nacho_Master99");
- // test if staff2 is not = to offline
- if (staff2 != null){
- Player p = (Player) sender;
- // sends a msg to the player
- p.sendMessage("Nacho_Master99 "
- + "Is on "
- + "You can /msg him for problems"
- + "He is ADMIN");
- }
- else{
- Player p = (Player) sender;
- p.sendMessage("Nacho_Master99 is offline.");
- }
- Player staff3 = getServer().getPlayerExact("Cameron_Killer");
- if (staff3 != null){
- Player p = (Player) sender;
- p.sendMessage("Cameron_killer "
- + "Is on "
- + "You can /msg him for problems"
- + "He is ADMIN");
- }
- else{
- Player p = (Player) sender;
- p.sendMessage("Cameron_Killer is offline.");
- }
- Player staff4 = getServer().getPlayerExact("NyanMoosh");
- if (staff4 != null){
- Player p = (Player) sender;
- p.sendMessage("NyanMoosh "
- + "Is on "
- + "You can /msg him for problems"
- + "He is Helper");
- }
- else{
- Player p = (Player) sender;
- p.sendMessage("NyanMoosh is offline.");
- }
- }
- return true;
- }
- //checks if the command entered was site
- if (cmd.getName().equalsIgnoreCase("site")) {
- Player man = (Player) sender;
- if (player.hasPermission(mainplayer)){
- //send a msg with some links
- man.sendMessage("KingLinux01's \n Youtube https://www.youtube.com/channel/UCju981zz0T_1wcchOO9XshA/featured \n"
- + "FedoraCraft's Youtube https://www.youtube.com/channel/UCE-IEgv831G6aniCGoFqSoA \n"
- + "FedoraCraft's Facebook Group https://www.facebook.com/groups/1020857451314392/ \n"
- + "The Website http://fedora-craft.enjin.com/");
- }
- return true;
- }
- if(cmd.getName().equalsIgnoreCase("gmc")){
- if(player.hasPermission(op)){
- player.setGameMode(GameMode.CREATIVE);
- player.sendMessage("you are in creative");
- }
- }
- if(cmd.getName().equalsIgnoreCase("sword"))
- {
- if(player.hasPermission(helper)){
- player.setItemInHand(new ItemStack(org.bukkit.Material.DIAMOND_SWORD));
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("rulebook")){
- if(player.hasPermission(mainplayer)){
- Player man = (Player) sender;
- ((Player) sender).getInventory().addItem(rulebook);
- man.setItemInHand(rulebook);
- }
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement