A feature-rich Minecraft plugin which enhances gaming experience
git clone git://soophie.de/poppy
12
usage: /standby <true, false>13
kit:14
world:15
usage: /world <name>15
\ No newline at end of file15
usage: /world <name>16
spawn:17
usage: /spawn18
invsee:19
usage: /invsee <name> <enderchest>19
\ No newline at end of file
9
import org.bukkit.Bukkit;10
import org.bukkit.ChatColor;11
import org.bukkit.GameMode;12
import org.bukkit.Location;13
import org.bukkit.Material;14
import org.bukkit.World;15
import org.bukkit.WorldCreator;
19
import org.bukkit.entity.Player;20
import org.bukkit.inventory.ItemStack;21
import org.bukkit.inventory.meta.SkullMeta;22
import org.bukkit.material.Tree;23
import org.bukkit.plugin.Plugin;24
import org.bukkit.plugin.PluginManager;25
import org.bukkit.plugin.java.JavaPlugin;
48
private Plugin plugin;49
private BukkitTask task;51
private static final int BLOCKS_PER_CHUNK = 16;52
private static final int CHUNKS_PER_EMERALD = 25;53
private static final int MIN_FEE = 1;54
private static final int MAX_FEE = 64;56
@Override57
public void onEnable()
266
player.teleport(world.getSpawnLocation());267
}269
if(label.equals("spawn"))270
{271
ItemStack item = player.getInventory().getItemInMainHand();273
Location locationSpawn = Bukkit.getWorld("world").getSpawnLocation();274
Location locationPlayer = player.getLocation();276
Double distance = locationPlayer.distance(locationSpawn);278
int fee = (int) Math.floor(distance / (BLOCKS_PER_CHUNK * CHUNKS_PER_EMERALD));280
if(fee < MIN_FEE)281
{282
fee = MIN_FEE;283
}285
if(fee > MAX_FEE)286
{287
fee = MAX_FEE;288
}290
if(item.getType() == Material.EMERALD && item.getAmount() >= fee)291
{293
item.setAmount(item.getAmount() - fee);294
player.teleport(locationSpawn);295
}296
else297
{298
player.sendMessage(ChatColor.RED + "Not enough emeralds to teleport! You need " + fee + " emerald(s) in your main hand.");299
}300
}302
if(label.equals("invsee"))303
{304
if(args.length == 0) {305
return false;306
}308
if(Bukkit.getPlayer(args[0]) == null)309
{310
player.sendMessage(ChatColor.RED + "Player not found!");311
return true;312
}314
if(!player.isOp())315
{316
player.sendMessage(DefaultConstants.Messages.NOT_ENOUGH_PERMISSION);317
return true;318
}320
Player target = Bukkit.getPlayer(args[0]);322
player.openInventory(target.getInventory());324
if(args.length == 1 && args[1].toLowerCase() == "enderchest")325
{326
player.openInventory(target.getEnderChest());327
}328
}329
}331
return true;
50
// farming with right click52
EquipmentSlot equip = event.getHand();53
if(equip.equals(EquipmentSlot.HAND)) {53
if(equip.equals(EquipmentSlot.HAND))54
{56
if(event.getAction() == Action.RIGHT_CLICK_BLOCK)57
{
79
if(Util.isFarmable(material) && ageable.getAge() == ageable.getMaximumAge())80
{82
event.setCancelled(true);84
if(blockdata instanceof Directional)85
{86
Directional directional = (Directional) blockdata;
95
}96
else97
{99
block.breakNaturally(player.getItemInUse());100
block.setType(material);101
}102
}103
}105
if(material == Material.MELON && Util.hasStem(block) || material == Material.PUMPKIN && Util.hasStem(block))106
{107
block.breakNaturally(player.getInventory().getItemInMainHand());108
}109
}110
}111
}
18
public class LeavesDecayListener implements Listener19
{20
private static final int DELAY = 50;20
private static final int DELAY = 25;21
private static final List<BlockFace> NEIGHBORS = Arrays.asList(22
BlockFace.UP,23
BlockFace.NORTH,
1
package de.typable.minecrafthub.util;3
import javax.swing.text.Position;5
import org.bukkit.Bukkit;6
import org.bukkit.Location;7
import org.bukkit.Material;8
import org.bukkit.block.Block;9
import org.bukkit.block.BlockFace;10
import org.bukkit.entity.Player;11
import org.bukkit.inventory.Inventory;
141
{142
return material == Material.WHEAT || material == Material.CARROTS || material == Material.POTATOES || material == Material.BEETROOTS || material == Material.NETHER_WART || material == Material.COCOA;143
}145
public static boolean isStem(Material material)146
{147
return material == Material.ATTACHED_PUMPKIN_STEM || material == Material.ATTACHED_MELON_STEM;148
}150
public static boolean hasStem(Block block)151
{152
Location blockLocation = block.getLocation();153
Material blockNorth = blockLocation.clone().add(0, 0, -1).getBlock().getType();154
Material blockEast = blockLocation.clone().add(1, 0, 0).getBlock().getType();155
Material blockSouth = blockLocation.clone().add(0, 0, 1).getBlock().getType();156
Material blockWest = blockLocation.clone().add(-1, 0, 0).getBlock().getType();158
return isStem(blockNorth) || isStem(blockEast) || isStem(blockSouth) || isStem(blockWest);159
}160
}