Home›Java›Mods›ItsPueh's Test Plugin
ItsPueh's Test Plugin
ModsJava

ItsPueh's Test Plugin

Java mod listed for Minecraft 1.8. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
Intro
Hello everyone,

my name is ItsPueh (haven't changed my name here yet.
This plugin has been made using a tutorial video from TheBCBroz. Go check him out on YouTube.
I've made this plugin to learn Java, and I've posted it here for everyone who wants to overlook this code. I've added comments in the code itself which you can use to learn it.

This plugin was made in Spigot 1.8.x.

Description

This plugin was made purely for myself to learn Java.
I've added notes in the code itself for people who want to learn it by reading the code itself. Or just want to get more info about which thing what does.

Code

Plugin.yml​
Code (Text):
main: com.itspueh.plugin.Main

version: 1.1
name: PuehPlugin

commands:
  otter:
    description: Adele - Hello
    usage: /otter
  cya:
    description: Teleports you to the spawn
    usage: /cya
 
Main.java
Code (Text):
package com.itspueh.plugin;

//Imports. Here are all the imported things from Main.java.

import java.util.logging.Logger;

import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.java.JavaPlugin;

import com.itspueh.plugin.commands.Cya;
import com.itspueh.plugin.commands.Otter;

//Class Main. Here begins the plugin.

public class Main extends JavaPlugin {

    //This enables the plugin.
   
    public void onEnable() {
        PluginDescriptionFile pdfFile = getDescription();
        Logger logger = getLogger();

        getCommand("otter").setExecutor(new Otter());
        getCommand("cya").setExecutor(new Cya());
       
        logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " has been enabled");
    }

    // This disables the plugin.

    public void onDisable() {
        PluginDescriptionFile pdfFile = getDescription();
        Logger logger = Logger.getLogger("Minecraft");

        logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " has been disabled");
    }

}
 
Otter.java
Code (Text):
package com.itspueh.plugin.commands;

//Imports. Here are all the imported things from Otter.java.

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

//Class Hello. This is where the command "Otter" is coded.

public class Otter implements CommandExecutor {

    // This is the "Otter" command.

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

        // If the executor of the command is NOT a player, this will be run.

        if (!(sender instanceof Player)) {
            sender.sendMessage("You must be a player to use this command!");
            return false;
        }

        // If the executor IS a player, this will be run.

        Player player = (Player) sender;
        player.sendMessage(ChatColor.BLUE + "From the 'otter side', " + player.getName() + "!");
        return true;
    }
}
 
Cya.java
Code (Text):
package com.itspueh.plugin.commands;

import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class Cya implements CommandExecutor {

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("You must be a player to use this command!");
            return false;
        }

        Player player = (Player) sender;

        Location l = new Location(player.getWorld(), -2, 14, 19);
        player.sendMessage(ChatColor.RED + "Cya!");
        player.teleport(l);
        return true;
    }

}
 

Commands​


There are two (2) commands which you can use.
- Hello
Says something in the chat to you.

- Goodbye
Teleports you to x:-2, y:14, z:19.

Permissions

There are no permissions at all for my plugin.
Not even for the teleportation.


Credits

TheBCBroz - For the tutorial.

​

Misc

I will be updating this plugin for as long as I'm following the tutorial.
Once the tutorial ends, this plugin ends as well.
After this plugin, I will make some other plugins at your request. So, tell me what kind of plugin you want, and keep it simple. No big stuff right now.​

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

ItsPueh's Test Plugin is a free Minecraft Java mod. Compatible with Minecraft 1.8. Downloaded 143 times (via Spigot). Download it and open it directly in the game.

Explore more