版本更新至 4.06
新增:TLocale 新增 BOOK 类型,用于发送书本界面(代替 Language2) 新增:TLocale 新增 BAR 类型,用于发送 Bossbar(需要 BossBarAPI) 新增:TLocale#Tellraw 工具用于发送原始 json 信息 新增:TellrawJson 工具用于创建原始 json 信息 新增:VariableFormatter 工具用于变量识别 新增:ArrayUtils 新增数组修改方法 修复:Language2Book 工具失效问题 调整:JsonFormatter 工具已过时,不再维护 从该版本起不再对 1.7.10 版本进行支持与维护,任何在 1.7.10 版本内出现的问题不再修复。 1.7.10 稳定版:v3.832
This commit is contained in:
@@ -8,54 +8,56 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
/**
|
||||
* @author sky
|
||||
*/
|
||||
public class PlayerUtils {
|
||||
|
||||
/**
|
||||
* 获取目标方块
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param max 最大视野
|
||||
* @return
|
||||
*/
|
||||
public static Block getTargetBlock(Player player, int max) {
|
||||
HashSet<Byte> Byte = new HashSet<>();
|
||||
Byte.add((byte) 0);
|
||||
return player.getTargetBlock(Byte, max);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重写数据
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param scoreboard 是否清理计分板
|
||||
*/
|
||||
public static void resetData(Player player, boolean scoreboard) {
|
||||
if (player.isDead()) {
|
||||
player.spigot().respawn();
|
||||
}
|
||||
player.closeInventory();
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.getInventory().setArmorContents(new ItemStack[4]);
|
||||
player.getInventory().setContents(new ItemStack[0]);
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
player.setExp(0.0F);
|
||||
player.setLevel(0);
|
||||
player.setSneaking(false);
|
||||
player.setSprinting(false);
|
||||
player.setFoodLevel(20);
|
||||
player.setSaturation(10.0F);
|
||||
player.setExhaustion(0.0F);
|
||||
player.setMaxHealth(20.0D);
|
||||
player.setHealth(20.0D);
|
||||
player.setFireTicks(0);
|
||||
player.setItemOnCursor(null);
|
||||
player.getActivePotionEffects().clear();
|
||||
player.getEnderChest().clear();
|
||||
player.updateInventory();
|
||||
if (scoreboard) {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取目标方块
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param max 最大视野
|
||||
* @return
|
||||
*/
|
||||
public static Block getTargetBlock(Player player, int max) {
|
||||
HashSet<Byte> bytes = new HashSet<>();
|
||||
bytes.add((byte) 0);
|
||||
return player.getTargetBlock(bytes, max);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重写数据
|
||||
*
|
||||
* @param player 玩家
|
||||
* @param scoreboard 是否清理计分板
|
||||
*/
|
||||
public static void resetData(Player player, boolean scoreboard) {
|
||||
if (player.isDead()) {
|
||||
player.spigot().respawn();
|
||||
}
|
||||
player.closeInventory();
|
||||
player.setGameMode(GameMode.SURVIVAL);
|
||||
player.getInventory().setArmorContents(new ItemStack[4]);
|
||||
player.getInventory().setContents(new ItemStack[0]);
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
player.setExp(0.0F);
|
||||
player.setLevel(0);
|
||||
player.setSneaking(false);
|
||||
player.setSprinting(false);
|
||||
player.setFoodLevel(20);
|
||||
player.setSaturation(10.0F);
|
||||
player.setExhaustion(0.0F);
|
||||
player.setMaxHealth(20.0D);
|
||||
player.setHealth(20.0D);
|
||||
player.setFireTicks(0);
|
||||
player.setItemOnCursor(null);
|
||||
player.getActivePotionEffects().clear();
|
||||
player.getEnderChest().clear();
|
||||
player.updateInventory();
|
||||
if (scoreboard) {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user