Well, the title pretty much says it all. I feel that my code could work but I am having a problem running a certain part in Minecraft. My plugin involves dreaming so when a player uses a bed they are sent to a new world. However, I feel like it is not detecting when the player is sleeping. I used the statement:
if(player.isSleeping())
and then I continued the code from there. Here is part of the code that is relevant:
public class LucidDream extends JavaPlugin {
Location normalDream;
Location nightmareDream;
Location original;
public final Logger log = Logger.getLogger("Minecraft");
public void onEnable(){
log.info(ChatColor.GREEN + "LucidDream has been enabled!");
}
public void onDisable(){
log.info(ChatColor.RED + "LucidDream has been disabled!");
}
public boolean onCommand(CommandSender sender,Command cmd, String commandLabel, String[] args){
Player player = (Player) sender;
boolean sleeping = false;
original = player.getLocation();
saveInventory(player);
ItemStack[] copy = copyInventory(player.getInventory());
if(player.isSleeping())
{
if((int) Math.random() * 2 > .2){ // Make it so the player spawns in a safe place
normalDream = new Location(normalWorld(),0,0,0);
player.teleport(normalDream);
if(player.teleport(normalDream))
sender.sendMessage(ChatColor.BLUE + "Welcome to your dream!");
}else{
nightmareDream = new Location(nightmareWorld(),0,0,0);
player.teleport(nightmareDream);
if(player.teleport(nightmareDream))
sender.sendMessage(ChatColor.RED + "Welcome to your NIGHTMARE!");
}
sleeping = true;
return true;
}
if(sleeping==true && commandLabel.equalsIgnoreCase("wake"))
{
player.teleport(original);
restoreInventory(player, copy);
sender.sendMessage("Welcome Back!");
return true;
}
return false;
}
Also, you may see a part I had commented which is something else that I need some assistance in. When I create the locations of these world, I am trying to make it so each time a new world is made, the player is guaranteed to spawn in a safe place which means they wont spawn inside the ground for example.
There are plugins that involve changing the DisplayName which is technically changing the IGN, so yes. Your specifying something like this I believe? http://dev.bukkit.org/bukkit-mods/dispnamechanger/
Hey guys, I managed to figure out the problem. It turn's out the plugin.yml file had a problem like I suspected before. What I forgot to do was write the name of the class in the main part. Instead I only went up to the package.
Hey guys, I am having trouble making a plugin specifically when I export it to a JAR file and try to run a server to test it. The plugin is just a basic plugin so I can see how it turns out. Here is the log when I try to run it:
C:\Users\John\Desktop\Bukkit Server>java -Xms1024M -Xmx1024M -jar craftbukkit.ja
r -o true
229 recipes
27 achievements
19:24:18 [INFO] Starting minecraft server version 1.5.2
19:24:18 [INFO] Loading properties
19:24:18 [INFO] Default game type: SURVIVAL
19:24:18 [INFO] Generating keypair
19:24:19 [INFO] Starting Minecraft server on *:25565
19:24:19 [INFO] This server is running CraftBukkit version git-Bukkit-1.5.2-R0.1
-b2771jnks (MC: 1.5.2) (Implementing API version 1.5.2-R0.1)
19:24:19 [SEVERE] Could not load 'plugins\TestPlugin.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.ClassNotFoundException: com.
gmail.John.Alexiades.TestPlugin
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
ava:184)
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.
java:305)
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager
.java:230)
at org.bukkit.craftbukkit.v1_5_R3.CraftServer.loadPlugins(CraftServer.ja
va:239)
at org.bukkit.craftbukkit.v1_5_R3.CraftServer.<init>(CraftServer.java:21
7)
at net.minecraft.server.v1_5_R3.PlayerList.<init>(PlayerList.java:55)
at net.minecraft.server.v1_5_R3.DedicatedPlayerList.<init>(SourceFile:11
)
at net.minecraft.server.v1_5_R3.DedicatedServer.init(DedicatedServer.jav
a:106)
at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java
:382)
at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:5
73)
Caused by: java.lang.ClassNotFoundException: com.gmail.John.Alexiades.TestPlugin
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader
.java:80)
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
java:53)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.j
ava:173)
... 9 more
19:24:19 [INFO] Preparing level "world"
19:24:20 [INFO] ----- Bukkit Auto Updater -----
19:24:20 [INFO] It appears that you're running a Beta Build, when you've specifi
ed in bukkit.yml that you prefer to run Recommended Builds.
19:24:20 [INFO] If you would like to be kept informed about new Beta Build relea
ses, it is recommended that you change 'preferred-channel' in your bukkit.yml to
'beta'.
19:24:20 [INFO] With that set, you will be told whenever a new version is availa
ble for download, so that you can always keep up to date and secure with the lat
est fixes.
19:24:20 [INFO] If you would like to disable this warning, simply set 'suggest-c
hannels' to false in bukkit.yml.
19:24:20 [INFO] ----- ------------------- -----
19:24:20 [INFO] Preparing start region for level 0 (Seed: -8753948271163627962)
19:24:21 [INFO] Preparing spawn area: 8%
19:24:22 [INFO] Preparing spawn area: 24%
19:24:23 [INFO] Preparing spawn area: 33%
19:24:24 [INFO] Preparing spawn area: 49%
19:24:25 [INFO] Preparing spawn area: 62%
19:24:26 [INFO] Preparing spawn area: 78%
19:24:27 [INFO] Preparing spawn area: 99%
19:24:27 [INFO] Preparing start region for level 1 (Seed: -8753948271163627962)
19:24:28 [INFO] Preparing spawn area: 87%
19:24:28 [INFO] Preparing start region for level 2 (Seed: -8753948271163627962)
19:24:29 [INFO] Server permissions file permissions.yml is empty, ignoring it
19:24:29 [INFO] Done (9.345s)! For help, type "help" or "?"
>
I am using Eclipse when I am exporting and I am I select, "Export generated class filed and resources" Before when I selected, "Export all output folders for checked projects" I get a problem with the plugin.yml file not being detected. I am really not sure what the problem is though, help is greatly appreciated!
0
if(player.isSleeping())
and then I continued the code from there. Here is part of the code that is relevant:
Also, you may see a part I had commented which is something else that I need some assistance in. When I create the locations of these world, I am trying to make it so each time a new world is made, the player is guaranteed to spawn in a safe place which means they wont spawn inside the ground for example.
Any help is greatly appreciated!
0
That doesn't really help him out...
There are plugins that involve changing the DisplayName which is technically changing the IGN, so yes. Your specifying something like this I believe? http://dev.bukkit.org/bukkit-mods/dispnamechanger/
0
0
0
I am using Eclipse when I am exporting and I am I select, "Export generated class filed and resources" Before when I selected, "Export all output folders for checked projects" I get a problem with the plugin.yml file not being detected. I am really not sure what the problem is though, help is greatly appreciated!