Remove usage of deprecated methods

This commit is contained in:
selfslaughter 2020-04-12 23:44:21 +10:00
parent c28ccaac25
commit 1f90bb83ff
6 changed files with 20 additions and 22 deletions

View File

@ -130,14 +130,14 @@ public class ArenaHandler {
// they join
for (Player otherplayer : arena.playersInArena) {
if (otherplayer.canSee(player))
otherplayer.showPlayer(player); // Make
otherplayer.showPlayer(BlockHunt.plugin, player); // Make
// new
// player
// visible
// to
// others
if (player.canSee(otherplayer))
player.showPlayer(otherplayer); // Make
player.showPlayer(BlockHunt.plugin, otherplayer); // Make
// other
// players
// visible
@ -263,7 +263,7 @@ public class ArenaHandler {
ArenaHandler.sendFMessage(arena, ConfigC.normal_ingameSeekerChoosen, "seeker-" + seeker.getName());
DisguiseAPI.undisguiseToAll(seeker);
for (Player pl : Bukkit.getOnlinePlayers()) {
pl.showPlayer(seeker);
pl.showPlayer(BlockHunt.plugin, seeker);
}
seeker.getInventory().clear();
arena.seekers.add(seeker);
@ -274,10 +274,10 @@ public class ArenaHandler {
// Fix for client not showing players after they join
for (Player otherplayer : arena.playersInArena) {
if (otherplayer.canSee(player))
otherplayer.showPlayer(player); // Make new player
otherplayer.showPlayer(BlockHunt.plugin, player); // Make new player
// visible to others
if (player.canSee(otherplayer))
player.showPlayer(otherplayer); // Make other
player.showPlayer(BlockHunt.plugin, otherplayer); // Make other
// players visible
// to new player
}
@ -311,7 +311,7 @@ public class ArenaHandler {
MemoryStorage.pData.remove(player);
for (Player pl : Bukkit.getOnlinePlayers()) {
pl.showPlayer(player);
pl.showPlayer(BlockHunt.plugin, player);
if (MemoryStorage.hiddenLoc.get(player) != null) {
if (MemoryStorage.hiddenLocWater.get(player) != null) {
Block pBlock = MemoryStorage.hiddenLoc.get(player).getBlock();

View File

@ -271,13 +271,10 @@ public class BlockHunt extends JavaPlugin implements Listener {
MemoryStorage.choosenBlock.remove(arenaPlayer);
}
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getType(),0);
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getType());
DisguiseAPI.disguiseToAll(arenaPlayer, disguise);
arenaPlayer.teleport(arena.hidersWarp);
ItemStack blockCount = new ItemStack(block.getType(), 5);
blockCount.setDurability(block.getDurability());
arenaPlayer.getInventory().setItem(8, blockCount);
arenaPlayer.getInventory().setHelmet(new ItemStack(block));
MemoryStorage.pBlock.put(arenaPlayer, block);
@ -408,7 +405,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
DisguiseAPI.undisguiseToAll(player);
for (Player pl : Bukkit.getOnlinePlayers()) {
if (!pl.equals(player)) {
pl.hidePlayer(player);
pl.hidePlayer(this, player);
pl.sendBlockChange(pBlock.getLocation(), block.getType().createBlockData());
}
}
@ -423,7 +420,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
}
for (Player pl : Bukkit.getOnlinePlayers()) {
if (!pl.equals(player)) {
pl.hidePlayer(player);
pl.hidePlayer(this, player);
pl.sendBlockChange(pBlock.getLocation(), block.getType().createBlockData());
}
}
@ -530,7 +527,7 @@ public class BlockHunt extends JavaPlugin implements Listener {
}
}
}
new CMDnotfound().execute(player,cmd,label, args);;
new CMDnotfound().execute(player,cmd,label, args);
return true;
}

View File

@ -8,6 +8,7 @@ import me.libraryaddict.disguise.DisguiseAPI;
import nl.Steffion.BlockHunt.Arena;
import nl.Steffion.BlockHunt.Arena.ArenaState;
import nl.Steffion.BlockHunt.ArenaHandler;
import nl.Steffion.BlockHunt.BlockHunt;
import nl.Steffion.BlockHunt.ConfigC;
import nl.Steffion.BlockHunt.MemoryStorage;
import nl.Steffion.BlockHunt.Managers.MessageManager;
@ -154,9 +155,9 @@ public class OnEntityDamageByEntityEvent implements Listener {
// Fix for client not showing players after they join
for (Player otherplayer : arena.playersInArena) {
if (otherplayer.canSee(player))
otherplayer.showPlayer(player); // Make new player visible to others
otherplayer.showPlayer(BlockHunt.plugin, player); // Make new player visible to others
if (player.canSee(otherplayer))
player.showPlayer(otherplayer); // Make other players visible to new player
player.showPlayer(BlockHunt.plugin, otherplayer); // Make other players visible to new player
}
}
}

View File

@ -126,7 +126,7 @@ public class OnInventoryClickEvent implements Listener {
MessageManager.sendFMessage(player, ConfigC.error_shopMaxSeekersReached);
} else {
MemoryStorage.choosenSeeker.put(player, true);
player.getInventory().setItemInHand(new ItemStack(Material.AIR));
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
player.updateInventory();
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenSeeker);
inv.clear();
@ -157,7 +157,7 @@ public class OnInventoryClickEvent implements Listener {
MessageManager.sendFMessage(player, ConfigC.error_shopMaxHidersReached);
} else {
MemoryStorage.choosenSeeker.put(player, false);
player.getInventory().setItemInHand(new ItemStack(Material.AIR));
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
player.updateInventory();
MessageManager.sendFMessage(player, ConfigC.normal_shopChoosenHiders);
inv.clear();

View File

@ -19,11 +19,11 @@ public class ScoreboardHandler {
return;
}
Objective object = board.registerNewObjective(BlockHunt.cutString(arena.arenaName, 32), "dummy");
String displayName = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_title)), 32);
Objective object = board.registerNewObjective(BlockHunt.cutString(arena.arenaName, 32), "dummy", displayName);
object.setDisplaySlot(DisplaySlot.SIDEBAR);
object.setDisplayName(BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_title)), 32));
String temp = BlockHunt.cutString(MessageManager.replaceAll((String) MemoryStorage.config.get(ConfigC.scoreboard_timeleft)), 32);
Score timeleft = object.getScore(temp);
timeleft.setScore(arena.timer);

View File

@ -51,10 +51,10 @@ public class SolidBlockHandler {
block.removeEnchantment(Enchantment.DURABILITY);
for (Player playerShow : Bukkit.getOnlinePlayers()) {
playerShow.showPlayer(player);
playerShow.showPlayer(BlockHunt.plugin, player);
}
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getType(), 0);
MiscDisguise disguise = new MiscDisguise(DisguiseType.FALLING_BLOCK, block.getType());
DisguiseAPI.disguiseToAll(player, disguise);
MessageManager.sendFMessage(player, ConfigC.normal_ingameNoMoreSolid);