bukkit - Replacement for getTypeId() -
i made plugin bukkit 1.2.5 (to used on tekkit server) alerted players when (for example) tried place down tnt why using block ids.
now i'm trying use updated version of bukkit (1.7.2-r0.3 exact) seems gettypeid() method no longer working. i've googling/searching in javadoc solution can't find one.
// checks if block placed has id of 46 / tnt if (e.getblock().gettypeid() == 46) { e.setcancelled(true); server server = bukkit.getserver(); server.broadcastmessage("someone tried place tnt down"); }
how work in 1.7.2 gettypeid() deprecated
you can still use gettypeid()
method blocks or getid()
method block material
despite fact deprecated. if add @suppresswarnings("deprecation") annotation listener method ide should not complain using deprecated methods. can alternatively use non-deprecated material
enum directly event.getblock().gettype() == material.tnt
.
Comments
Post a Comment