Issue
I'm making a little prototype plugin that strengthens the mobs every minute, but the plugin isn't showing up on the server.
The plugin is exported as a jar file and placed into the plugins folder of the server.
All help is greatly appreciated. Thanks!
my 3 scripts are here:
Main script:
package csw.lvlupmobs.plugin;
import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitScheduler;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
private static Main instance;
public static Main getInstance() {
return instance;
}
@Override
public boolean onCommand(CommandSender sender,
Command command,
String label,
String[] args) {
if (command.getName().equalsIgnoreCase("initiatelevelup")) {
sender.sendMessage("Mobs will now strengthen every minute!");
Listeners.doLevels = true;
levelup();
return true;
}
return false;
}
public void levelup() {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
Listeners.moblvl++;
Bukkit.broadcastMessage("All mobs have leveled up! New mobs will now spawn at level "
+ Listeners.moblvl + ".");
}
}, 1200);
}
@Override
public void onEnable() {
instance = this;
getServer().getPluginManager().registerEvents(new Listeners(), this);
}
@Override
public void onDisable() {
instance = null;
}
}
Listeners:
package csw.lvlupmobs.plugin;
import org.bukkit.potion.*;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
public class Listeners implements Listener{
static int moblvl = 0;
static boolean doLevels = false;
@EventHandler
public void event(CreatureSpawnEvent event) {
if(doLevels == false) { return; }
// Creeper. Its explosion radius and knock back resistance increases with mob level
if(event.getEntityType() == EntityType.CREEPER) {
Creeper creeper = (Creeper) event.getEntity();
creeper.setExplosionRadius((int)(3 * moblvl * 0.2));
creeper.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).setBaseValue(0.05 * moblvl);
}
else
// Zombie. Its follow range, health, damage, and reinforcement spawn chance increases with mob level
if(event.getEntityType() == EntityType.ZOMBIE) {
Zombie zombie = (Zombie) event.getEntity();
zombie.getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(45 * moblvl * 0.2);
zombie.getAttribute(Attribute.ZOMBIE_SPAWN_REINFORCEMENTS).setBaseValue(0.02 * moblvl);
zombie.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(0.6 * moblvl);
zombie.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20 * 0.2 * moblvl);
zombie.setHealth(20 * 0.2 * moblvl);
}
else
// Skeleton. Its movement speed and armor increases with mob level
if(event.getEntityType() == EntityType.SKELETON) {
Skeleton skeleton = (Skeleton) event.getEntity();
skeleton.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.25 * moblvl * 0.1);
skeleton.getAttribute(Attribute.GENERIC_ARMOR).setBaseValue(0.75 * moblvl);
}
else
// Spider. Its movement speed, damage and jump height increases with mob level
if(event.getEntityType() == EntityType.SPIDER) {
Spider spider = (Spider) event.getEntity();
spider.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(0.3 * moblvl * 0.2);
spider.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(0.34 * moblvl * 2);
spider.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 99999, (int)(moblvl * 0.34)));
}
}
}
plugin.yml:
main: csw.lvlupmobs.plugin.Main
name: mobs that level-up
version: 1.0
author: Austin Powers
description: Every minute, all of the mobs increase in strength
commands:
initiatelevelup:
description: Enables mobs to level-up
usage: /initiatelevelup
Solution
you have a Space in your Name ... Don't use a Space Letter in your plugin.yml.
But i think you can use it in "authors"
Answered By - Jan Heil