Replace use of the deprecated getDisplayName() with displayName().

This commit is contained in:
David Berdik 2022-02-13 19:57:38 -05:00
parent e5140a794e
commit a54b145596
13 changed files with 29 additions and 29 deletions

View File

@ -259,7 +259,7 @@ public class AICore {
int chance = Utils.getRandomGen().nextInt(100);
if (chance <= 10) {
if (Herobrine.getPluginCore().getConfigDB().UseGraveyardWorld == true) {
log.info("[Herobrine] Teleporting " + PlayerTarget.getDisplayName() + " to Herobrine's Graveyard.");
log.info("[Herobrine] Teleporting " + PlayerTarget.displayName() + " to Herobrine's Graveyard.");
getCore(CoreType.GRAVEYARD).RunCore(data);

View File

@ -35,7 +35,7 @@ public class Attack extends Core {
if (!PluginCore.getAICore().checkAncientSword(player.getInventory())) {
if (PluginCore.getSupport().checkAttack(player.getLocation())) {
if (!PluginCore.canAttackPlayerNoMSG(player)) {
return new CoreResult(false, player.getDisplayName() + " cannot be attacked because they are protected.");
return new CoreResult(false, player.displayName() + " cannot be attacked because they are protected.");
}
Herobrine.HerobrineHP = Herobrine.HerobrineMaxHP;
@ -61,10 +61,10 @@ public class Attack extends Core {
return new CoreResult(true, "Herobrine is currently attacking " + player.getName() + ".");
} else {
return new CoreResult(false, AICore.PlayerTarget.getDisplayName() + " cannot be attacked because they are in a protected area.");
return new CoreResult(false, AICore.PlayerTarget.displayName() + " cannot be attacked because they are in a protected area.");
}
} else {
return new CoreResult(false, player.getDisplayName() + " cannot be attacked because they have an Ancient Sword.");
return new CoreResult(false, player.displayName() + " cannot be attacked because they have an Ancient Sword.");
}
}

View File

@ -42,7 +42,7 @@ public class Book extends Core {
return new CoreResult(false, "Herobrine's books are prohibited.");
}
} else {
return new CoreResult(false, player.getDisplayName() + " is in a world that Herobrine is not allowed in.");
return new CoreResult(false, player.displayName() + " is in a world that Herobrine is not allowed in.");
}
}
return new CoreResult(false, "Herobrine's book creation failed.");

View File

@ -16,7 +16,7 @@ public class Burn extends Core {
public CoreResult CallCore(Object[] data) {
Player player = (Player) data[0];
player.setFireTicks(800);
return new CoreResult(true, player.getDisplayName() + " was burned by Herobrine.");
return new CoreResult(true, player.displayName() + " was burned by Herobrine.");
}
}

View File

@ -64,17 +64,17 @@ public class BuryPlayer extends Core {
&& Herobrine.getPluginCore().getSupport().checkBuild(loc.getWorld()
.getBlockAt(loc.getBlockX(), loc.getBlockY() - 1, loc.getBlockZ() - 2).getLocation())) {
Bury(loc.getWorld(), loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), player);
return new CoreResult(true, player.getDisplayName() + " was buried by Herobrine.");
return new CoreResult(true, player.displayName() + " was buried by Herobrine.");
} else {
return new CoreResult(false, player.getDisplayName() + " is in a protected area and cannot be buried.");
return new CoreResult(false, player.displayName() + " is in a protected area and cannot be buried.");
}
}
} else {
return new CoreResult(false, player.getDisplayName()
return new CoreResult(false, player.displayName()
+ " could not be buried because a good burial location could not be found.");
}
return new CoreResult(false,
player.getDisplayName() + " could not be buried because a good burial location could not be found.");
player.displayName() + " could not be buried because a good burial location could not be found.");
}
public void Bury(World world, int X, int Y, int Z, Player player) {

View File

@ -40,7 +40,7 @@ public class Curse extends Core {
}, i * 150L);
}
return new CoreResult(true, player.getDisplayName() + " has been cursed by Herobrine.");
return new CoreResult(true, player.displayName() + " has been cursed by Herobrine.");
}
}

View File

@ -77,9 +77,9 @@ public class Graveyard extends Core {
AICore.isTarget = true;
Bukkit.getServer().getWorld(Herobrine.getPluginCore().getConfigDB().HerobrineWorldName).setStorm(false);
return new CoreResult(true, player.getDisplayName() + " was successfully teleported to Herobrine's Graveyard.");
return new CoreResult(true, player.displayName() + " was successfully teleported to Herobrine's Graveyard.");
} else {
return new CoreResult(false, player.getDisplayName() + " cannot be attacked because they have an Ancient Sword.");
return new CoreResult(false, player.displayName() + " cannot be attacked because they have an Ancient Sword.");
}
}
return new CoreResult(false, "Herobrine's Graveyard is disabled.");

