Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----------------------------------------------------------------------------------------------------------------
- Plugin.java
- ----------------------------------------------------------------------------------------------------------------
- package me.D3monicSheep.Plugin;
- import java.util.logging.Logger;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.material.Command;
- import org.bukkit.plugin.PluginManager;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- public class Plugin extends JavaPlugin {
- public static Plugin plugin;
- public final Logger logger = Logger.getLogger("Minecraft");
- public final PluginListener pl = new PluginListener(this);
- public final PluginLogger plo = new PluginLogger(this);
- public void onEnable() {
- plo.enabled(true);
- PluginManager pm = this.getServer().getPluginManager();
- pm.registerEvents(pl, this);
- }
- public void onDisable() {
- plo.enabled(false);
- }
- public boolean onCommand1(CommandSender sender, Command cmd,
- String commandLabel, String[] args) {
- if (commandLabel.equalsIgnoreCase("potion speed")) {
- Player player = (Player) sender;
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,
- -1, 3));
- }
- return false;
- }
- public boolean onCommand(CommandSender sender, Command cmd,
- String commandLabel, String[] args) {
- if (commandLabel.equalsIgnoreCase("potion blindness")) {
- Player player = (Player) sender;
- player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,
- -1, 3));
- }
- return false;
- }
- }
- ----------------------------------------------------------------------------------------------------------------------
- PluginListeners.java
- ----------------------------------------------------------------------------------------------------------------------
- package me.D3monicSheep.Plugin;
- import org.bukkit.entity.Player;
- import org.bukkit.event.Listener;
- import org.bukkit.event.player.PlayerChatEvent;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- @SuppressWarnings("deprecation")
- public class PluginListener implements Listener{
- public PluginListener(Plugin plugin) {
- // TODO Auto-generated constructor stub
- }
- public void onPlayerCommand(PlayerChatEvent event) {
- String[] split = event.getMessage().split(" ");
- //Get Player that talked
- Player player = event.getPlayer();
- if ((split[0].equalsIgnoreCase("potion speed"))
- || (split[0].equalsIgnoreCase("p speed")))
- player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED,
- -1, 3));
- }
- public void onPlayerCommand1(PlayerChatEvent event) {
- String[] split = event.getMessage().split(" ");
- //Get Player that talked
- Player player = event.getPlayer();
- if ((split[0].equalsIgnoreCase("potion blind"))
- || (split[0].equalsIgnoreCase("p blind")))
- player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS,
- -1, 3));
- }
- }
- -------------------------------------------------------------------------------------------------------------------
- PluginLoggers.java
- -------------------------------------------------------------------------------------------------------------------
- package me.D3monicSheep.Plugin;
- import java.util.logging.Logger;
- import org.bukkit.plugin.PluginDescriptionFile;
- public class PluginLogger {
- public static Plugin plugin;
- public PluginLogger(Plugin instance){
- plugin = instance;
- }
- public final Logger logger = Logger.getLogger("Minecraft");
- public void enabled(boolean enabled){
- if(enabled){
- PluginDescriptionFile pdfFile = plugin.getDescription();
- this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has Been Enabled");
- } else {
- PluginDescriptionFile pdfFile = plugin.getDescription();
- this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has Been Disabled");
- }
- }
- }
- -------------------------------------------------------------------------------------------------------------------
- Plugin.yml
- -------------------------------------------------------------------------------------------------------------------
- name: SCTest
- main: me.D3monicSheep.Plugin.Plugin
- version: 0.1
- author: D3monicSheep
- description: A squad craft test plug-in that gives players swiftness 3.
- commands:
- potion speed:
- description: Gives players swiftness 3
- usage: /<command>
- aliases: [p speed]
- potion blind:
- description: Gives player blindness 3
- usage: /<command>
- aliases: [p blind]
Advertisement
Add Comment
Please, Sign In to add comment