Skip to content
Snippets Groups Projects
Commit 5ba48c08 authored by Zandor Smith's avatar Zandor Smith :computer:
Browse files

+ Main files.

parent 61dc13d8
No related branches found
No related tags found
No related merge requests found
pom.xml 0 → 100644
<?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>com.zandor300</groupId>
<artifactId>StonePotion</artifactId>
<version>1.8-1.0.0</version>
<name>StonePotion</name>
<repositories>
<repository>
<id>MavenPi</id>
<url>http://play.zsinfo.nl/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<type>jar</type>
<version>1.8-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<type>jar</type>
<version>1.8-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.zandor300</groupId>
<artifactId>ZSUtilities</artifactId>
<type>jar</type>
<version>1.8-1.0.4.3</version>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-alpha-6</version>
</extension>
</extensions>
</build>
<distributionManagement>
<repository>
<id>MavenPi-FTP</id>
<url>ftp://192.168.1.18/var/www/maven</url>
</repository>
</distributionManagement>
</project>
\ No newline at end of file
package com.zandor300.stonepotion;
import com.zandor300.stonepotion.commands.StonePotionCommand;
import com.zandor300.stonepotion.listeners.PlayerListener;
import com.zandor300.zsutilities.commandsystem.CommandManager;
import com.zandor300.zsutilities.utilities.Chat;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.mcstats.Metrics;
import java.io.IOException;
/**
* Created by Zandor on 3/23/15.
*/
public class StonePotion extends JavaPlugin {
private static Chat chat = new Chat("StonePotion", ChatColor.GREEN);
private static StonePotion plugin;
public static Chat getChat() {
return chat;
}
public static StonePotion getPlugin() {
return plugin;
}
@Override
public void onEnable() {
chat.sendConsoleMessage("Setting things up...");
plugin = this;
PluginManager pm = Bukkit.getPluginManager();
chat.sendConsoleMessage("Starting metrics...");
try {
new Metrics(this).start();
chat.sendConsoleMessage("Submitted stats to MCStats.org.");
} catch (IOException e) {
chat.sendConsoleMessage("Couldn't submit stats to MCStats.org...");
}
chat.sendConsoleMessage("Registering events...");
pm.registerEvents(new PlayerListener(this), this);
chat.sendConsoleMessage("Registered events.");
new CommandManager().registerCommand(new StonePotionCommand(), this);
chat.sendConsoleMessage("Everything is setup!");
chat.sendConsoleMessage("Enabled.");
}
}
package com.zandor300.stonepotion.commands;
import com.zandor300.stonepotion.StonePotion;
import com.zandor300.zsutilities.commandsystem.Command;
import org.bukkit.command.CommandSender;
/**
* Created by Zandor on 3/23/15.
*/
public class StonePotionCommand extends Command {
public StonePotionCommand() {
super("stonepotion", "Get info");
}
@Override
public void execute(CommandSender sender, String[] strings) {
StonePotion.getChat().sendMessage(sender, "StonePotion 1.0.0 by Zandor300");
}
}
package com.zandor300.stonepotion.listeners;
import com.zandor300.stonepotion.StonePotion;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import java.util.Random;
/**
* Created by Zandor on 3/23/15.
*/
public class PlayerListener extends StonePotionListener {
public PlayerListener(StonePotion plugin) {
super(plugin);
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if(!event.getAction().equals(Action.RIGHT_CLICK_BLOCK))
return;
if(!event.getClickedBlock().getType().equals(Material.STONE))
return;
Player player = event.getPlayer();
Random random = new Random();
int rand = random.nextInt(3);
int time = 60 + random.nextInt(60);
if(rand == 0) {
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, time * 20, 1));
StonePotion.getChat().sendMessage(player, "You have been rewarded with SPEED for " + time + " seconds.");
} else if(rand == 1) {
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, time * 20, 1));
StonePotion.getChat().sendMessage(player, "You have been rewarded with NIGHT VISION for " + time + " seconds.");
} else if(rand == 2) {
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, time * 20, 1));
StonePotion.getChat().sendMessage(player, "You have been rewarded with FIRE RESISTANCE for " + time + " seconds.");
}
}
}
package com.zandor300.stonepotion.listeners;
import com.zandor300.stonepotion.StonePotion;
import org.bukkit.event.Listener;
/**
* Created by Zandor on 3/23/15.
*/
public class StonePotionListener implements Listener {
public final StonePotion plugin;
public StonePotionListener(StonePotion plugin) {
this.plugin = plugin;
}
}
name: StonePotion
main: com.zandor300.stonepotion.StonePotion
version: 1.0.0
author: Zandor300
depend: [ZSUtilities]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment