mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-01 14:08:08 +01:00
Fix for subplugins
This commit is contained in:
parent
9b1a53fcab
commit
1b96cdf34b
@ -54,6 +54,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginLoadOrder;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
@ -82,9 +83,17 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
File root = new File(getDataFolder(), Setting.SUBPLUGIN_FOLDER.asString());
|
||||
if (!root.exists() || !root.isDirectory())
|
||||
return;
|
||||
Plugin[] plugins = Bukkit.getPluginManager().loadPlugins(root);
|
||||
// code beneath modified from CraftServer
|
||||
for (Plugin plugin : plugins) {
|
||||
File[] files = root.listFiles();
|
||||
for (File file : files) {
|
||||
Plugin plugin;
|
||||
try {
|
||||
plugin = Bukkit.getPluginManager().loadPlugin(file);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
if (plugin == null)
|
||||
continue;
|
||||
// code beneath modified from CraftServer
|
||||
try {
|
||||
Messaging.logF("Loading %s", plugin.getDescription().getFullName());
|
||||
plugin.onLoad();
|
||||
@ -93,6 +102,7 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
((CraftServer) Bukkit.getServer()).enablePlugins(PluginLoadOrder.POSTWORLD);
|
||||
}
|
||||
|
||||
public Iterable<CommandInfo> getCommands(String base) {
|
||||
|
@ -191,7 +191,8 @@ public class EventListen implements Listener {
|
||||
if (npc.getTrait(Owner.class).isOwnedBy(event.getCreator()))
|
||||
owned++;
|
||||
}
|
||||
if (limit >= owned + 1 || limit == 0) {
|
||||
int wouldOwn = owned + 1;
|
||||
if (wouldOwn >= limit) {
|
||||
event.setCancelled(true);
|
||||
event.setCancelReason(String.format("Over the NPC limit of %d.", limit));
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ public class CitizensHumanNPC extends CitizensNPC implements Equipable {
|
||||
// set the head yaw in another tick - if done immediately,
|
||||
// minecraft will not update it.
|
||||
}
|
||||
}, 5);
|
||||
}, 3);
|
||||
handle.getBukkitEntity().setSleepingIgnored(true);
|
||||
return handle;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user