View File

@ -36,7 +36,7 @@ public class Haunt extends Core {
public CoreResult setHauntTarget(Player player) {
if (PluginCore.getSupport().checkHaunt(player.getLocation())) {
if (!PluginCore.canAttackPlayerNoMSG(player)) {
return new CoreResult(false, player.getDisplayName() + " cannot be attacked because they are protected.");
return new CoreResult(false, player.displayName() + " cannot be attacked because they are protected.");
}
spawnedWolves = 0;
spawnedBats = 0;
@ -44,15 +44,15 @@ public class Haunt extends Core {
isFirst = true;
AICore.isTarget = true;
AICore.PlayerTarget = player;
AICore.log.info("[Herobrine] " + player.getDisplayName() + " is now being haunted by Herobrine.");
AICore.log.info("[Herobrine] " + player.displayName() + " is now being haunted by Herobrine.");
Location loc = (Location) PluginCore.HerobrineNPC.getBukkitEntity().getLocation();
loc.setY(-20);
PluginCore.HerobrineNPC.moveTo(loc);
StartHandler();
return new CoreResult(true, player.getDisplayName() + " is now being haunted by Herobrine.");
return new CoreResult(true, player.displayName() + " is now being haunted by Herobrine.");
}
return new CoreResult(false, player.getDisplayName() + " cannot be haunted because they are in a secure area.");
return new CoreResult(false, player.displayName() + " cannot be haunted because they are in a secure area.");
}
public void StartHandler() {

View File

@ -68,13 +68,13 @@ public class Heads extends Core {
}
}, 1 * 100L);
return new CoreResult(true, "Herobrine spawned heads near " + player.getDisplayName() + ".");
return new CoreResult(true, "Herobrine spawned heads near " + player.displayName() + ".");
} else {
return new CoreResult(false, "Herobrine head-spawning is disabled.");
}
} else {
return new CoreResult(false, player.getDisplayName() + " cannot be haunted with heads because they are in a secure area.");
return new CoreResult(false, player.displayName() + " cannot be haunted with heads because they are in a secure area.");
}
} else {
return new CoreResult(false, "Player cannot be haunted with heads because they are offline.");

View File

@ -28,13 +28,13 @@ public class RandomExplosion extends Core {
loc.getWorld().createExplosion(new Location(loc.getWorld(), x, y, z), 1.0f);
} else {
return new CoreResult(true, "Herobrine cannot produce an explosion near " + player.getDisplayName() +
return new CoreResult(true, "Herobrine cannot produce an explosion near " + player.displayName() +
" because they are in a secure area.");
}
} else {
return new CoreResult(true, "Herobrine explosions are not allowed.");
}
return new CoreResult(true, "Herobrine produced an explosion near " + player.getDisplayName() + ".");
return new CoreResult(true, "Herobrine produced an explosion near " + player.displayName() + ".");
}
}

View File

@ -86,7 +86,7 @@ public class Temple extends Core {
}
if (canBuild == true) {
Create(loc.getWorld(), i2 + loc.getBlockX(), i1 + loc.getBlockY(), i3 + loc.getBlockZ());
return new CoreResult(true, "Creating a temple near " + player.getDisplayName() + ".");
return new CoreResult(true, "Creating a temple near " + player.displayName() + ".");
}
}

View File

@ -297,18 +297,18 @@ public class Herobrine extends JavaPlugin implements Listener {
if(sender == null){
if (!opCheck)
log.info("[Herobrine] " + player.getDisplayName() + " is an OP.");
log.info("[Herobrine] " + player.displayName() + " is an OP.");
else if (!creativeCheck)
log.info("[Herobrine] " + player.getDisplayName() + " is in creative mode.");
log.info("[Herobrine] " + player.displayName() + " is in creative mode.");
else if (!ignoreCheck)
log.info("[Herobrine] " + player.getDisplayName() + " has ignore permission.");
log.info("[Herobrine] " + player.displayName() + " has ignore permission.");
}else{
if (!opCheck)
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " is an OP.");
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.displayName() + " is an OP.");
else if (!creativeCheck)
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " is in creative mode.");
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.displayName() + " is in creative mode.");
else if (!ignoreCheck)
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.getDisplayName() + " has ignore permission.");
sender.sendMessage(ChatColor.RED + "[Herobrine] " + player.displayName() + " has ignore permission.");
}
return false;

View File

@ -53,7 +53,7 @@ public class ItemName {
}
public static String getName(ItemStack item) {
return item.getItemMeta().getDisplayName();
return item.getItemMeta().displayName().toString();
}
public static ItemStack CreateSkull(final UUID uuid, final String data) {