Advertisement
4epB9Ik

PrivateCheckBukkitOnForge_1.5.2

Apr 10th, 2021
1,183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1.     public boolean canBreak(int x, int y, int z, EntityPlayer p, World w) {
  2.          try {
  3.              org.bukkit.World bukkitWorld = null;
  4.              final Class cls = World.class;
  5.              final Method[] are = cls.getMethods();
  6.              boolean bylo = false;
  7.              for (int i = 0; i < are.length; ++i) {
  8.                  final Method mth = are[i];
  9.                  if (mth.getName().equals("getWorld")) {
  10.                      final Object rezultat = mth.invoke(w, new Object[0]);
  11.                      bylo = true;
  12.                      bukkitWorld = (org.bukkit.World)rezultat;
  13.                      break;
  14.                  }
  15.              }
  16.              if (!bylo) {
  17.                  throw new Exception("Method not found!");
  18.              }
  19.              final org.bukkit.entity.Player bukkitPlayer2 = Bukkit.getPlayer(p.username);
  20.              final org.bukkit.block.Block bukkitBlock = bukkitWorld.getBlockAt(x, y, z);
  21.              final BlockBreakEvent bukkitEvent2 = new BlockBreakEvent(bukkitBlock, bukkitPlayer2);
  22.              Bukkit.getServer().getPluginManager().callEvent((org.bukkit.event.Event)bukkitEvent2);
  23.              if (bukkitEvent2.isCancelled()) {
  24.                  return false;
  25.              }
  26.          }
  27.          catch (Exception e2) {
  28.              return true;
  29.          }
  30.          return true;
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement