Code Monkey home page Code Monkey logo

hordes's Introduction

Hordes

Hordes is a small Bukkit plugin which increases observable amount of monsters without actually spawning more of them. It's very lightweight and it will not have any impact on the overall performance.

How does it work?

First let's get some things clear. First, in Minecraft mobs spawn in every dark place: in caves, under trees, at night etc. Second, Bukkit has an option to limit amount of mobs spawned per chunk. By default there can be 70 monsters, you can increase/decrease that number and it will have an impact on performance. Third, the player cannot be in two places at the same time. I think we can agree with that. So why do mobs in caves fill this limit up when the player is on the surface? They cannot threaten him, and he cannot kill them.

Hordes removes all the mobs that are far away from the player and blocks spawning new ones in locations out of reach of the player. This means that Bukkit will spawn monsters only near the player, on the same vertical level. While the amount of mobs is intact, they are placed only near the player.

If you don't want your players to fight with greater amount of mobs you can decrease the limit in bukkit.yml file. It will make your server run faster (less mobs to handle - better performance) while maintaining the amount of mobs near the players.

Configuration

You can edit the plugin settings in the config.yml file. despawn-interval in global-settings controls how often the mobs are despawned. Default is every 10 seconds. If you make that number lower, the mobs will be removed more frequently, but it may slightly impact the performance. Do not touch version setting!

Each world in which you want to enable the plugin needs one section in the worlds branch in the configuration, named as the name of the world. height option is responsible for the vertical distance from the player beyond which monsters will despawn. If you want to limit horizontal distance, there's an option for that in spigot.yml config file, it's called mob-spawn-range (it's measured in whole chunks. Use ctrl+f to find it. Option mobs is a list of types of mobs handled by this plugin taken from here. You don't have to make it with CAPS LOCK, you can also use spaces instead of _. If you don't want some mob to be despawned simply remove it from this list. health option is health multiplier. It will increase health of naturally spawned mobs that many times. It can has a floating point, but cannot be negative.

ratio option controls the chance for a mob to spawn, 0 means it won't show at all and 1 means it will be allowed every time Minecraft tries to do so. This setting should be used along with the custom branch, which lets you control individual properties of each mob specified in mobs list. If you don't specify any mob here, it will simply use settings defined for the whole world (health and ratio). For example, if you want half of all monsters to be of type Zombie, you should set global ratio to 0.5 and add zombie to custom branch. There you should specify ratio for zombie to be set to 1. It will mean that every time a Zombie will try to spawn it will be allowed to do so, but all other mobs will have only 50% chance to be spawned.

This will not decrease the total amount of mobs, because Minecraft will keep spawning the mobs until it reaches its limit. The only difference is that mobs with lower ratio will spawn slower, because some spawn events will be blocked. Generally a spawn events happens once a tick (20 times per second), so if 10 of them will be blocked instead of 8, mobs will spawn less frequently. You probably won't notice the difference though.

Commands

Hordes has only one command, "/hordesreload", which reloads the configuration. You need hordes.reload command to use it, which is default for ops.

Licensing, source code, compiling

Hordes is licensed under GPLv3, which means it's a free software (as in "free speech", not "free beer"). It's distributed from SpigotMC.org for 3€. The source code can be found on GitHub. To compile it you need JDK 1.7 and Maven 3 installed on your system. Issue mvn install command inside the root directory. The JAR file should appear in target folder.

hordes's People

Contributors

riledupcrow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hordes's Issues

Remove async mob checking

Async mob checking is unnecessary - it's fast enough for the main thread. It will prevent all those messages about concurrent modifications.

Suggestion: Add line-of-sight option

Could you add a line-of-sight spawning option in hordes?
That would be awesome. So we could get rid of useless mobs that are spawning in caves near a player (but which the player can not even see)

Zapytanie

Plugin będzie działać z modami pod cauldronem?

Mob ratio setting

This setting will control the chance that the particular type of mob will be allowed to be spawned.

Bukkit spawns mobs continuously until the limit is reached. This setting could be implemented as a number between 0 and 1, where 1 means that this mob will be allowed to spawn every time it tries and 0 means it will never be allowed to spawn.

For example reducing ratios for all mobs except Zombies will make other mobs spawn less frequently until the limit is reached by Zombies spawning freely.

Hordes spawn issue

After doing /plugman reload Hordes (to make sure there are no active hordes) I try to do /hordes spawn Enchanted and it gives me this error.

null
12.10 16:28:13 [Server] INFO org.bukkit.command.CommandException: Unhandled exception executing command 'hordes' in plugin Hordes v1.0.0
12.10 16:28:13 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) ~[patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) ~[patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_262]
12.10 16:28:13 [Server] INFO at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_262]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:774) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:378) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:713) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:616) [patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at java.lang.Thread.run(Thread.java:748) [?:1.8.0_262]
12.10 16:28:13 [Server] INFO Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.entity.EntityType.Wolf
12.10 16:28:13 [Server] INFO at java.lang.Enum.valueOf(Enum.java:238) ~[?:1.8.0_262]
12.10 16:28:13 [Server] INFO at org.bukkit.entity.EntityType.valueOf(EntityType.java:1) ~[patched.jar:git-PaperSpigot-"4c7641d"]
12.10 16:28:13 [Server] INFO at me.sin.hordes.Hordes.spawnHorde(Hordes.java:72) ~[?:?]
12.10 16:28:13 [Server] INFO at me.sin.hordes.HordesCommand.onCommand(HordesCommand.java:84) ~[?:?]
12.10 16:28:13 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched.jar:git-PaperSpigot-"4c7641d"]

generated an exception while executing task 19

Saw this error and thought I should share it.

[14:51:34 WARN]: [Hordes] Plugin Hordes v1.5 generated an exception while executing task 19
java.util.ConcurrentModificationException: null
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:909) ~[?:1.8.0_212]
at java.util.ArrayList$Itr.next(ArrayList.java:859) ~[?:1.8.0_212]
at org.bukkit.craftbukkit.v1_13_R2.CraftWorld.getLivingEntities(CraftWorld.java:691) ~[patched_1.13.2.jar:git-Paper-625]
at pl.betoncraft.hordes.Despawner.run(Despawner.java:60) ~[?:?]
at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftTask.run(CraftTask.java:84) ~[patched_1.13.2.jar:git-Paper-625]
at org.bukkit.craftbukkit.v1_13_R2.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52) ~[patched_1.13.2.jar:git-Paper-625]
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.13.2.jar:git-Paper-625]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_212]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_212]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]

Paper 1.13.2 build 625
Hordes plugin downloaded from Spigotmc.org

Console error

Hi,
I just found this in my server logs:

[20:52:15] [Craft Scheduler Thread - 308/WARN]: Exception in thread "Craft Scheduler Thread - 308"
[20:52:15] [Craft Scheduler Thread - 308/WARN]: org.apache.commons.lang.UnhandledException: Plugin Hordes v1.2 generated an exception while executing task 24
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:56)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
at java.util.ArrayList$Itr.next(ArrayList.java:831)
at org.bukkit.craftbukkit.v1_8_R3.CraftWorld.getEntities(CraftWorld.java:626)
at pl.betoncraft.hordes.Despawner.run(Despawner.java:57)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71)
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
... 3 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.