bukkit

What is @SuppressWarnings(“deprecation”) and how do I fix it?

帅比萌擦擦* 提交于 2020-01-07 08:54:07
问题 I am following a YouTube tutorial and I came across this error. At this line, @SuppressWarnings("deprecation") comes up. Player targerPlayer = Bukkit.getServer().getPlayer(args[0]); Here is my simple healing plugin. package me.roofer.youtube; import java.util.logging.Logger; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.plugin.PluginDescriptionFile; import

How to load id list from config for player Inventory? [Bukkit]

廉价感情. 提交于 2020-01-07 07:56:10
问题 I have this code: public boolean hasItem(Player player){ int empty = 0; int armors = 0; for (String str : config.denyBlocks) { for (ItemStack item : player.getInventory().getContents()) { if (item == null || item.getType() == Material.getMaterial(str)) empty++; } } for (ItemStack armor : player.getInventory().getArmorContents()) { if (armor == null || armor.getType() == Material.AIR) armors++; } return empty == player.getInventory().getContents().length && armors == player.getInventory()

Bukkit How to change an int in the config file then be able to change it again without reloading (Custom config file class.))

独自空忆成欢 提交于 2020-01-06 06:10:49
问题 Okay so I am making a custom feature for my OP-Prison server, one of the things that I need to do is get an integer from the players.yml file, check if it is >= one, if it is take away one, save it and then if it is still above one then they can repeat the action untill it's 0. The issue comes with the fact that I have to restart the server for the file to change, and even when I do, it will only go down by one integer at a time, before having to reload it again. GUI Creation code: Main main

Bukkit How to change an int in the config file then be able to change it again without reloading (Custom config file class.))

五迷三道 提交于 2020-01-06 06:10:02
问题 Okay so I am making a custom feature for my OP-Prison server, one of the things that I need to do is get an integer from the players.yml file, check if it is >= one, if it is take away one, save it and then if it is still above one then they can repeat the action untill it's 0. The issue comes with the fact that I have to restart the server for the file to change, and even when I do, it will only go down by one integer at a time, before having to reload it again. GUI Creation code: Main main

Bukkit plugin get locations from config.yml

浪尽此生 提交于 2020-01-05 05:45:28
问题 I'm trying to create plugin, that will check when someone open the chest if the chest's location doesn't match with any location in my config.yml. So I want to do something like this: ArratList<Location> list = new ArrayList(); foreach(get world, x, y, z from each key in section Locations in my config) { list.add(new Location(world, x, y, z)); foreach(Location l : list) { if(l == p.location... } } EDIT: Now I have this code: public class Listeners implements Listener { public Core plugin;

Proguard: Keep annotation of specific method

ε祈祈猫儿з 提交于 2020-01-04 02:28:05
问题 Have have this class in my Minecraft Bukkit plugin: public class AsyncPlayerChatListener implements Listener { @EventHandler(priority = EventPriority.HIGH) public void onEvent(AsyncPlayerChatEvent event) { } } And I want to keep the method along with its annotation. This is my current proguard configuration: -keep class * extends org.bukkit.event.Listener { @org.bukkit.event.EventHandler <methods>; } ProGuard currently keeps the method and removes the annotation. How can I specify to keep all

Get all nodes under YAML path

↘锁芯ラ 提交于 2019-12-30 10:10:13
问题 I have a YAML file that looks like this: Main: topofhouse: x: 276.4375 y: 71.0 z: -60.5 yaw: -290.7768 pitch: 35.400017 2ndfloor: x: 276.5 y: 67.0 z: -60.5 yaw: -8.626648 pitch: 16.199997 home: x: 276.5 y: 63.0 z: -60.5 yaw: -18.976715 pitch: -32.850002 Is there a way to get all nodes under Main ? 回答1: To get the node IDs contained in Main : file.getConfigurationSection("Main").getKeys(false); Output: Set["topofhouse", "2ndfloor", "home"] The ConfigurationSection.getConfigurationSection

ClassCastException on custom class loading

∥☆過路亽.° 提交于 2019-12-25 19:04:11
问题 I'm trying to write a scripting system in Java and I've managed to get my scripts to compile and instantiate but when I try to cast the script into a "DeftScript" it throws a ClassCastError even thought the script itself extends the class "DeftScript" Error (the important part at least): java.lang.ClassCastException: scripts.Compass cannot be cast to com.deft.core.scripts.DeftScript at com.deft.core.scripts.DeftScriptManager.instantiate(DeftScriptManager.java:52) ~[?:?] The error is caused by

NoClassDefFoundError ClassLoader

别说谁变了你拦得住时间么 提交于 2019-12-25 19:02:02
问题 Im currently getting an error on thie line loadedClass = classLoader.loadClass("scripts.Compass"); Somehow the file compiles fine but when I try to load the class it wont work because it says its missing the class com/deft/core/scripts/DeftScript Compiling & Instantiating: File script = new File("./plugins/Deft-Core/scripts/Compass.java"); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>(); JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();

Calling the method on an instance rather than the class not working with static type

那年仲夏 提交于 2019-12-25 10:01:38
问题 I am currently trying t create a plugin and I have can across an error that wont let me call a method because it needs to be static for something that happens in the method. I sort of fixed this problem by using: package.Main main = new package.Main(); . Now, the problem I am left with is that when I actually call the method, using main.method(); it says that the code above needs to be static however when I do this, it then returns this error in console. org.bukkit.command.CommandException: