Issue when loading plugin

Discussion in 'Plugin Development' started by arnie231, Feb 24, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    arnie231

    Hi cant work this out :S can someone help i did take a look at trying to figure it out on my own but i couldnt

    Code:
    2012-02-23 17:34:35 [INFO] Starting minecraft server version 1.1
    2012-02-23 17:34:35 [INFO] Loading properties
    2012-02-23 17:34:35 [INFO] Starting Minecraft server on *:25565
    2012-02-23 17:34:35 [WARNING] **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
    2012-02-23 17:34:35 [WARNING] The server will make no attempt to authenticate usernames. Beware.
    2012-02-23 17:34:35 [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.
    2012-02-23 17:34:35 [WARNING] To change this, set "online-mode" to "true" in the server.properties file.
    2012-02-23 17:34:35 [INFO] This server is running CraftBukkit version git-Bukkit-1.1-R4-b1938jnks (MC: 1.1) (Implementing API version 1.1-R4)
    2012-02-23 17:34:35 [INFO] [PermissionsEx] sql backend registered!
    2012-02-23 17:34:35 [INFO] [PermissionsEx] file backend registered!
    2012-02-23 17:34:35 [INFO] [PermissionsEx] PermissionEx plugin initialized.
    2012-02-23 17:34:35 [INFO] [PermissionsEx] p2compat backend registered!
    2012-02-23 17:34:35 [INFO] [PermissionsCompat] Compatibility Layer Initalized!
    2012-02-23 17:34:35 [INFO] [PermissionsEx] Initializing file backend
    2012-02-23 17:34:35 [INFO] Preparing level "world"
    2012-02-23 17:34:35 [INFO] Default game type: 0
    2012-02-23 17:34:35 [INFO] Preparing start region for level 0 (Seed: -2308541849184186544)
    2012-02-23 17:34:36 [INFO] Preparing start region for level 1 (Seed: -7101538523461573852)
    2012-02-23 17:34:36 [INFO] Preparing spawn area: 12%
    2012-02-23 17:34:37 [INFO] Preparing start region for level 2 (Seed: -2308541849184186544)
    2012-02-23 17:34:37 [INFO] Preparing spawn area: 81%
    2012-02-23 17:34:37 [INFO] [PermissionsEx] Loading PermissionsEx v1.18.
    2012-02-23 17:34:38 [INFO] [PermissionsEx] Superperms support enabled.
    2012-02-23 17:34:38 [INFO] [PermissionsEx] v1.18 enabled
    2012-02-23 17:34:38 [SEVERE] java.lang.Boolean cannot be cast to java.lang.String loading Stronghold 2 v0.0.1 (Is it up to date?)
    java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
    at org.bukkit.command.PluginCommandYamlParser.parse(PluginCommandYamlParser.java:25)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:373)
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:199)
    at org.bukkit.craftbukkit.CraftServer.enablePlugins(CraftServer.java:182)
    at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:357)
    at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:344)
    at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:175)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:408)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:465)
    2012-02-23 17:34:38 [INFO] [Permissions] Loading Permissions v2.7.7.
    2012-02-23 17:34:38 [INFO] [PermissionsCompat] Compatibility layer enabled.
    2012-02-23 17:34:38 [INFO] Server permissions file permissions.yml is empty, ignoring it
    2012-02-23 17:34:38 [INFO] Done (2.386s)! For help, type "help" or "?"
    
     
  2. Offline

    Ice_Sword

    That's saying you can't make a Boolean statement into a String.

    Say, you have a Boolean variable A with a value of True. It's saying you can't then make a String variable, say, B, equal to Boolean variable A.

    If that doesn't help, post the offending snippet of code (less preferred), or your whole class(preferred).
     
  3. Offline

    arnie231

    Thank you for the repley i dont understand which class who :/
     
  4. Offline

    Ice_Sword

    This is the plugin you're developing, right? Just post the code and I'll see if I can debug it.

    Post it inside of these:
    Code:
    [syntax=java][/syntax]
     
  5. Offline

    arnie231

    its private plugin for my server thanks for the help it was working but then i tried one of the command which gave me an error on trying to fix it i broke the whole of the plugin

    Main

    Code:java
    1.  
    2. package com.SH2Dev.SH2;
    3.  
    4. import com.SH2Dev.SH2.Commands.*;
    5. import com.SH2Dev.SH2.Listeners.SH2PlayerJoinListener;
    6. import com.SH2Dev.SH2.Listeners.SH2PlayerJoinMessageListener;
    7. import com.nijiko.permissions.PermissionHandler;
    8. import com.nijikokun.bukkit.Permissions.Permissions;
    9. import java.io.File;
    10. import java.io.FileOutputStream;
    11. import java.io.InputStream;
    12. import java.io.OutputStream;
    13. import java.util.logging.Level;
    14. import java.util.logging.Logger;
    15. import org.bukkit.Bukkit;
    16. import org.bukkit.command.CommandExecutor;
    17. import org.bukkit.configuration.file.FileConfiguration;
    18. import org.bukkit.configuration.file.YamlConfiguration;
    19. import org.bukkit.entity.Player;
    20. import org.bukkit.plugin.Plugin;
    21. import org.bukkit.plugin.PluginManager;
    22. import org.bukkit.plugin.java.JavaPlugin;
    23.  
    24. public class SH2 extends JavaPlugin
    25. {
    26.  
    27. public static PermissionHandler permissionHandler;
    28.  
    29. public static File ConfigFile;
    30. public static File MessageFile;
    31. public static File NamesFile;
    32. public static FileConfiguration Config;
    33. public static FileConfiguration Message;
    34. public static FileConfiguration Names;
    35. static final Logger log = Logger.getLogger("Minecraft");
    36.  
    37. @Override
    38. public void onEnable()
    39. {
    40. ConfigFile = new File(getDataFolder(), "Config.yml");
    41. MessageFile = new File(getDataFolder(), "Message.yml");
    42. NamesFile = new File(getDataFolder(), "Names.yml");
    43. try
    44. {
    45. firstRun();
    46. } catch (Exception ex) {
    47. }
    48. Config = new YamlConfiguration();
    49. Message = new YamlConfiguration();
    50. Names = new YamlConfiguration();
    51. loadYaml();
    52. setupPermissions();
    53. registerCommands();
    54. registerEvents();
    55. log.info("[Stronghold 2] Stronghold 2 v0.0.1 has been enabled!");
    56. }
    57.  
    58. @Override
    59. public void onDisable() {
    60. log.info("[Stronghold 2] Stronghold 2 v0.0.1 has been disabled!");
    61. saveYaml();
    62. }
    63.  
    64. private void firstRun() throws Exception {
    65. if (!ConfigFile.exists()) {
    66. ConfigFile.getParentFile().mkdirs();
    67. copy(getResource("Config.yml"), ConfigFile);
    68. }
    69. if (!MessageFile.exists()) {
    70. MessageFile.getParentFile().mkdirs();
    71. copy(getResource("Message.yml"), MessageFile);
    72. }
    73. if (!NamesFile.exists()) {
    74. NamesFile.getParentFile().mkdirs();
    75. copy(getResource("Names.yml"), NamesFile);
    76. }
    77. }
    78.  
    79. private void copy(InputStream in, File file) {
    80. try {
    81. OutputStream out = new FileOutputStream(file);
    82. byte[] buf = new byte[1024];
    83. int len;
    84. while ((len = in.read(buf)) > 0) {
    85. out.write(buf, 0, len);
    86. }
    87. out.close();
    88. in.close(); } catch (Exception e) {
    89. }
    90. }
    91.  
    92. private void loadYaml() {
    93. try {
    94. Config.load(ConfigFile);
    95. Message.load(MessageFile);
    96. Names.load(NamesFile);
    97. }
    98. catch (Exception e) {
    99. }
    100. }
    101.  
    102. private void saveYaml() {
    103. try {
    104. Config.save(ConfigFile);
    105. Message.save(MessageFile);
    106. Names.save(NamesFile);
    107. } catch (Exception e) {
    108. }
    109. }
    110.  
    111. public static boolean permissionCheck(Player p, String node) {
    112. if (Bukkit.getServer().getPluginManager().getPlugin("Permissions") != null) {
    113. return permissionHandler.has(p, node);
    114. }
    115. return p.hasPermission(node);
    116. }
    117.  
    118. public void setupPermissions()
    119. {
    120. if (permissionHandler != null) {
    121. return;
    122. }
    123.  
    124. Plugin permissionsPlugin = getServer().getPluginManager().getPlugin("Permissions");
    125.  
    126. if (permissionsPlugin == null) {
    127. log.info("[Stronghold 2] [WARNING] No Permissions Plugin Found. Please install one!");
    128. return;
    129. }
    130.  
    131. permissionHandler = ((Permissions)permissionsPlugin).getHandler();
    132. log.log(Level.INFO, "[Stronghold 2] Permissions Found and will use plugin {0}", ((Permissions)permissionsPlugin).getDescription().getFullName());
    133. }
    134.  
    135. public void registerEvents() {
    136. PluginManager pm = getServer().getPluginManager();
    137. pm.registerEvents(new SH2PlayerJoinMessageListener(), this);
    138. pm.registerEvents(new SH2PlayerJoinListener(), this);
    139. log.info("[Stronghold 2] Events registered");
    140. }
    141. public void registerCommands() {
    142. rc("broadcast", new SH2BroadcastCommands());
    143. rc("yes", new SH2TheBeginningCommands());
    144. rc("no", new SH2TheBeginningCommands());
    145. rc("lore", new SH2TheBeginningCommands());
    146. rc("page2", new SH2TheBeginningCommands());
    147. rc("page3", new SH2TheBeginningCommands());
    148. rc("page4", new SH2TheBeginningCommands());
    149. rc("page5", new SH2TheBeginningCommands());
    150. rc("page6", new SH2TheBeginningCommands());
    151. rc("page7", new SH2TheBeginningCommands());
    152. rc("page8", new SH2TheBeginningCommands());
    153. rc("nick", new SH2NickNameCommands());
    154. rc("shhelp", new SH2HelpCommands());
    155. rc("factionset", new SH2FactionSetCommands());
    156. rc("home", new SH2FactionHomeCommands());
    157. log.info("[Stronghold 2] Registered Commands");
    158. }
    159.  
    160. public void rc(String command, CommandExecutor ce) {
    161. Bukkit.getServer().getPluginCommand(command).setExecutor(ce);
    162. }
    163. }
    164.  


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 24, 2016
  6. Offline

    Ice_Sword

    arnie231 Try removing "Boolean" at Line 11. See if that helps. It may not. :/ We really need to find out where the error's happening, and I couldn't by that log.
     
Thread Status:
Not open for further replies.

Share This Page