Java Tutorial: Bukkit Plugin Development (permissions) [part
Posted: Fri Sep 09, 2011 10:43 pm
So i did from tut 1 to tut 4 but on part 4 from the tutorial i got a error when starting up my server
this is my server.log
this is my server.log
2011-09-10 00:30:32 [INFO] Starting minecraft server version Beta 1.7.3 2011-09-10 00:30:32 [INFO] Loading properties 2011-09-10 00:30:32 [INFO] Starting Minecraft server on *:25565 2011-09-10 00:30:32 [WARNING] **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE! 2011-09-10 00:30:32 [WARNING] The server will make no attempt to authenticate usernames. Beware. 2011-09-10 00:30:32 [WARNING] While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose. 2011-09-10 00:30:32 [WARNING] To change this, set "online-mode" to "true" in the server.settings file. 2011-09-10 00:30:32 [INFO] This server is running Craftbukkit version git-Bukkit-0.0.0-980-g4ed23b1-b1060jnks (MC: 1.7.3) 2011-09-10 00:30:32 [SEVERE] Could not load 'plugins\TNTNotifier.jar' in folder 'plugins': while scanning for the next token found character '\t' that cannot start any token in "<reader>", line 5, column 1: tntnotifier.allow-tnt: ^ at org.yaml.snakeyaml.scanner.ScannerImpl.fetchMoreTokens(ScannerImpl.java:360) at org.yaml.snakeyaml.scanner.ScannerImpl.checkToken(ScannerImpl.java:183) at org.yaml.snakeyaml.parser.ParserImpl$ParseBlockMappingValue.produce(ParserImpl.java:592) at org.yaml.snakeyaml.parser.ParserImpl.peekEvent(ParserImpl.java:163) at org.yaml.snakeyaml.parser.ParserImpl.checkEvent(ParserImpl.java:148) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:132) at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:230) at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:160) at org.yaml.snakeyaml.composer.Composer.composeDocument(Composer.java:122) at org.yaml.snakeyaml.composer.Composer.getSingleNode(Composer.java:105) at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:124) at org.yaml.snakeyaml.Yaml.load(Yaml.java:264) at org.yaml.snakeyaml.Yaml.load(Yaml.java:250) at org.bukkit.plugin.PluginDescriptionFile.<init>(PluginDescriptionFile.java:36) at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:69) at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:213) at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:136) at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:143) at org.bukkit.craftbukkit.CraftServer.<init>(CraftServer.java:110) at net.minecraft.server.ServerConfigurationManager.<init>(ServerConfigurationManager.java:51) at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:133) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:337) at net.minecraft.server.ThreadServerApplication.run(SourceFile:422) 2011-09-10 00:30:32 [INFO] Preparing level "world" 2011-09-10 00:30:33 [INFO] Preparing start region for level 0 (Seed: -5757995853447927496) 2011-09-10 00:30:34 [INFO] Preparing start region for level 1 (Seed: 466512814878660727) 2011-09-10 00:30:34 [INFO] Preparing spawn area: 0% 2011-09-10 00:30:34 [INFO] PermissionsBukkit v1.1 is now enabled 2011-09-10 00:30:34 [INFO] Server permissions file permissions.yml is empty, ignoring it 2011-09-10 00:30:34 [INFO] Done (0,200s)! For help, type "help" or "?" 2011-09-10 00:30:36 [INFO] Stopping the server.. 2011-09-10 00:30:36 [INFO] Stopping server 2011-09-10 00:30:36 [INFO] PermissionsBukkit v1.1 is now disabled 2011-09-10 00:30:36 [INFO] Saving chunks 2011-09-10 00:30:36 [INFO] Stopping serverthis is plugin.yml
name: TNTNotifier version: 0.2 main: Minecraft.TNTNotifier permissions: tntnotifier.allow-tnt: description: Laat het gebruik van TNT toe. default: opthis is TNTNotifFierBlockListener
package Minecraft; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.entity.Player; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.inventory.ItemStack; public class TNTNotifFierBlockListener extends BlockListener{ private TNTNotifier plugin; public TNTNotifFierBlockListener(TNTNotifier instance){ this.plugin = instance; } public void onBlockPlace(BlockPlaceEvent event){ if (event.isCancelled()) return; Block block = event.getBlock(); Player player = event.getPlayer(); if (block.getType() == Material.TNT && player.hasPermission("tntnotifier.allow-tnt") == false){ block.setType(Material.CAKE_BLOCK); player.sendMessage(ChatColor.DARK_RED + "U bent niet bevoegd om TNT te plaatsen op deze server."); plugin.logMessage(player.getName() + " Plaatste een TNT blok bij " + block.getX() + "," + block.getY() + "," + block.getZ() + "."); } } public void onBlockBreak(BlockBreakEvent event){ if (event.isCancelled()) return; Block block = event.getBlock(); if (block.getType() == Material.TNT){ event.setCancelled(true); block.setType(Material.AIR); block.getWorld().dropItemNaturally(block.getLocation(), new ItemStack(Material.CAKE, 1)); } } }en this is TNTNotifier
package Minecraft; import java.util.logging.Logger; import org.bukkit.event.Event; import org.bukkit.event.Event.Priority; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.java.JavaPlugin; public class TNTNotifier extends JavaPlugin{ private Logger log = Logger.getLogger("Minecraft"); private TNTNotifFierBlockListener blockListener = new TNTNotifFierBlockListener(this); public void onEnable() { PluginManager pm = this.getServer().getPluginManager(); pm.registerEvent(Event.Type.BLOCK_PLACE, this.blockListener, Priority.Highest, this); pm.registerEvent(Event.Type.BLOCK_BREAK, this.blockListener, Priority.Highest, this); this.logMessage("ingeschakeld."); } public void onDisable() { this.logMessage("uitgeschakeld."); } protected void logMessage(String msg){ PluginDescriptionFile pdFile = this.getDescription(); this.log.info(pdFile.getName() + " " + pdFile.getVersion() + ": " + msg); } }