Skip to content

Commit

Permalink
Effectively remove chunk sending speed limit, small refactor in sign …
Browse files Browse the repository at this point in the history
…logging code
  • Loading branch information
kivattt committed Feb 15, 2024
1 parent 5eea66f commit 0443e92
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Adds a stricter mob cap which allows mobs to be enabled for servers without lag
- Improved logging for chests and crates, see items being taken/added
- Fixes 100% CPU usage on 1 core
- Effectively removes the speed limit on sending chunks
- Explosions (TNT, Creepers, Dynamite etc.) don't break chests/crates. (Configurable!)
- Improved logging for players throwing dynamite
- [Region protection](https://www.youtube.com/watch?v=HaCgemz3Sus) to prevent griefing of specific areas
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {

apply plugin: 'foxloader.dev'

version '1.7.1'
version '1.7.2'

foxloader {
// forceReload = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class KivaServerUtils extends Mod {
public static LinkedHashMap<String, String> nameColorChoicesNames = new LinkedHashMap<>();
public static LinkedHashMap<String, String> flagColorChoicesNames = new LinkedHashMap<>();
public static LinkedHashMap<String, String> pronounColorChoicesNames = new LinkedHashMap<>();
public static String version = "1.7.1";
public static String version = "1.7.2";
public static String KSUBroadcastPrefix = ChatColors.DARK_GRAY + "[" + ChatColors.GRAY + "KSU" + ChatColors.DARK_GRAY + "] " + ChatColors.RESET;

public static String handleWindowClickLatestPlayerUsername;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyConstant;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(EntityPlayerMP.class)
Expand All @@ -19,6 +21,16 @@ public void onHandleFalling(double arg1, boolean arg3, CallbackInfo ci){
ci.cancel();
}

@ModifyConstant(method = "onUpdateEntity", constant = @Constant(intValue = 24))
private int removeChunkSendingLimits1(int value){
return Integer.MAX_VALUE;
}

@ModifyConstant(method = "onUpdateEntity", constant = @Constant(intValue = 40))
private int removeChunkSendingLimits2(int value){
return Integer.MAX_VALUE;
}

// Scrapped code to add nicknames to death msgs, this might come in a later update to KivaServerUtils
/*
@ModifyArg(method = "onDeath", at = @At(value = "INVOKE", target = "Lnet/minecraft/src/server/ServerConfigurationManager;sendPacketToAllPlayers(Lnet/minecraft/src/server/packets/Packet;)V"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,20 @@ public void onEditSign(Packet130UpdateSign packet130UpdateSign, CallbackInfo ci)
}

StringBuilder signText = new StringBuilder();
for (String line : packet130UpdateSign.signLines) {
boolean discard = line.length() > 15;

for (int i = 0; i < line.length(); i++){
if (ChatAllowedCharacters.allowedCharacters.indexOf(line.charAt(i)) < 0) {
discard = true;
break;
}

for (int i = 0; i < Math.min(4, packet130UpdateSign.signLines.length); i++){
String line = packet130UpdateSign.signLines[i];
if (line.length() > 15)
continue;

for (int j = 0; j < line.length(); j++){
if (ChatAllowedCharacters.allowedCharacters.indexOf(line.charAt(j)) < 0)
continue;

signText.append(line.charAt(j));
}

if (!discard)
signText.append(line).append("\n");
signText.append("\n");
}

ServerMod.getGameInstance().logWarning(playerEntity.username + " placed/edited sign @ x:" + packet130UpdateSign.xPosition + ", y:" + packet130UpdateSign.yPosition + ", z:" + packet130UpdateSign.zPosition + " with text:\n" + signText);
Expand Down

0 comments on commit 0443e92

Please sign in to comment.