getting variable wont work

Discussion in 'Plugin Development' started by MoseMister, Jan 26, 2014.

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

    MoseMister

    currently got this error
    Code:
    [14:47:02] [Server thread/ERROR]: Could not load 'plugins\Ships.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Plugin already initialized!
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:137) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:308) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:231) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.loadPlugins(CraftServer.java:257) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.reload(CraftServer.java:630) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.Bukkit.reload(Bukkit.java:279) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:23) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:199) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.dispatchCommand(CraftServer.java:544) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.craftbukkit.v1_7_R1.CraftServer.dispatchServerCommand(CraftServer.java:531) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at net.minecraft.server.v1_7_R1.DedicatedServer.aw(DedicatedServer.java:286) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:251) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:545) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:457) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
    Caused by: java.lang.IllegalArgumentException: Plugin already initialized!
        at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:98) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:59) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at Ships.Ships.<init>(Ships.java:12) ~[?:?]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.7.0_45]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_45]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~[?:1.7.0_45]
        at java.lang.reflect.Constructor.newInstance(Unknown Source) ~[?:1.7.0_45]
        at java.lang.Class.newInstance(Unknown Source) ~[?:1.7.0_45]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:52) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        ... 14 more
    Caused by: java.lang.IllegalStateException: Initial initialization
        at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:101) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:59) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at Ships.Ships.<init>(Ships.java:12) ~[?:?]
        at Ships.Bloki.<init>(Bloki.java:10) ~[?:?]
        at Ships.Ships.<clinit>(Ships.java:175) ~[?:?]
        at java.lang.Class.forName0(Native Method) ~[?:1.7.0_45]
        at java.lang.Class.forName(Unknown Source) ~[?:1.7.0_45]
        at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:40) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:133) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        ... 14 more
    
    this is the ships.java
    Code:java
    1. package Ships;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import org.bukkit.Bukkit;
    6. import org.bukkit.ChatColor;
    7. import org.bukkit.plugin.Plugin;
    8. import org.bukkit.plugin.PluginDescriptionFile;
    9. import org.bukkit.plugin.PluginManager;
    10. import org.bukkit.plugin.java.JavaPlugin;
    11.  
    12. public class Ships
    13. extends JavaPlugin
    14. {
    15. static boolean SuportKingdoms;
    16. static String activateText;
    17. static String alternativText;
    18. static int AirShipRequiredBlock;
    19. static int AirShipRequiredPercent;
    20. static int AirShipTheMinimumNumberOfBlocks;
    21. static int AirShipTheMaximumNumberOfBlocks;
    22. static int AirShip2RequiredBlock;
    23. static int AirShip2RequiredPercent;
    24. static int AirShip2TheMinimumNumberOfBlocks;
    25. static int AirShip2TheMaximumNumberOfBlocks;
    26. static int AirShip2FuelId;
    27. static int AirShip2FuelIdAlt;
    28. static int AirShip2Speed;
    29. static int ShipRequiredBlock;
    30. static int ShipRequiredPercent;
    31. static int ShipTheMinimumNumberOfBlocks;
    32. static int ShipTheMaximumNumberOfBlocks;
    33. static int AirShipFuelId;
    34. static int AirShipFuelIdAlt;
    35. static int ShipSpeed;
    36. static int AirShipSpeed;
    37. static int MarsShipRequiredBlock;
    38. static int MarsShipRequiredPercent;
    39. static int MarsShipTheMinimumNumberOfBlocks;
    40. static int MarsShipTheMaximumNumberOfBlocks;
    41. static int MarsShipSpeed;
    42. static int waterlevel;
    43. static int EngineSpeed;
    44. static int ConfigVersion;
    45. static boolean UseElevator;
    46. static boolean CreateConfig;
    47. static boolean ProtectFire;
    48. static boolean BootUpDebug;
    49. static boolean BlockDebug;
    50. static boolean EntityDebug;
    51. static boolean ItemDebug;
    52. static boolean VesselDebug;
    53. static boolean RotateDebug;
    54. static boolean ReturnDebug;
    55. static boolean Acacia_Leaves;
    56. static boolean Wooden_Planks;
    57. static boolean Stone;
    58. static boolean Dirt;
    59. static boolean Grass;
    60. static boolean Cobblestone;
    61. static boolean Sand;
    62. static boolean Gravel;
    63. static boolean Gold_Ore;
    64. static boolean Iron_Ore;
    65. static boolean Coal_Ore;
    66. static boolean Wood_Log;
    67. static boolean Leaves;
    68. static boolean Sponge;
    69. static boolean Glass_Block;
    70. static boolean Lapis_Ore;
    71. static boolean Lapis_Block;
    72. static boolean Dispenser;
    73. static boolean SandStone;
    74. static boolean Note_Block;
    75. static boolean Piston_Sticky;
    76. static boolean Web_Block;
    77. static boolean Piston_Normal;
    78. static boolean Piston_Head;
    79. static boolean Gold_Block;
    80. static boolean Iron_Block;
    81. static boolean Bricks;
    82. static boolean TNT;
    83. static boolean Bookshelf;
    84. static boolean Cobblestone_Mossy;
    85. static boolean Obsidian;
    86. static boolean Spawner;
    87. static boolean Wooden_Stairs;
    88. static boolean Diamond_Ore;
    89. static boolean Diamond_Block;
    90. static boolean Crafting_Table;
    91. static boolean Redstone_Ore;
    92. static boolean Snow;
    93. static boolean Snow_Block;
    94. static boolean Clay;
    95. static boolean JukeBox;
    96. static boolean Fence;
    97. static boolean Pumpkin;
    98. static boolean Soul_Sand;
    99. static boolean Glowstone;
    100. static boolean Cake;
    101. static boolean Jack_O_Lantern;
    102. static boolean Redstone_Repeater;
    103. static boolean Silverfish_Blocks;
    104. static boolean Stone_Brick;
    105. static boolean Iron_Bars;
    106. static boolean Glass_Pane;
    107. static boolean Melon_Block;
    108. static boolean Fence_Gate;
    109. static boolean Brick_Stairs;
    110. static boolean Stone_Brick_Stairs;
    111. static boolean Nether_Brick;
    112. static boolean Nether_Brick_Fence;
    113. static boolean Nether_Brick_Stairs;
    114. static boolean Enchantment_Table;
    115. static boolean Brewing_Stand;
    116. static boolean Cauldron;
    117. static boolean Redstone_Lamp;
    118. static boolean Double_Wood_Slab;
    119. static boolean Wood_Slab;
    120. static boolean Sandstone_Stairs;
    121. static boolean Emerald_Ore;
    122. static boolean Ender_Chest;
    123. static boolean Emerald_Block;
    124. static boolean Command_Block;
    125. static boolean Beacon;
    126. static boolean Cobblestone_Wall;
    127. static boolean Head;
    128. static boolean Redstone_Block;
    129. static boolean Quartz_Ore;
    130. static boolean Quartz_Block;
    131. static boolean Quartz_Stairs;
    132. static boolean Clay_Stained;
    133. static boolean Hay_Bale;
    134. static boolean Carpet;
    135. static boolean Hardened_Clay;
    136. static boolean Coal_Block;
    137. static boolean Glass_Stained;
    138. static boolean Glass_Pane_Stained;
    139. static boolean Daylight;
    140. static boolean Netherrack;
    141. static boolean Iron_Door;
    142. static boolean Wool;
    143. static boolean Dropper;
    144. static boolean Rail_Activtor;
    145. static boolean Hopper;
    146. static boolean Redstone_Comparator;
    147. static boolean PressurePlate_Weighted_Heavy;
    148. static boolean PressurePlate_Weighted_Light;
    149. static boolean Chest_Trapped;
    150. static boolean Anvil;
    151. static boolean Button_Wooden;
    152. static boolean Tripwire_Hook;
    153. static boolean Flower_Pot;
    154. static boolean String;
    155. static boolean Button_Stone;
    156. static boolean Door_Trap;
    157. static boolean Redstone_Torch;
    158. static boolean PresurePlate_Wooden;
    159. static boolean Stone_PressurePlate;
    160. static boolean Lever;
    161. static boolean Ladder;
    162. static boolean Door_Wooden;
    163. static boolean Furnace;
    164. static boolean Redstone;
    165. static boolean Chest;
    166. static boolean Torch;
    167. static boolean Fire;
    168. static boolean Bed;
    169. static boolean Wooden_Acacia;
    170. static boolean Wooden_Acacia_Stairs;
    171.  
    172. static Logger log = Logger.getLogger("Minecraft");
    173. ShipsMaping mys;
    174. static String swiat;
    175. static Bloki ShipsBlock = new Bloki();
    176.  
    177. @Override
    178. public void onDisable()
    179. {
    180. Bukkit.getServer().getScheduler().cancelAllTasks();
    181. PluginDescriptionFile p = this.getDescription();
    182. this.log.info("[" + p.getName() + "] Thank you for using Ships");
    183. }
    184.  
    185. @Override
    186. public void onEnable()
    187. {
    188. Object blok = null;
    189.  
    190. this.log.info(ChatColor.GREEN + "--------[Ships]-------");
    191.  
    192. PluginManager PM = getServer().getPluginManager();
    193. PM.registerEvents(new ShipsListener(), this);
    194.  
    195. PluginDescriptionFile p = this.getDescription();
    196. this.log.info("Booting up Ships" + p.getVersion());
    197. this.log.info("If any errors are found, please contact mose from the dev.bukkit page");
    198.  
    199. ShipsSettings.LoadSettings();
    200. Bloki.LoadSettings();
    201.  
    202. getLogger().info("----recommended errors----");
    203.  
    204. if(BootUpDebug) {
    205. Ships.log.info("---- Debug BootUp - Config ----");
    206. Ships.log.info("--Checking airship values--");
    207. Ships.log.info("The Required % = " + AirShipRequiredPercent);
    208. Ships.log.info("The Minimum number of blocks needed = " + AirShipTheMinimumNumberOfBlocks);
    209. Ships.log.info("The Miximum number of blocks needed = " + AirShipTheMaximumNumberOfBlocks);
    210. Ships.log.info("The fuel id = " + AirShipFuelId);
    211. Ships.log.info("The Alt fuel id = " + AirShipFuelIdAlt);
    212. Ships.log.info("The EOT speed = " + AirShipSpeed);
    213. Ships.log.info("--------");
    214. Ships.log.info("--Checking Other values--");
    215. Ships.log.info("Protect againced fire = " + ProtectFire);
    216. Ships.log.info("the default water level = " + waterlevel);
    217. Ships.log.info("Engine speed = " + EngineSpeed);
    218. Ships.log.info("--------");
    219. Ships.log.info("--Checking Debug Values--");
    220. Ships.log.info("BootupDebug = " + BootUpDebug);
    221. Ships.log.info("VesselDebug = " + VesselDebug);
    222. Ships.log.info("EntityDebug = " + EntityDebug);
    223. Ships.log.info("ItemDebug = " + ItemDebug);
    224. Ships.log.info("BlockDebug = " + BlockDebug);
    225. Ships.log.info("RotateDebug = "+ RotateDebug);
    226. Ships.log.info("--------");
    227. Ships.log.info("--Materials--");
    228. Ships.log.info("Beacon = " + Beacon);
    229. Ships.log.info("Bookshelf = " + Bookshelf);
    230. Ships.log.info("Brewing_Stand = " + Brewing_Stand);
    231. Ships.log.info("Quartz_Block = " + Quartz_Block);
    232. Ships.log.info("--------");
    233. Ships.log.info("--Testers Materials--");
    234. Ships.log.info("Bed = " + Bed);
    235. }
    236.  
    237. if(ItemDebug) {
    238. Ships.log.warning("Debug WILL spam the console of what the ships plugin is doing");
    239. }
    240.  
    241. if (Wooden_Planks == false) {
    242. this.log.warning(" Wooden Planks has been disabled in config, this is not recommended");
    243. }
    244.  
    245. if (Silverfish_Blocks == false) {
    246. if(Stone) {
    247. this.log.warning("Stone has been enabled on your server but Silverfish_Blocks have not, this may make vessels break");
    248. }
    249. if(Cobblestone) {
    250. this.log.warning("Cobblestone has been enabled on your server but Silverfish_Blocks have not, this may make vessels break");
    251. }
    252. if(Stone_Brick) {
    253. this.log.warning("Stone_Brick has been enabled on your server but Silverfish_Blocks have not, this may make your vessels break");
    254. }
    255. }
    256.  
    257. if (Netherrack == false) {
    258. this.log.warning("Netherrack are disabled in config, turn them on to use Airships");
    259. }
    260.  
    261. if (Daylight == false) {
    262. this.log.warning("Daylight sensors are disabled in config, turn them on to use MarsShips");
    263. }
    264.  
    265. if (Furnace == false) {
    266. this.log.warning("Furnaces are disabled in config, turn them on to use Airships");
    267. }
    268.  
    269. if (Fire == false) {
    270. this.log.warning("Fire is disabled in config, turn it on to use Airships");
    271. }
    272.  
    273. getLogger().info(" --------[Ships]-------");
    274.  
    275. Plugin plugin = Bukkit.getPluginManager().getPlugin("Ships");
    276. }
    277. }
    278.  


    and this is bloki.java

    Code:java
    1. package Ships;
    2.  
    3. import java.util.TreeMap;
    4.  
    5. public class Bloki
    6. extends Ships{
    7.  
    8. static TreeMap<Integer, Boolean> Ships = new TreeMap();
    9.  
    10. public Bloki()
    11. {
    12. // sign
    13. Ships.put(Integer.valueOf(63), Boolean.valueOf(true));
    14. //wall sign
    15. Ships.put(Integer.valueOf(68), Boolean.valueOf(true));
    16. //locked chest
    17. Ships.put(Integer.valueOf(95), Boolean.valueOf(false));
    18. //Slabs
    19. Ships.put(Integer.valueOf(44), Boolean.valueOf(false));
    20. //double slabs
    21. Ships.put(Integer.valueOf(43), Boolean.valueOf(false));
    22. }
    23.  
    24. public static void LoadSettings() {
    25. if(Wooden_Planks) {
    26. Ships.put(Integer.valueOf(5), Boolean.valueOf(false));
    27. }
    28. if (Stone) {
    29. Ships.put(Integer.valueOf(1), Boolean.valueOf(false));
    30. }
    31. if (Dirt) {
    32. Ships.put(Integer.valueOf(3), Boolean.valueOf(false));
    33. }
    34. if (Grass) {
    35. Ships.put(Integer.valueOf(2), Boolean.valueOf(false));
    36. }
    37. if (Cobblestone) {
    38. Ships.put(Integer.valueOf(4), Boolean.valueOf(false));
    39. }
    40. if (Sand) {
    41. Ships.put(Integer.valueOf(12), Boolean.valueOf(false));
    42. }
    43. if (Gravel) {
    44. Ships.put(Integer.valueOf(13), Boolean.valueOf(false));
    45. }
    46. if (Gold_Ore) {
    47. Ships.put(Integer.valueOf(14), Boolean.valueOf(false));
    48. }
    49. if (Iron_Ore) {
    50. Ships.put(Integer.valueOf(15), Boolean.valueOf(false));
    51. }
    52. if (Coal_Ore) {
    53. Ships.put(Integer.valueOf(16), Boolean.valueOf(false));
    54. }
    55. if (Wood_Log) {
    56. Ships.put(Integer.valueOf(17), Boolean.valueOf(false));
    57. }
    58. if (Leaves) {
    59. Ships.put(Integer.valueOf(18), Boolean.valueOf(false));
    60. }
    61. if (Sponge) {
    62. Ships.put(Integer.valueOf(19), Boolean.valueOf(false));
    63. }
    64. if (Glass_Block) {
    65. Ships.put(Integer.valueOf(20), Boolean.valueOf(false));
    66. }
    67. if (Lapis_Ore) {
    68. Ships.put(Integer.valueOf(21), Boolean.valueOf(false));
    69. }
    70. if (Lapis_Block) {
    71. Ships.put(Integer.valueOf(22), Boolean.valueOf(false));
    72. }
    73. if (Dispenser) {
    74. Ships.put(Integer.valueOf(23), Boolean.valueOf(false));
    75. }
    76. if (SandStone) {
    77. Ships.put(Integer.valueOf(24), Boolean.valueOf(false));
    78. }
    79. if (Note_Block) {
    80. Ships.put(Integer.valueOf(25), Boolean.valueOf(false));
    81. }
    82. if (Piston_Sticky) {
    83. Ships.put(Integer.valueOf(29), Boolean.valueOf(false));
    84. }
    85. if (Web_Block) {
    86. Ships.put(Integer.valueOf(30), Boolean.valueOf(false));
    87. }
    88. if (Piston_Normal) {
    89. Ships.put(Integer.valueOf(33), Boolean.valueOf(false));
    90. }
    91. if (Piston_Head) {
    92. Ships.put(Integer.valueOf(34), Boolean.valueOf(false));
    93. }
    94. if (Gold_Block) {
    95. Ships.put(Integer.valueOf(41), Boolean.valueOf(false));
    96. }
    97. if (Iron_Block) {
    98. Ships.put(Integer.valueOf(42), Boolean.valueOf(false));
    99. }
    100. if (Bricks) {
    101. Ships.put(Integer.valueOf(45), Boolean.valueOf(false));
    102. }
    103. if (TNT) {
    104. Ships.put(Integer.valueOf(46), Boolean.valueOf(false));
    105. }
    106. if (Bookshelf) {
    107. Ships.put(Integer.valueOf(47), Boolean.valueOf(false));
    108. }
    109. if (Cobblestone_Mossy) {
    110. Ships.put(Integer.valueOf(48), Boolean.valueOf(false));
    111. }
    112. if (Obsidian) {
    113. Ships.put(Integer.valueOf(49), Boolean.valueOf(false));
    114. }
    115. if (Spawner) {
    116. Ships.put(Integer.valueOf(52), Boolean.valueOf(false));
    117. }
    118. if (Diamond_Ore) {
    119. Ships.put(Integer.valueOf(56), Boolean.valueOf(false));
    120. }
    121. if (Diamond_Block) {
    122. Ships.put(Integer.valueOf(57), Boolean.valueOf(false));
    123. }
    124. if (Wooden_Stairs) {
    125. Ships.put(Integer.valueOf(53), Boolean.valueOf(false));
    126. Ships.put(Integer.valueOf(134), Boolean.valueOf(false));
    127. Ships.put(Integer.valueOf(135), Boolean.valueOf(false));
    128. Ships.put(Integer.valueOf(136), Boolean.valueOf(false));
    129. }
    130. if (Crafting_Table) {
    131. Ships.put(Integer.valueOf(58), Boolean.valueOf(false));
    132. }
    133. if (Redstone_Ore) {
    134. Ships.put(Integer.valueOf(73), Boolean.valueOf(false));
    135. Ships.put(Integer.valueOf(74), Boolean.valueOf(false));
    136. }
    137. if (Snow) {
    138. Ships.put(Integer.valueOf(78), Boolean.valueOf(false));
    139. }
    140. if (Snow_Block) {
    141. Ships.put(Integer.valueOf(80), Boolean.valueOf(false));
    142. }
    143. if (Clay) {
    144. Ships.put(Integer.valueOf(82), Boolean.valueOf(false));
    145. }
    146. if (JukeBox) {
    147. Ships.put(Integer.valueOf(84), Boolean.valueOf(false));
    148. }
    149. if (Fence) {
    150. Ships.put(Integer.valueOf(85), Boolean.valueOf(false));
    151. }
    152. if (Pumpkin) {
    153. Ships.put(Integer.valueOf(86), Boolean.valueOf(false));
    154. }
    155. if (Soul_Sand) {
    156. Ships.put(Integer.valueOf(88), Boolean.valueOf(false));
    157. }
    158. if (Glowstone) {
    159. Ships.put(Integer.valueOf(89), Boolean.valueOf(false));
    160. }
    161. if (Cake) {
    162. Ships.put(Integer.valueOf(92), Boolean.valueOf(false));
    163. }
    164. if (Jack_O_Lantern) {
    165. Ships.put(Integer.valueOf(91), Boolean.valueOf(false));
    166. }
    167. if (Redstone_Repeater) {
    168. Ships.put(Integer.valueOf(93), Boolean.valueOf(false));
    169. Ships.put(Integer.valueOf(94), Boolean.valueOf(false));
    170. }
    171. if (Glass_Stained) {
    172. Ships.put(Integer.valueOf(95), Boolean.valueOf(false));
    173. }
    174. if (Silverfish_Blocks) {
    175. Ships.put(Integer.valueOf(97), Boolean.valueOf(false));
    176. }
    177. if (Stone_Brick) {
    178. Ships.put(Integer.valueOf(98), Boolean.valueOf(false));
    179. }
    180. if (Iron_Bars) {
    181. Ships.put(Integer.valueOf(101), Boolean.valueOf(false));
    182. }
    183. if (Glass_Pane) {
    184. Ships.put(Integer.valueOf(102), Boolean.valueOf(false));
    185. }
    186. if (Melon_Block) {
    187. Ships.put(Integer.valueOf(103), Boolean.valueOf(false));
    188. }
    189. if (Fence_Gate) {
    190. Ships.put(Integer.valueOf(107), Boolean.valueOf(false));
    191. }
    192. if (Brick_Stairs) {
    193. Ships.put(Integer.valueOf(108), Boolean.valueOf(false));
    194. }
    195. if (Stone_Brick_Stairs) {
    196. Ships.put(Integer.valueOf(109), Boolean.valueOf(false));
    197. }
    198. if (Nether_Brick) {
    199. Ships.put(Integer.valueOf(112), Boolean.valueOf(false));
    200. }
    201. if (Nether_Brick_Fence) {
    202. Ships.put(Integer.valueOf(113), Boolean.valueOf(false));
    203. }
    204. if (Nether_Brick_Stairs) {
    205. Ships.put(Integer.valueOf(114), Boolean.valueOf(false));
    206. }
    207. if (Enchantment_Table) {
    208. Ships.put(Integer.valueOf(116), Boolean.valueOf(false));
    209. }
    210. if (Brewing_Stand) {
    211. Ships.put(Integer.valueOf(117), Boolean.valueOf(false));
    212. }
    213. if (Cauldron) {
    214. Ships.put(Integer.valueOf(118), Boolean.valueOf(false));
    215. }
    216. if (Redstone_Lamp) {
    217. Ships.put(Integer.valueOf(123), Boolean.valueOf(false));
    218. Ships.put(Integer.valueOf(124), Boolean.valueOf(false));
    219. }
    220. if (Double_Wood_Slab) {
    221. Ships.put(Integer.valueOf(125), Boolean.valueOf(false));
    222. }
    223. if (Wood_Slab) {
    224. Ships.put(Integer.valueOf(126), Boolean.valueOf(false));
    225. }
    226. if (Sandstone_Stairs) {
    227. Ships.put(Integer.valueOf(128), Boolean.valueOf(false));
    228. }
    229. if (Emerald_Ore) {
    230. Ships.put(Integer.valueOf(129), Boolean.valueOf(false));
    231. }
    232. if (Ender_Chest) {
    233. Ships.put(Integer.valueOf(130), Boolean.valueOf(false));
    234. }
    235. if (Emerald_Block) {
    236. Ships.put(Integer.valueOf(133), Boolean.valueOf(false));
    237. }
    238. if (Command_Block) {
    239. Ships.put(Integer.valueOf(137), Boolean.valueOf(false));
    240. }
    241. if (Beacon) {
    242. Ships.put(Integer.valueOf(138), Boolean.valueOf(false));
    243. }
    244. if (Cobblestone_Wall) {
    245. Ships.put(Integer.valueOf(139), Boolean.valueOf(false));
    246. }
    247. if (Head) {
    248. Ships.put(Integer.valueOf(144), Boolean.valueOf(false));
    249. }
    250. if (Redstone_Block) {
    251. Ships.put(Integer.valueOf(152), Boolean.valueOf(false));
    252. }
    253. if (Quartz_Ore) {
    254. Ships.put(Integer.valueOf(153), Boolean.valueOf(false));
    255. }
    256. if (Quartz_Block) {
    257. Ships.put(Integer.valueOf(155), Boolean.valueOf(false));
    258. }
    259. if (Quartz_Stairs) {
    260. Ships.put(Integer.valueOf(156), Boolean.valueOf(false));
    261. }
    262. if (Clay_Stained) {
    263. Ships.put(Integer.valueOf(159), Boolean.valueOf(false));
    264. }
    265. if (Acacia_Leaves) {
    266. Ships.put(Integer.valueOf(161), Boolean.valueOf(false));
    267. }
    268. if (Wooden_Acacia) {
    269. Ships.put(Integer.valueOf(162), Boolean.valueOf(false));
    270. }
    271. if (Wooden_Acacia_Stairs) {
    272. Ships.put(Integer.valueOf(163), Boolean.valueOf(false));
    273. Ships.put(Integer.valueOf(164), Boolean.valueOf(false));
    274. }
    275. if (Hay_Bale) {
    276. Ships.put(Integer.valueOf(170), Boolean.valueOf(false));
    277. }
    278. if (Hardened_Clay) {
    279. Ships.put(Integer.valueOf(172), Boolean.valueOf(false));
    280. }
    281. if (Coal_Block) {
    282. Ships.put(Integer.valueOf(173), Boolean.valueOf(false));
    283. }
    284. if (Glass_Pane_Stained) {
    285. Ships.put(Integer.valueOf(160), Boolean.valueOf(false));
    286. }
    287. //Experimental Materials
    288. if (Daylight) {
    289. Ships.put(Integer.valueOf(151), Boolean.valueOf(false));
    290. }
    291. if (Netherrack) {
    292. Ships.put(Integer.valueOf(87), Boolean.valueOf(false));
    293. }
    294. if (Iron_Door) {
    295. Ships.put(Integer.valueOf(71), Boolean.valueOf(false));
    296. }
    297. if (Wool) {
    298. Ships.put(Integer.valueOf(35), Boolean.valueOf(false));
    299. }
    300. if (Carpet) {
    301. Ships.put(Integer.valueOf(171), Boolean.valueOf(true));
    302. }
    303. if (Dropper) {
    304. Ships.put(Integer.valueOf(158), Boolean.valueOf(true));
    305. }
    306. if (Rail_Activtor) {
    307. Ships.put(Integer.valueOf(157), Boolean.valueOf(true));
    308. }
    309. if (Hopper) {
    310. Ships.put(Integer.valueOf(154), Boolean.valueOf(true));
    311. }
    312. if (Redstone_Comparator) {
    313. Ships.put(Integer.valueOf(150), Boolean.valueOf(true));
    314. Ships.put(Integer.valueOf(149), Boolean.valueOf(false));
    315. }
    316. if (PressurePlate_Weighted_Heavy) {
    317. Ships.put(Integer.valueOf(148), Boolean.valueOf(false));
    318. }
    319. if (PressurePlate_Weighted_Light) {
    320. Ships.put(Integer.valueOf(147), Boolean.valueOf(false));
    321. }
    322. if (Stone_PressurePlate) {
    323. Ships.put(Integer.valueOf(70), Boolean.valueOf(false));
    324. }
    325. if (Chest_Trapped) {
    326. Ships.put(Integer.valueOf(146), Boolean.valueOf(true));
    327. }
    328. if (Anvil) {
    329. Ships.put(Integer.valueOf(145), Boolean.valueOf(true));
    330. }
    331. if (Button_Wooden) {
    332. Ships.put(Integer.valueOf(143), Boolean.valueOf(true));
    333. }
    334. if (Tripwire_Hook) {
    335. Ships.put(Integer.valueOf(131), Boolean.valueOf(true));
    336. }
    337. if (Flower_Pot) {
    338. Ships.put(Integer.valueOf(140), Boolean.valueOf(true));
    339. }
    340. if (String) {
    341. Ships.put(Integer.valueOf(132), Boolean.valueOf(false));
    342. }
    343. if (Button_Stone) {
    344. Ships.put(Integer.valueOf(77), Boolean.valueOf(true));
    345. }
    346. if (Door_Trap) {
    347. Ships.put(Integer.valueOf(96), Boolean.valueOf(true));
    348. }
    349. if (Redstone_Torch) {
    350. Ships.put(Integer.valueOf(76), Boolean.valueOf(true));
    351. Ships.put(Integer.valueOf(75), Boolean.valueOf(true));
    352. }
    353. if (PresurePlate_Wooden) {
    354. Ships.put(Integer.valueOf(72), Boolean.valueOf(true));
    355. }
    356. if (Lever) {
    357. Ships.put(Integer.valueOf(69), Boolean.valueOf(true));
    358. }
    359. Ships.put(Integer.valueOf(68), Boolean.valueOf(true));
    360. if (Ladder) {
    361. Ships.put(Integer.valueOf(65), Boolean.valueOf(true));
    362. }
    363. if (Door_Wooden) {
    364. Ships.put(Integer.valueOf(64), Boolean.valueOf(true));
    365. }
    366. if (Furnace) {
    367. Ships.put(Integer.valueOf(62), Boolean.valueOf(true));
    368. Ships.put(Integer.valueOf(61), Boolean.valueOf(true));
    369. }
    370. if (Redstone) {
    371. Ships.put(Integer.valueOf(55), Boolean.valueOf(true));
    372. }
    373. if (Chest) {
    374. Ships.put(Integer.valueOf(54), Boolean.valueOf(true));
    375. }
    376. if (Torch) {
    377. Ships.put(Integer.valueOf(50), Boolean.valueOf(true));
    378. }
    379. if (Fire) {
    380. Ships.put(Integer.valueOf(51), Boolean.valueOf(true));
    381. }
    382. if (Bed) {
    383. Ships.put(Integer.valueOf(26), Boolean.valueOf(true));
    384. }
    385. }
    386. }
    387.  


    this code works fine on craftbukkit 1.7.2 beta 0.2 and lower however i am having problems updating.

    ----------

    i was told to fix this error, i would need to delete the
    Code:java
    1. extends Ships
    in bloki.java, then change all the variables to Ships.<variable>

    i would also need to change all the variables in Ships.java to public. i changed them to public by the following.

    Code:java
    1. public static boolean <variable>


    i am new to java. and thanks for helping
     
  2. Offline

    epicfacecreeper

    Err...yes? That is really all you can do. Most IDEs have a find/replace function. Use this to add stuff, e.g. find "static", replace with "public static". Also, you don't need to manually wrap all the ints and booleans in the Ships map, it should autobox those.
     
  3. Offline

    MoseMister

    epicfacecreeper

    im saying it does not work ....

    i found out after creating this thread that its to do with the treemap having the same treemap name as Ships. however i get a error on elipse saying the i should change the treemap to static (when i change the name of the treemap) ... however it is already static.

    i have tried changing the main class name (ships.java) to something else, and change all the other class files to suite this change, however a problem occurs in a class file called ShipsListener.java. the following tell me to change it in ships thread.
    Code:java
    1. BukkitTask task = new ShipsThread(this, PrzesuniecieX, PrzesuniecieZ, swiat, blok, player).runTaskTimer(plugin, 20L, 100L);


    oh and heres ShipsThread.java

    Code:java
    1. package Ships;
    2.  
    3. import java.util.HashMap;
    4. import org.bukkit.Bukkit;
    5. import org.bukkit.ChatColor;
    6. import org.bukkit.Location;
    7. import org.bukkit.Server;
    8. import org.bukkit.World;
    9. import org.bukkit.block.Block;
    10. import org.bukkit.entity.Player;
    11. import org.bukkit.plugin.java.JavaPlugin;
    12. import org.bukkit.scheduler.BukkitRunnable;
    13. import org.bukkit.scheduler.BukkitScheduler;
    14.  
    15. public class ShipsThread
    16. extends BukkitRunnable
    17. {
    18. private final JavaPlugin plugin;
    19. private final int PrzesuniecieX;
    20. private int PrzesuniecieZ;
    21. private World swiat;
    22. private Block blok;
    23. private Location lokacja;
    24. private Player player;
    25. private String name;
    26.  
    27. public ShipsThread(JavaPlugin plugin, int PrzesuniecieX, int PrzesuniecieZ, World swiat, Block blok, Player player)
    28. {
    29. this.plugin = plugin;
    30. this.PrzesuniecieX = PrzesuniecieX;
    31. this.PrzesuniecieZ = PrzesuniecieZ;
    32. this.swiat = swiat;
    33. this.blok = blok;
    34. this.lokacja = this.blok.getLocation();
    35. this.player = player;
    36. this.name = this.player.getName().toString();
    37. }
    38.  
    39. public void run()
    40. {
    41. Block blok2 = this.swiat.getBlockAt(this.lokacja);
    42.  
    43. ShipsMaping Statek = new ShipsMaping(blok2);
    44. if (ShipsRequirements.EOTisStop(Statek.SignList)) {
    45. EndThread(this.name);
    46. }
    47. if (ShipsIF.ifCanMove(this.player, Statek))
    48. {
    49. if (ShipsCollisions.wykrywanieKolizji(Statek, this.PrzesuniecieX, 0, this.PrzesuniecieZ, this.swiat))
    50. {
    51. ShipsMove.move(Statek, this.PrzesuniecieX, 0, this.PrzesuniecieZ, this.swiat);
    52. ShipsMove.moveMobs(Statek, this.PrzesuniecieX, 0, this.PrzesuniecieZ, this.swiat);
    53. ShipsMove.movePlayer(Statek, this.PrzesuniecieX, 0, this.PrzesuniecieZ, this.swiat);
    54. this.lokacja = new Location(this.swiat, this.lokacja.getX() + this.PrzesuniecieX, this.lokacja.getY(), this.lokacja.getZ() + this.PrzesuniecieZ);
    55. }
    56. else
    57. {
    58. EndThread(this.name);
    59. this.player.sendMessage(ChatColor.RED + "[Ships] Obstacle on the course.");
    60. }
    61. }
    62. else {
    63. EndThread(this.name);
    64. }
    65. }
    66.  
    67. static boolean EndThread(String name)
    68. {
    69. if (ShipsListener.IdWatku.containsKey(name))
    70. {
    71. Bukkit.getServer().getScheduler().cancelTask(((Integer)ShipsListener.IdWatku.get(name)).intValue());
    72. return true;
    73. }
    74. return false;
    75. }
    76. }
    77.  
     
  4. Offline

    epicfacecreeper

    MoseMister

    A little lesson on Java best practices.

    Name CLASSES with UpperCamelCase.
    Name VARIABLES with lowerCamelCase.

    This will probably solve most of your problems.
     
  5. Offline

    MoseMister

Thread Status:
Not open for further replies.

Share This Page