Browse Source

Added farm item stacker

pull/5/head
Stefatorus 4 years ago
parent
commit
e788d419b2
  1. 2
      plugin.yml
  2. 14
      server.yml
  3. 2
      src/cx/sfy/LagAssist/Main.java
  4. 11
      src/cx/sfy/LagAssist/Redstone.java
  5. 2
      src/cx/sfy/LagAssist/cmd/CommandListener.java
  6. 1
      src/cx/sfy/LagAssist/microfeatures/MicroManager.java
  7. 24
      src/cx/sfy/LagAssist/utils/V1_11.java
  8. 2
      src/cx/sfy/LagAssist/utils/VersionMgr.java

2
plugin.yml

@ -1,6 +1,6 @@
name: LagAssist
author: Stefatorus
version: 2.23.3
version: 2.23.4
api-version: 1.13
description: LagAssist is an advanced anti-lag solution that allows server owners find and remove lag using multiple advanced and efficient methods.
main: cx.sfy.LagAssist.Main

14
server.yml

@ -167,7 +167,19 @@ microfeatures:
increment: 20
# Max value before showing the message
max: 80
# This feature stack growables in a chunk and only drops items on a full stack.
# IT should reduce the entity counts in the chunk, and can help on servers where
# chunkhoppers are not fully adopted.
#
# (!) Not recommended for servers that do not have extremely huge farms, as the
# drops from smaller farms will get delayed.
stack-growables:
enable: false
# What is the stack size? Amounts over 64 won't render.
stacksize: 64
blocks:
- "CACTUS"
- "SUGAR_CANE"
# Laggy Chunk detection. You can fiddle around and find the best settings for your
# server.

2
src/cx/sfy/LagAssist/Main.java

@ -135,7 +135,7 @@ public class Main extends JavaPlugin implements Listener {
p.sendMessage(msg + "(MINDEBUG: " + mindebug + ")");
}
if (debug == 2) {
if (debug == 3) {
try {
throw new Exception(msg);
} catch (Exception e) {

11
src/cx/sfy/LagAssist/Redstone.java

@ -13,7 +13,6 @@ import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scheduler.BukkitTask;
import cx.sfy.LagAssist.utils.V1_11;
import cx.sfy.LagAssist.utils.VersionMgr;
import cx.sfy.LagAssist.utils.WorldMgr;
public class Redstone implements Listener {
@ -56,16 +55,14 @@ public class Redstone implements Listener {
@Override
public void run() {
redstoneculler = false;
if (VersionMgr.isV1_11()) {
V1_11.ObserverBreaker();
}
V1_11.observerBreaker();
}
}.runTaskLater(Main.p, ticks);
}
@EventHandler
public void RedstoneCuller(BlockRedstoneEvent e) {
public void redstoneCuller(BlockRedstoneEvent e) {
if (!redstoneculler) {
return;
}
@ -98,14 +95,14 @@ public class Redstone implements Listener {
if (WorldMgr.isBlacklisted(e.getBlock().getWorld())) {
return;
}
if (VersionMgr.isV1_11()) {
// if (VersionMgr.isNewMaterials()) {
if (destructives) {
V1_11.ObserverAdd(e.getBlock());
}
if (V1_11.isObserver(e.getBlock())) {
e.setCancelled(true);
}
}
// }
}
}

2
src/cx/sfy/LagAssist/cmd/CommandListener.java

@ -97,7 +97,7 @@ public class CommandListener implements CommandExecutor {
.reduce((s1, s2) -> s1 + "\n" + s2).orElse("NOT FOUND"));
}
} else if (arg.equalsIgnoreCase("debugmode")) {
Main.debug = Main.debug >= 2 ? 0 : Main.debug+1;
Main.debug = Main.debug >= 3 ? 0 : Main.debug+1;
sender.sendMessage(Main.PREFIX + "Debug setting currently at: " + Main.debug);
} else {
sendHelp(sender);

1
src/cx/sfy/LagAssist/microfeatures/MicroManager.java

@ -34,6 +34,7 @@ public class MicroManager implements Listener {
}
Main.p.getServer().getPluginManager().registerEvents(new MicroManager(), Main.p);
Main.p.getServer().getPluginManager().registerEvents(new GrowableStack(), Main.p);
}
private static void runTask() {

24
src/cx/sfy/LagAssist/utils/V1_11.java

@ -15,16 +15,20 @@ public class V1_11 {
public static Map<Block, Integer> removable = new HashMap<Block, Integer>();
public static void ObserverAdd(Block b) {
if (b.getType().equals(Material.OBSERVER)) {
if (removable.containsKey(b)) {
removable.put(b, removable.get(b) + 1);
} else {
removable.put(b, 1);
}
Material mat = Material.getMaterial("OBSERVER");
if (mat == null) {
return;
}
if (b.getType().equals(mat)) {
int val = removable.compute(b, (k, v) -> v == null ? 1 : v+1);
Main.sendDebug("Incremented value for observer: " + val, 2);
}
}
public static void ObserverBreaker() {
public static void observerBreaker() {
int min = Main.config.getInt("redstone-culler.destructive.value");
for (Block bs : removable.keySet()) {
if (removable.get(bs) > min) {
@ -78,7 +82,11 @@ public class V1_11 {
// }
public static boolean isObserver(Block b) {
if (b.getType().equals(Material.OBSERVER)) {
if (b == null) {
return false;
}
if (b.getType().equals(Material.getMaterial("OBSERVER"))) {
return true;
}
return false;

2
src/cx/sfy/LagAssist/utils/VersionMgr.java

@ -43,7 +43,7 @@ public class VersionMgr {
}
public static boolean isV1_11() {
return Bukkit.getVersion().contains("1.11");
return !isV1_8() && !isV1_9() && !isV1_10();
}
public static boolean isV1_12() {

Loading…
Cancel
Save