Building Minecraft Server Modifications
上QQ阅读APP看书,第一时间看更新

Understanding the Java documentation

In case you are new to reading API documentation, let's look at a method that is included in the World class to see what information it provides us. Click on the link to view the createExplosion(Location loc, float power, booleansetFire) method. You will be brought to the method description similar to the one shown in the following screenshot:

The screenshot explains each parameter and the return value for the method. This method requires that we pass three parameters to it, explained as follows:

  • Where the explosion should take place
  • How powerful the explosion should be
  • Whether the explosion should cause surrounding blocks to ignite in flames

If the returned value is void then the method will not send any information back to us. In this example, the method returns a boolean value. On reading the documentation we learn that the returned value is whether or not the explosion actually occurred. If another plugin prevented the explosion from happening then the createExplosion method would return false.