本文整理了Java中org.bukkit.Bukkit.getUnsafe()
方法的一些代码示例,展示了Bukkit.getUnsafe()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.getUnsafe()
方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:getUnsafe
暂无
代码示例来源:origin: Bukkit/Bukkit
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null");
if (args.length == 1) {
return Arrays.asList("give");
}
if (args.length == 2) {
return Bukkit.getUnsafe().tabCompleteInternalStatisticOrAchievementName(args[1], new ArrayList<String>());
}
if (args.length == 3) {
return super.tabComplete(sender, alias, args);
}
return ImmutableList.of();
}
}
代码示例来源:origin: Bukkit/Bukkit
return Bukkit.getUnsafe().tabCompleteInternalMaterialName(arg, completion);
代码示例来源:origin: Bukkit/Bukkit
material = Bukkit.getUnsafe().getMaterialFromInternalName(args[1]);
stack = Bukkit.getUnsafe().modifyItemStack(stack, Joiner.on(' ').join(Arrays.asList(args).subList(4, args.length)));
} catch (Throwable t) {
player.sendMessage("Not a valid tag");
代码示例来源:origin: Bukkit/Bukkit
Achievement achievement = Bukkit.getUnsafe().getAchievementFromInternalName(statisticString);
Statistic statistic = Bukkit.getUnsafe().getStatisticFromInternalName(statisticString);
代码示例来源:origin: elBukkit/MagicPlugin
public static org.bukkit.UnsafeValues getUnsafe() {
return Bukkit.getUnsafe();
}
}
代码示例来源:origin: PyvesB/AdvancedAchievements
@Inject
public AdvancementManager(@Named("main") CommentedYamlConfiguration mainConfig,
@Named("gui") CommentedYamlConfiguration guiConfig, AdvancedAchievements advancedAchievements, Logger logger,
Map<String, List<Long>> sortedThresholds, Set<Category> disabledCategories, MaterialHelper materialHelper,
int serverVersion) {
this.mainConfig = mainConfig;
this.guiConfig = guiConfig;
this.advancedAchievements = advancedAchievements;
this.logger = logger;
this.sortedThresholds = sortedThresholds;
this.disabledCategories = disabledCategories;
this.materialHelper = materialHelper;
this.serverVersion = serverVersion;
unsafeValues = Bukkit.getUnsafe();
}
代码示例来源:origin: AdvancementAPI/AdvancementAPI
@SuppressWarnings("deprecation")
public AdvancementAPI remove() {
Bukkit.getUnsafe().removeAdvancement(id);
return this;
}
代码示例来源:origin: SpigotMC/Spigot-API
@Override
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException {
Validate.notNull(sender, "Sender cannot be null");
Validate.notNull(args, "Arguments cannot be null");
Validate.notNull(alias, "Alias cannot be null");
if (args.length == 1) {
return Arrays.asList("give");
}
if (args.length == 2) {
return Bukkit.getUnsafe().tabCompleteInternalStatisticOrAchievementName(args[1], new ArrayList<String>());
}
if (args.length == 3) {
return super.tabComplete(sender, alias, args);
}
return ImmutableList.of();
}
}
代码示例来源:origin: SpigotMC/Spigot-API
return Bukkit.getUnsafe().tabCompleteInternalMaterialName(arg, completion);
代码示例来源:origin: EngineHub/CommandHelper
public static Material getMaterial(Material legacymat, int data) {
if(legacymat == null) {
return null;
}
if(legacymat.getMaxDurability() == 0) {
if(legacymat.equals(Material.LEGACY_ANVIL)) {
// special cases where we prioritize item conversion
return Bukkit.getUnsafe().fromLegacy(new MaterialData(legacymat, (byte) data), true);
}
return Bukkit.getUnsafe().fromLegacy(new MaterialData(legacymat, (byte) data));
} else {
// ignore data when it's actually durability
return Bukkit.getUnsafe().fromLegacy(legacymat);
}
}
代码示例来源:origin: AdvancementAPI/AdvancementAPI
@SuppressWarnings("deprecation")
public AdvancementAPI add() {
try {
Bukkit.getUnsafe().loadAdvancement(id, getJSON());
Bukkit.getLogger().info("Successfully registered advancement.");
} catch (IllegalArgumentException e) {
Bukkit.getLogger().info("Error registering advancement. It seems to already exist!");
}
return this;
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public int getTypeId() {
if(b == null) {
return 0;
}
return Bukkit.getUnsafe().toLegacy(b.getType()).getId();
}
代码示例来源:origin: EngineHub/CommandHelper
public static BlockData getBlockData(int id, int data) {
BukkitMCLegacyMaterial legacy = BY_ID.get(id);
if(legacy == null) {
return Material.AIR.createBlockData();
}
Material mat = Material.getMaterial("LEGACY_" + legacy.name());
return Bukkit.getUnsafe().fromLegacy(mat, (byte) data);
}
}
代码示例来源:origin: EngineHub/CommandHelper
@Override
public int getTypeId() {
if(is == null) {
return 0;
}
return Bukkit.getUnsafe().toLegacy(is.getType()).getId();
}
代码示例来源:origin: AddstarMC/Minigames
state.setBlockData(Bukkit.getUnsafe().fromLegacy(Material.getMaterial(args.get("mat")),Byte.valueOf(args.get("data"))));
代码示例来源:origin: AddstarMC/Minigames
/**
* Remove in 1.14 as no configs should have materialdata stored.
*/
@Deprecated
private BlockData parseOldMaterialData(String path,FileConfiguration config){
try {
String obj = config.getString(path+"."+getName());
Material mat = Material.matchMaterial(obj);
Integer olddata = config.getInt(path+".matchdatavalue");
if(olddata == 0) olddata = config.getInt(path+".todatavalue");
if(olddata == 0 ) olddata = config.getInt(path+".dur");
return Bukkit.getUnsafe().fromLegacy(mat, olddata.byteValue());
}catch (Exception ignored){
Minigames.getPlugin().getLogger().log(Level.CONFIG,"Error loading Value for" + path);
}
return Material.STONE.createBlockData();
}
代码示例来源:origin: NyaaCat/RPGItems-reloaded
@SuppressWarnings("deprecation")
public static Material getMaterial(String name, CommandSender sender) {
Material m = Material.matchMaterial(name, false);
if (m == null) {
m = Material.matchMaterial(name, true);
if (m != null) {
m = Bukkit.getUnsafe().fromLegacy(m);
sender.sendMessage(I18n.format("message.error.legacy_name", name, m.toString()));
}
}
return m;
}
代码示例来源:origin: SpigotMC/Spigot-API
material = Bukkit.getUnsafe().getMaterialFromInternalName(args[1]);
stack = Bukkit.getUnsafe().modifyItemStack(stack, Joiner.on(' ').join(Arrays.asList(args).subList(4, args.length)));
} catch (Throwable t) {
player.sendMessage("Not a valid tag");
代码示例来源:origin: filoghost/ChestCommands
try {
Bukkit.getUnsafe().modifyItemStack(itemStack, nbtData);
} catch (Throwable t) {
this.nbtData = null;
代码示例来源:origin: SpigotMC/Spigot-API
Achievement achievement = Bukkit.getUnsafe().getAchievementFromInternalName(statisticString);
Statistic statistic = Bukkit.getUnsafe().getStatisticFromInternalName(statisticString);
内容来源于网络,如有侵权,请联系作者删除!