how do i extending 'This'

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

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

    MoseMister

    hey everyone, yet another problem when trying to update my plugin to 1.7.2 dev 0.3.

    i get a error in eclipse over
    Code:java
    1. new ShipsThread(this, PrzesuniecieX, PrzesuniecieZ, swiat, blok, player)


    i used to extend the class, however due to 1.7.2 dev 0.3, extends does not work for some of my classes,

    these are the classes you will need to take a look at, if you ask for more, you can get more

    Main class (ShipsMain)
    bit your looking at
    Code:java
    1. PluginManager PM = getServer().getPluginManager();
    2. PM.registerEvents(new ShipsListener(), this);


    whole thing

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


    Class that has the error in (ShipsListener)

    bit your looking at (maybe around)
    Code:java
    1. int PrzesuniecieX = przesuniecieX;
    2. int PrzesuniecieZ = przesuniecieZ;
    3.  
    4. Plugin plugin = Bukkit.getPluginManager().getPlugin("Ships");
    5. BukkitTask task = new ShipsThread(this, PrzesuniecieX, PrzesuniecieZ, swiat, blok, player).runTaskTimer(plugin, 0L, 100L);


    whole thing is in a comment below ... had to do this because it made this more then 3000 words

    and this class (ShipsThread)

    bit your looking at (and around)
    Code:java
    1. public ShipsThread(JavaPlugin plugin, int PrzesuniecieX, int PrzesuniecieZ, World swiat, Block blok, Player player)


    whole thing

    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.  




    i have worked out the problem lies with 'this' can not be read, because its on shipsMain. like i said before, the whole class used to be extended to ShipsMain, however i can not do that any more.

    if i was able to put a getter onto 'this' would that work? if so, HOW?


    thank you
     
  2. Offline

    Jnorr44

    Condense your fields to:​
    private boolean field1, field2, field3;​
    That should shorten things up a lot.​
    Also, I'm not sure exactly what you're asking? If you're getting an error on 'this' in that constructor, it's because the class you are calling the constructor from is not an instance of JavaPlugin (does not extend JavaPlugin). ​
     
  3. Offline

    The_Doctor_123

    That code.. Oh man.. My head hurts.

    And I don't even understand your problem, you're saying all these little things and it's extremely confusing.
     
    MTN, Garris0n and bobacadodl like this.
  4. Offline

    bobacadodl

    I'm not even sure what your problem is, as The_Doctor_123 mentioned...
    Also, instead of having that huge mess of boolean fields, you should probably just use a HashMap<Material,Boolean>...
     
    The_Doctor_123 and Garris0n like this.
  5. Offline

    Garris0n

  6. Offline

    MoseMister

    @Garris0n
    @Bobacadodl
    @The_Doctor_123
    @Jnorr44

    im asking how to get rid of a error in eclipse without extending the class
    im new to java

    the error comes under
    new ShipsThread(this, PrzesuniecieX, PrzesuniecieZ, swiat, blok, player)
    in ShipsListener

    eclipse wants me to either change the constructor from new ShipsThread(this, PrzesuniecieX, PrzesuniecieZ, swiat, blok, player) to new ShipsThread(JavaPlugin, PrzesuniecieX, PrzesuniecieZ, swiat, blok, player)

    this does not work

    or create a constructor
    new ShipsThread(ShipsListener, PrzesuniecieX, PrzesuniecieZ, swiat, blok, player)

    i got round this before by extending the whole class to ShipsMain, however this is not possible anymore due to the fact of craftbukkit 1.7.2 dev 0.3 gives me an error of
    Code:
    [11:31:00] [Server thread/ERROR]: Error occurred while enabling Ships v3.2.4 (Is it up to date?)
    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.ShipsMain.<init>(ShipsMain.java:12) ~[?:?]
        at Ships.ShipsListener.<init>(ShipsListener.java:24) ~[?:?]
        at Ships.ShipsMain.onEnable(ShipsMain.java:203) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:250) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:350) [craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:384) [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.loadPlugin(CraftServer.java:300) [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.enablePlugins(CraftServer.java:282) [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.m(MinecraftServer.java:342) [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.g(MinecraftServer.java:319) [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.a(MinecraftServer.java:275) [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.init(DedicatedServer.java:175) [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:424) [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.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.ShipsMain.<init>(ShipsMain.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]
        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.<init>(CraftServer.java:235) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at net.minecraft.server.v1_7_R1.PlayerList.<init>(PlayerList.java:63) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        at net.minecraft.server.v1_7_R1.DedicatedPlayerList.<init>(SourceFile:14) ~[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.init(DedicatedServer.java:126) ~[craftbukkit-1.7.2-R0.3.jar:git-Bukkit-1.7.2-R0.2-10-gd51ccd1-b2987jnks]
        ... 2 more
    [11:31:00] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
     
  7. Offline

    MTN

    Create a field in ShipsListener with the plugin and use
    Code:java
    1. new ShipsThread(plugin, PrzesuniecieX, PrzesuniecieZ, swiat, blok, player)


    if you use "this" you are referring to an object of the class "ShipsListener" not your main class!

    But yes, this code has a lot of room for "improvement", I mean e.g.:
    Code:java
    1. static Logger log = Logger.getLogger("Minecraft");

    Where do people get that from!? I never seen any tutorials or whatsoever with this, but in a lot of plugins!
    Use plugin.getLogger().
     
  8. Offline

    L33m4n123

    bcbroz or however they are called
     
  9. Offline

    The_Doctor_123

    MoseMister
    You should learn Java before the Bukkit API.
     
    L33m4n123 likes this.
  10. Offline

    bfgbfggf

    Hah... from Polish tutorials! :D the most horrible tutorials in the world! (yeach.... that sad)


    (for author):
    Przestań czytać MPCforum... bo tylko zgłupiejesz z tych tutków :)
    I tak jak napisał MTN
    Musisz tam wstawić instancje głównej klasy :) bo "this" odnosi się do tej klasy w której jesteś, nie do głównej, więc musisz sobie gdzieś zapisać instancje i stworzyć metoda do jej "odczytania"
     
  11. Offline

    Garris0n

Thread Status:
Not open for further replies.

Share This Page