Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/CraftBukkit-Patches/0126-Allow-Attribute-Capping.patch

79 Zeilen
4.6 KiB
Diff

2016-03-01 01:23:45 +01:00
From ff1cbc9c27c12f0ade79b8a3791321ee31cce996 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Mon, 28 Jul 2014 16:55:51 +1000
Subject: [PATCH] Allow Attribute Capping.
Apply some sensible defaults and allow server owners to customize the maximum values of selected common attributes.
diff --git a/src/main/java/net/minecraft/server/AttributeRanged.java b/src/main/java/net/minecraft/server/AttributeRanged.java
2014-11-28 02:17:45 +01:00
index 13602f0..838daed 100644
--- a/src/main/java/net/minecraft/server/AttributeRanged.java
+++ b/src/main/java/net/minecraft/server/AttributeRanged.java
@@ -3,7 +3,7 @@ package net.minecraft.server;
public class AttributeRanged extends AttributeBase {
private final double a;
- private final double b;
+ public double b; // Spigot
private String c;
2014-11-28 02:17:45 +01:00
public AttributeRanged(IAttribute iattribute, String s, double d0, double d1, double d2) {
diff --git a/src/main/java/net/minecraft/server/GenericAttributes.java b/src/main/java/net/minecraft/server/GenericAttributes.java
2016-02-29 22:33:06 +01:00
index 16aaf1a..f43aa57 100644
--- a/src/main/java/net/minecraft/server/GenericAttributes.java
+++ b/src/main/java/net/minecraft/server/GenericAttributes.java
2016-02-29 22:33:06 +01:00
@@ -9,14 +9,16 @@ import org.apache.logging.log4j.Logger;
public class GenericAttributes {
2016-02-29 22:33:06 +01:00
private static final Logger i = LogManager.getLogger();
2015-07-30 09:22:16 +02:00
- public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, 1024.0D)).a("Max Health").a(true);
2014-11-28 02:17:45 +01:00
+ // Spigot start
2016-02-29 22:33:06 +01:00
+ public static final IAttribute maxHealth = (new AttributeRanged((IAttribute) null, "generic.maxHealth", 20.0D, 0.0D, org.spigotmc.SpigotConfig.maxHealth)).a("Max Health").a(true);
2015-05-09 22:23:26 +02:00
public static final IAttribute FOLLOW_RANGE = (new AttributeRanged((IAttribute) null, "generic.followRange", 32.0D, 0.0D, 2048.0D)).a("Follow Range");
2014-11-28 02:17:45 +01:00
public static final IAttribute c = (new AttributeRanged((IAttribute) null, "generic.knockbackResistance", 0.0D, 0.0D, 1.0D)).a("Knockback Resistance");
2015-07-30 09:22:16 +02:00
- public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, 1024.0D)).a("Movement Speed").a(true);
- public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, 2048.0D);
2015-05-09 22:23:26 +02:00
+ public static final IAttribute MOVEMENT_SPEED = (new AttributeRanged((IAttribute) null, "generic.movementSpeed", 0.699999988079071D, 0.0D, org.spigotmc.SpigotConfig.movementSpeed)).a("Movement Speed").a(true);
+ public static final IAttribute ATTACK_DAMAGE = new AttributeRanged((IAttribute) null, "generic.attackDamage", 2.0D, 0.0D, org.spigotmc.SpigotConfig.attackDamage);
2016-02-29 22:33:06 +01:00
public static final IAttribute f = (new AttributeRanged((IAttribute) null, "generic.attackSpeed", 4.0D, 0.0D, 1024.0D)).a(true);
public static final IAttribute g = (new AttributeRanged((IAttribute) null, "generic.armor", 0.0D, 0.0D, 30.0D)).a(true);
public static final IAttribute h = (new AttributeRanged((IAttribute) null, "generic.luck", 0.0D, -1024.0D, 1024.0D)).a(true);
2014-11-28 02:17:45 +01:00
+ // Spigot end
public static NBTTagList a(AttributeMapBase attributemapbase) {
NBTTagList nbttaglist = new NBTTagList();
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 2a23a4e..a187598 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
2014-11-28 02:17:45 +01:00
@@ -14,6 +14,8 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
2014-11-28 02:17:45 +01:00
import gnu.trove.map.hash.TObjectIntHashMap;
+import net.minecraft.server.AttributeRanged;
+import net.minecraft.server.GenericAttributes;
import net.minecraft.server.MinecraftServer;
import org.bukkit.Bukkit;
2014-11-28 02:17:45 +01:00
import org.bukkit.ChatColor;
@@ -346,4 +348,17 @@ public class SpigotConfig
{
movedTooQuicklyThreshold = getDouble( "settings.moved-too-quickly-threshold", 100.0D );
}
+
+ public static double maxHealth = 2048;
+ public static double movementSpeed = 2048;
+ public static double attackDamage = 2048;
+ private static void attributeMaxes()
+ {
+ maxHealth = getDouble( "settings.attribute.maxHealth.max", maxHealth );
+ ( (AttributeRanged) GenericAttributes.maxHealth ).b = maxHealth;
+ movementSpeed = getDouble( "settings.attribute.movementSpeed.max", movementSpeed );
2015-05-09 22:23:26 +02:00
+ ( (AttributeRanged) GenericAttributes.MOVEMENT_SPEED ).b = movementSpeed;
+ attackDamage = getDouble( "settings.attribute.attackDamage.max", attackDamage );
2015-05-09 22:23:26 +02:00
+ ( (AttributeRanged) GenericAttributes.ATTACK_DAMAGE ).b = attackDamage;
+ }
}
--
2016-02-29 22:33:06 +01:00
2.5.0