Remove use of deprecated API

This commit is contained in:
mathias 2019-04-13 14:34:13 +03:00
parent 8eadbd89b1
commit b291a2a652
3 changed files with 16 additions and 4 deletions

12
pom.xml
View file

@ -26,6 +26,18 @@
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerArgs>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</project>

View file

@ -77,7 +77,7 @@ class CommandDestroyEntities implements CommandExecutor {
class CommandEnchantAll implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player player = (Player) sender;
ItemStack item = player.getItemInHand();
ItemStack item = player.getInventory().getItemInMainHand();
if (item.getType() == Material.AIR) {
player.sendMessage("Please hold an item in your hand to enchant it");

View file

@ -119,7 +119,7 @@ class TickAsync extends BukkitRunnable {
world.setAutoSave(true);
}
try {
/*try {
for (final Chunk chunk : world.getLoadedChunks()) {
try {
chunk.getTileEntities();
@ -132,7 +132,7 @@ class TickAsync extends BukkitRunnable {
}
}
} catch (Exception e) {
}
}*/
try {
for (LivingEntity mob : world.getLivingEntities()) {
@ -573,7 +573,7 @@ class Events implements Listener {
@EventHandler
void onPlayerLogin(PlayerLoginEvent event) {
if (!(event.getHostname().startsWith("play.kaboom.pw") &&
event.getHostname().endsWith(":64518"))) {
event.getHostname().endsWith(":49450"))) {
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");
} else {
final Player player = event.getPlayer();