Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean canBreak(int x, int y, int z, EntityPlayer p, World w) {
- try {
- org.bukkit.World bukkitWorld = null;
- final Class cls = World.class;
- final Method[] are = cls.getMethods();
- boolean bylo = false;
- for (int i = 0; i < are.length; ++i) {
- final Method mth = are[i];
- if (mth.getName().equals("getWorld")) {
- final Object rezultat = mth.invoke(w, new Object[0]);
- bylo = true;
- bukkitWorld = (org.bukkit.World)rezultat;
- break;
- }
- }
- if (!bylo) {
- throw new Exception("Method not found!");
- }
- final org.bukkit.entity.Player bukkitPlayer2 = Bukkit.getPlayer(p.username);
- final org.bukkit.block.Block bukkitBlock = bukkitWorld.getBlockAt(x, y, z);
- final BlockBreakEvent bukkitEvent2 = new BlockBreakEvent(bukkitBlock, bukkitPlayer2);
- Bukkit.getServer().getPluginManager().callEvent((org.bukkit.event.Event)bukkitEvent2);
- if (bukkitEvent2.isCancelled()) {
- return false;
- }
- }
- catch (Exception e2) {
- return true;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement