Code style, remove deprecated ChatMode

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2021-09-10 05:50:08 +02:00
parent e6db47ec6e
commit 3ddf729a46

View File

@ -1279,8 +1279,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
*
* @return the player settings
*/
@NotNull
public PlayerSettings getSettings() {
public @NotNull PlayerSettings getSettings() {
return settings;
}
@ -1293,8 +1292,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
return dimensionType;
}
@NotNull
public PlayerInventory getInventory() {
public @NotNull PlayerInventory getInventory() {
return inventory;
}
@ -1441,8 +1439,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
*
* @return the currently open inventory, null if there is not (player inventory is not detected)
*/
@Nullable
public Inventory getOpenInventory() {
public @Nullable Inventory getOpenInventory() {
return openInventory;
}
@ -1453,7 +1450,6 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
* @return true if the inventory has been opened/sent to the player, false otherwise (cancelled by event)
*/
public boolean openInventory(@NotNull Inventory inventory) {
InventoryOpenEvent inventoryOpenEvent = new InventoryOpenEvent(inventory, this);
EventDispatcher.callCancellable(inventoryOpenEvent, () -> {
@ -1463,7 +1459,6 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
}
Inventory newInventory = inventoryOpenEvent.getInventory();
if (newInventory == null) {
// just close the inventory
return;
@ -1475,9 +1470,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
playerConnection.sendPacket(openWindowPacket);
newInventory.addViewer(this);
this.openInventory = newInventory;
});
return !inventoryOpenEvent.isCancelled();
}
@ -1936,8 +1929,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
*
* @return a {@link PlayerInfoPacket} to add the player
*/
@NotNull
protected PlayerInfoPacket getAddPlayerToList() {
protected @NotNull PlayerInfoPacket getAddPlayerToList() {
PlayerInfoPacket playerInfoPacket = new PlayerInfoPacket(PlayerInfoPacket.Action.ADD_PLAYER);
PlayerInfoPacket.AddPlayer addPlayer =
@ -1963,14 +1955,9 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
*
* @return a {@link PlayerInfoPacket} to remove the player
*/
@NotNull
protected PlayerInfoPacket getRemovePlayerToList() {
protected @NotNull PlayerInfoPacket getRemovePlayerToList() {
PlayerInfoPacket playerInfoPacket = new PlayerInfoPacket(PlayerInfoPacket.Action.REMOVE_PLAYER);
PlayerInfoPacket.RemovePlayer removePlayer =
new PlayerInfoPacket.RemovePlayer(getUuid());
playerInfoPacket.playerInfos.add(removePlayer);
playerInfoPacket.playerInfos.add(new PlayerInfoPacket.RemovePlayer(getUuid()));
return playerInfoPacket;
}
@ -1998,9 +1985,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
connection.sendPacket(new EntityHeadLookPacket(getEntityId(), position.yaw()));
}
@NotNull
@Override
public ItemStack getItemInMainHand() {
public @NotNull ItemStack getItemInMainHand() {
return inventory.getItemInMainHand();
}
@ -2009,9 +1995,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
inventory.setItemInMainHand(itemStack);
}
@NotNull
@Override
public ItemStack getItemInOffHand() {
public @NotNull ItemStack getItemInOffHand() {
return inventory.getItemInOffHand();
}
@ -2020,9 +2005,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
inventory.setItemInOffHand(itemStack);
}
@NotNull
@Override
public ItemStack getHelmet() {
public @NotNull ItemStack getHelmet() {
return inventory.getHelmet();
}
@ -2031,9 +2015,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
inventory.setHelmet(itemStack);
}
@NotNull
@Override
public ItemStack getChestplate() {
public @NotNull ItemStack getChestplate() {
return inventory.getChestplate();
}
@ -2042,9 +2025,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
inventory.setChestplate(itemStack);
}
@NotNull
@Override
public ItemStack getLeggings() {
public @NotNull ItemStack getLeggings() {
return inventory.getLeggings();
}
@ -2053,9 +2035,8 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
inventory.setLeggings(itemStack);
}
@NotNull
@Override
public ItemStack getBoots() {
public @NotNull ItemStack getBoots() {
return inventory.getBoots();
}
@ -2132,16 +2113,6 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
RIGHT
}
/**
* @deprecated See {@link ChatMessageType}
*/
@Deprecated
public enum ChatMode {
ENABLED,
COMMANDS_ONLY,
HIDDEN
}
public class PlayerSettings {
private String locale;
@ -2173,17 +2144,6 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
return viewDistance;
}
/**
* Gets the player chat mode.
*
* @return the player chat mode
* @deprecated Use {@link #getChatMessageType()}
*/
@Deprecated
public ChatMode getChatMode() {
return ChatMode.values()[chatMessageType.ordinal()];
}
/**
* Gets the messages this player wants to receive.
*