PhrogiWasHere

Public Snippets 7

God Command

public class GodCommand implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player) {

            Player p = (Player) sender;
            if (p.isInvulnerable()) {
                if (p.hasPermission("pUtilities.god")) {
                    p.setInvulnerable(false);
                    p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "You are no longer in godmode");
     

Heal

public class Heal implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if(sender instanceof Player){
            Player player = (Player) sender;
            if(player.hasPermission("pUtilities.heal")) {
                player.setFoodLevel(20);
                player.setHealth(20);
                player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "You Healed yourself");
                playe

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>me.taylor</groupId>
    <artifactId>pUtilities</artifactId>
    <version>1.2-BETA</version>
    <packaging>jar</packaging>

    <name>Commands2</name>

    <description>Coded by PhrogiW

plugin.yml

name: pUtilities
version: '${project.version}'
main: me.taylor.commands2.Commands2
api-version: 1.18
authors: [ PhrogiWasHere ]
description: Coded by PhrogiWasHere
website: https://youtube.com/c/phrogi
commands:
  god:
    aliases:
      - godmode
      - g
    description: Become invincible. Re-enter the command to toggle godmode.
    usage: /<command>
    permission: pUtilities.god
  feed:
    aliases:
      - food
      - f
      - hunger
    description: Fills up hungerbar.
    usage: /<comm

Feed

public class Feed implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if(sender instanceof Player){
            Player player = (Player) sender;
            if(player.hasPermission("pUtilities.feed")) {
            player.setFoodLevel(20);
            player.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "You fed yourself");
            player.playSound(player.getLocation(), Sound.ENTITY_ARROW_

Vanish command

public class Vanish implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player) {

            Player p = (Player) sender;
            if (p.isInvisible()) {
                if (p.hasPermission("pUtilities.vanish")) {
                    p.setInvisible(false);
                    p.sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "You are no longer in Vanish");
             

pUtilities MAIN

public final class Commands2 extends JavaPlugin {

    @Override
    public void onEnable() {
        System.out.println("[pUtilities] Coded by PhrogiWasHere");

        getCommand("god").setExecutor(new GodCommand());
        getCommand("feed").setExecutor(new Feed());
        getCommand("vanish").setExecutor(new Vanish());
        getCommand("heal").setExecutor(new Heal());


    }
}