Implements some Java 14 code migrations
This commit is contained in:
parent
3a8943baef
commit
7a9dbb8046
@ -26,8 +26,7 @@ public class CommandReload implements CommandExecutor {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s,
|
||||||
@NotNull String[] args) {
|
@NotNull String[] args) {
|
||||||
if (commandSender instanceof Player) {
|
if (commandSender instanceof Player player) {
|
||||||
Player player = (Player) commandSender;
|
|
||||||
if (!player.hasPermission("stargate.reload")) {
|
if (!player.hasPermission("stargate.reload")) {
|
||||||
Stargate.sendErrorMessage(commandSender, "Permission Denied");
|
Stargate.sendErrorMessage(commandSender, "Permission Denied");
|
||||||
return true;
|
return true;
|
||||||
|
@ -112,8 +112,7 @@ public class PlayerEventListener implements Listener {
|
|||||||
if (playerVehicle != null && !(playerVehicle instanceof Boat) && !(playerVehicle instanceof RideableMinecart)) {
|
if (playerVehicle != null && !(playerVehicle instanceof Boat) && !(playerVehicle instanceof RideableMinecart)) {
|
||||||
|
|
||||||
//Make sure the horse can be sat on
|
//Make sure the horse can be sat on
|
||||||
if (playerVehicle instanceof AbstractHorse) {
|
if (playerVehicle instanceof AbstractHorse horse) {
|
||||||
AbstractHorse horse = ((AbstractHorse) playerVehicle);
|
|
||||||
//Make sure the horse is properly tamed
|
//Make sure the horse is properly tamed
|
||||||
if (!horse.isTamed()) {
|
if (!horse.isTamed()) {
|
||||||
horse.setTamed(true);
|
horse.setTamed(true);
|
||||||
|
@ -980,14 +980,13 @@ public class Portal {
|
|||||||
*/
|
*/
|
||||||
public final void drawSign() {
|
public final void drawSign() {
|
||||||
BlockState state = getSignLocation().getBlock().getState();
|
BlockState state = getSignLocation().getBlock().getState();
|
||||||
if (!(state instanceof Sign)) {
|
if (!(state instanceof Sign sign)) {
|
||||||
Stargate.logger.warning(Stargate.getString("prefix") + "Sign block is not a Sign object");
|
Stargate.logger.warning(Stargate.getString("prefix") + "Sign block is not a Sign object");
|
||||||
Stargate.debug("Portal::drawSign", "Block: " + getSignLocation().getBlock().getType() + " @ "
|
Stargate.debug("Portal::drawSign", "Block: " + getSignLocation().getBlock().getType() + " @ "
|
||||||
+ getSignLocation().getBlock().getLocation());
|
+ getSignLocation().getBlock().getLocation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sign sign = (Sign) state;
|
|
||||||
SignHelper.drawSign(sign, this);
|
SignHelper.drawSign(sign, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user