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