Skip to content

Instantly share code, notes, and snippets.

@PenguinsOfm
Created July 26, 2019 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PenguinsOfm/1c317a7bc30c1af0e89bbd6cf4b705c5 to your computer and use it in GitHub Desktop.
Save PenguinsOfm/1c317a7bc30c1af0e89bbd6cf4b705c5 to your computer and use it in GitHub Desktop.
owo big weed class file uwu
package me.SnowySean;
import org.bukkit.plugin.java.JavaPlugin;
public class EventHandle extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("Drugs is Running");
new PlayerListener(this);
}
@Override
public void onDisable()
{
}
}
package me.SnowySean;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.player.PlayerEggThrowEvent;
import org.bukkit.event.player.PlayerItemBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class PlayerListener implements Listener{
public PlayerListener(EventHandle plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler
private void onBlockBreak(BlockBreakEvent e){
Block b = e.getBlock();
Block block = e.getBlock();
Player p = e.getPlayer();
Random rand = new Random();
Random randSativa = new Random();
Random randHybrid = new Random();
int number = rand.nextInt(100) + 1;
int number1 = randSativa.nextInt(100) + 1;
int number2 = randHybrid.nextInt(100) + 1;
if(number <= 10)
{
if(p.getGameMode() == GameMode.SURVIVAL)
{
if(b.getType() == Material.LONG_GRASS)
{
e.setCancelled(true);
b.setType(Material.AIR);
ItemStack item = new ItemStack(Material.SEEDS, 1);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.GREEN +"Indica Seeds");
item.setItemMeta(itemMeta);
b.getWorld().dropItem(b.getLocation(), new ItemStack(item));
}
}
}
if(number1 <= 10)
{
if(p.getGameMode() == GameMode.SURVIVAL)
{
if(b.getType() == Material.LONG_GRASS)
{
e.setCancelled(true);
b.setType(Material.AIR);
ItemStack item = new ItemStack(Material.SEEDS, 1);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.RED +"Sativa Seeds");
item.setItemMeta(itemMeta);
b.getWorld().dropItem(b.getLocation(), new ItemStack(item));
}
}
}
if(number2 <= 10)
{
if(p.getGameMode() == GameMode.SURVIVAL)
{
if(b.getType() == Material.LONG_GRASS)
{
e.setCancelled(true);
b.setType(Material.AIR);
ItemStack item = new ItemStack(Material.SEEDS, 1);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.BLUE +"Hybrid Seeds");
item.setItemMeta(itemMeta);
b.getWorld().dropItem(b.getLocation(), new ItemStack(item));
}
}
}
if(p.getGameMode() == GameMode.SURVIVAL)
{
if(block.getType() == Material.CROPS)
{
if(block.getData() == 7)
{
e.setCancelled(true);
b.setType(Material.AIR);
ItemStack weed = new ItemStack(Material.WHEAT, 1);
ItemMeta im = weed.getItemMeta();
im.setDisplayName(ChatColor.RED +"Sativa Weed");
weed.setItemMeta(im);
block.getWorld().dropItem(block.getLocation(), new ItemStack(weed));
List<String> loreList = new ArrayList<String>();
loreList.add(ChatColor.GREEN + "Right click to smoke!");//This is the first line of lore
im.setLore(loreList);
block.getDrops().clear();
block.getDrops().add(weed);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment