forked from galgotuberz/FlamePaper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
120 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 84e049eee242dcc9363f49688b48047a359622a7 Mon Sep 17 00:00:00 2001 | ||
From c1ccbc7671cb938a24da5b8af22f510249237438 Mon Sep 17 00:00:00 2001 | ||
From: linsaftw <[email protected]> | ||
Date: Sun, 25 Apr 2021 11:53:18 -0300 | ||
Subject: [PATCH] Fix Book Exploits | ||
|
@@ -18,23 +18,25 @@ index e2eb30546..a89d654a8 100644 | |
} | ||
|
||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java | ||
index 0b5ada011..4d85b64e0 100644 | ||
index 0b5ada011..2de6fbb2e 100644 | ||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java | ||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java | ||
@@ -33,8 +33,10 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -33,8 +33,12 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
static final ItemMetaKey BOOK_PAGES = new ItemMetaKey("pages"); | ||
static final ItemMetaKey RESOLVED = new ItemMetaKey("resolved"); | ||
static final ItemMetaKey GENERATION = new ItemMetaKey("generation"); | ||
- static final int MAX_PAGE_LENGTH = Short.MAX_VALUE; // TODO: Check me | ||
- static final int MAX_TITLE_LENGTH = 0xffff; | ||
+ static final int MAX_PAGE_LENGTH = 340; // FlamePaper - Limit max page length to 320 | ||
+ static final int MAX_TITLE_LENGTH = 32; // FlamePaper - Limit max title length to 32 | ||
+ static final int MAX_PAGES = 50; // FlamePaper - Limit pages to 50 | ||
+ static final int MAX_AUTHOR_LENGTH = 16; // FlamePaper - Limit author name length to 16 | ||
+ // FlamePaper start - Fix Book Exploits | ||
+ static final int MAX_PAGE_LENGTH = 340; | ||
+ static final int MAX_TITLE_LENGTH = 32; | ||
+ static final int MAX_PAGES = org.github.paperspigot.PaperSpigotConfig.bookMaxPages; | ||
+ static final int MAX_AUTHOR_LENGTH = 16; | ||
+ // FlamePaper end - Fix Book Exploits | ||
|
||
protected String title; | ||
protected String author; | ||
@@ -61,11 +63,13 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -61,11 +65,13 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
super(tag); | ||
|
||
if (tag.hasKey(BOOK_TITLE.NBT)) { | ||
|
@@ -50,27 +52,27 @@ index 0b5ada011..4d85b64e0 100644 | |
} | ||
|
||
boolean resolved = false; | ||
@@ -80,7 +84,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -80,7 +86,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
if (tag.hasKey(BOOK_PAGES.NBT) && handlePages) { | ||
NBTTagList pages = tag.getList(BOOK_PAGES.NBT, 8); | ||
|
||
- for (int i = 0; i < pages.size(); i++) { | ||
+ // FlamePaper - Apply page limit | ||
+ // FlamePaper - Fix Book Exploits | ||
+ for (int i = 0; i < Math.min(pages.size(), MAX_PAGES); i++) { | ||
String page = pages.getString(i); | ||
if (resolved) { | ||
try { | ||
@@ -90,7 +95,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -90,7 +97,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
// Ignore and treat as an old book | ||
} | ||
} | ||
- addPage( limit( page, 2048 ) ); // Spigot | ||
+ // FlamePaper - Apply page limit | ||
+ // FlamePaper - Fix Book Exploits | ||
+ addPage( limit( page, MAX_PAGE_LENGTH ) ); // Spigot | ||
} | ||
} | ||
} | ||
@@ -104,9 +110,18 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -104,9 +112,18 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
|
||
Iterable<?> pages = SerializableMeta.getObject(Iterable.class, map, BOOK_PAGES.BUKKIT, true); | ||
if(pages != null) { | ||
|
@@ -79,7 +81,7 @@ index 0b5ada011..4d85b64e0 100644 | |
for (Object page : pages) { | ||
- if (page instanceof String) { | ||
- addPage((String) page); | ||
+ // FlamePaper - Limit page iterations | ||
+ // FlamePaper - Fix Book Exploits | ||
+ if (pageCount < MAX_PAGES) { | ||
+ if (page instanceof String) { | ||
+ addPage((String) page); | ||
|
@@ -91,34 +93,34 @@ index 0b5ada011..4d85b64e0 100644 | |
} | ||
} | ||
} | ||
@@ -186,12 +201,12 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -186,12 +203,12 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
public boolean setTitle(final String title) { | ||
if (title == null) { | ||
this.title = null; | ||
- return true; | ||
- } else if (title.length() > MAX_TITLE_LENGTH) { | ||
- return false; | ||
+ } else { | ||
+ // FlamePaper - Simplify & improve title handling | ||
+ // FlamePaper - Fix Book Exploits | ||
+ this.title = title.substring(0, Math.min(title.length(), MAX_PAGE_LENGTH)); | ||
} | ||
|
||
- this.title = title; | ||
+ // FlamePaper - Always return true | ||
+ // FlamePaper - Fix Book Exploits | ||
return true; | ||
} | ||
|
||
@@ -213,7 +228,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -213,7 +230,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
throw new IllegalArgumentException("Invalid page number " + page + "/" + pages.size()); | ||
} | ||
|
||
- String newText = text == null ? "" : text.length() > MAX_PAGE_LENGTH ? text.substring(0, MAX_PAGE_LENGTH) : text; | ||
+ // FlamePaper - Simplify page handling | ||
+ // FlamePaper - Fix Book Exploits | ||
+ String newText = text == null ? "" : text.substring(0, Math.min(text.length(), MAX_PAGE_LENGTH)); | ||
pages.set(page - 1, CraftChatMessage.fromString(newText, true)[0]); | ||
} | ||
|
||
@@ -224,14 +240,22 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -224,14 +242,22 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
} | ||
|
||
public void addPage(final String... pages) { | ||
|
@@ -128,9 +130,9 @@ index 0b5ada011..4d85b64e0 100644 | |
- } else if (page.length() > MAX_PAGE_LENGTH) { | ||
- page = page.substring(0, MAX_PAGE_LENGTH); | ||
- } | ||
+ // FlamePaper - Limit page iterations | ||
+ // FlamePaper - Fix Book Exploits | ||
+ for (int i = 0; i < Math.min(pages.length, MAX_PAGES); i++) { | ||
+ // FlamePaper - Apply page limit | ||
+ // FlamePaper - Fix Book Exploits | ||
+ if (getPageCount() < MAX_PAGES) { | ||
+ String page = pages[i]; | ||
+ | ||
|
@@ -148,18 +150,81 @@ index 0b5ada011..4d85b64e0 100644 | |
} | ||
} | ||
|
||
@@ -257,9 +281,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
@@ -257,9 +283,8 @@ public class CraftMetaBook extends CraftMetaItem implements BookMeta { | ||
|
||
public void setPages(List<String> pages) { | ||
this.pages.clear(); | ||
- for (String page : pages) { | ||
- addPage(page); | ||
- } | ||
+ // FlamePaper - Convert list to array to reuse methods | ||
+ // FlamePaper - Fix Book Exploits | ||
+ addPage(pages.toArray(new String[0])); | ||
} | ||
|
||
private boolean isValidPage(int page) { | ||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
index d6d9899e2..f88deb3fb 100644 | ||
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
@@ -174,52 +174,15 @@ public class PaperSpigotConfig | ||
Bukkit.getLogger().info( "Data value allowed items: " + StringUtils.join(dataValueAllowedItems, ", ") ); | ||
} | ||
|
||
- public static boolean stackableLavaBuckets; | ||
- public static boolean stackableWaterBuckets; | ||
- public static boolean stackableMilkBuckets; | ||
- private static void stackableBuckets() | ||
- { | ||
- stackableLavaBuckets = getBoolean( "stackable-buckets.lava", false ); | ||
- stackableWaterBuckets = getBoolean( "stackable-buckets.water", false ); | ||
- stackableMilkBuckets = getBoolean( "stackable-buckets.milk", false ); | ||
- | ||
- Field maxStack; | ||
- | ||
- try { | ||
- maxStack = Material.class.getDeclaredField("maxStack"); | ||
- maxStack.setAccessible(true); | ||
- | ||
- Field modifiers = Field.class.getDeclaredField("modifiers"); | ||
- modifiers.setAccessible(true); | ||
- modifiers.setInt(maxStack, maxStack.getModifiers() & ~Modifier.FINAL); | ||
- } catch (Exception e) { | ||
- e.printStackTrace(); | ||
- return; | ||
- } | ||
- | ||
- try { | ||
- if (stackableLavaBuckets) { | ||
- maxStack.set(Material.LAVA_BUCKET, Material.BUCKET.getMaxStackSize()); | ||
- Items.LAVA_BUCKET.c(Material.BUCKET.getMaxStackSize()); | ||
- } | ||
- | ||
- if (stackableWaterBuckets) { | ||
- maxStack.set(Material.WATER_BUCKET, Material.BUCKET.getMaxStackSize()); | ||
- Items.WATER_BUCKET.c(Material.BUCKET.getMaxStackSize()); | ||
- } | ||
- | ||
- if (stackableMilkBuckets) { | ||
- maxStack.set(Material.MILK_BUCKET, Material.BUCKET.getMaxStackSize()); | ||
- Items.MILK_BUCKET.c(Material.BUCKET.getMaxStackSize()); | ||
- } | ||
- } catch (Exception e) { | ||
- e.printStackTrace(); | ||
- } | ||
- } | ||
- | ||
public static boolean warnForExcessiveVelocity; | ||
private static void excessiveVelocityWarning() | ||
{ | ||
warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); | ||
} | ||
+ | ||
+ public static int bookMaxPages; | ||
+ private static void bookMaxPages() | ||
+ { | ||
+ bookMaxPages = getInt("book.max_pages", 5); | ||
+ } | ||
} | ||
-- | ||
2.32.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From e3c5d37ed486901ea7726a6b55d1226bda14c092 Mon Sep 17 00:00:00 2001 | ||
From 04c7fc96b73fa9dd9027dad1f00189bdb254caf2 Mon Sep 17 00:00:00 2001 | ||
From: LinsaFTW <[email protected]> | ||
Date: Sat, 26 Jun 2021 11:31:33 -0300 | ||
Subject: [PATCH] Pearl through blocks | ||
|
@@ -42,14 +42,14 @@ index 319c0bc6f..2c94ae15b 100644 | |
this.world.addParticle(EnumParticle.PORTAL, this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian(), new int[0]); | ||
} | ||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
index d6d9899e2..8571cfb34 100644 | ||
index f88deb3fb..de13fb1d5 100644 | ||
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
@@ -222,4 +222,22 @@ public class PaperSpigotConfig | ||
@@ -185,4 +185,22 @@ public class PaperSpigotConfig | ||
{ | ||
warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); | ||
bookMaxPages = getInt("book.max_pages", 5); | ||
} | ||
+ | ||
+ | ||
+ public static boolean pearlPassthroughFenceGate; | ||
+ private static void pearlPassthroughFenceGate() | ||
+ { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From c2d5836532a9a193d98b846190b5cd9d59bb3d63 Mon Sep 17 00:00:00 2001 | ||
From a699055abc1adc128acf0ef149b1a22c53c6d79c Mon Sep 17 00:00:00 2001 | ||
From: LinsaFTW <[email protected]> | ||
Date: Sun, 12 Dec 2021 11:42:48 -0300 | ||
Subject: [PATCH] Customizable knockback | ||
|
@@ -235,13 +235,13 @@ index 000000000..fe8f17470 | |
+} | ||
\ No newline at end of file | ||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
index 8571cfb34..8e228c2aa 100644 | ||
index de13fb1d5..488769244 100644 | ||
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
@@ -223,6 +223,25 @@ public class PaperSpigotConfig | ||
warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); | ||
@@ -186,6 +186,24 @@ public class PaperSpigotConfig | ||
bookMaxPages = getInt("book.max_pages", 5); | ||
} | ||
|
||
+ public static double knockbackFriction; | ||
+ public static double knockbackHorizontal; | ||
+ public static double knockbackVertical; | ||
|
@@ -259,7 +259,6 @@ index 8571cfb34..8e228c2aa 100644 | |
+ knockbackHorizontal, knockbackVertical, knockbackVerticalLimit, knockbackExtraHorizontal, | ||
+ knockbackExtraVertical)); | ||
+ } | ||
+ | ||
+ | ||
public static boolean pearlPassthroughFenceGate; | ||
private static void pearlPassthroughFenceGate() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From 86b86dc81dc1975224c97ddb32b6c8c90f2dc231 Mon Sep 17 00:00:00 2001 | ||
From c9e6d8b1a87f6932b7015ab99d9e2211a28bcadd Mon Sep 17 00:00:00 2001 | ||
From: LinsaFTW <[email protected]> | ||
Date: Sun, 12 Dec 2021 19:09:13 -0300 | ||
Subject: [PATCH] Push based hoppers | ||
|
@@ -278,13 +278,13 @@ index 000000000..aff91a86b | |
+ | ||
+} | ||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
index 8e228c2aa..495618dfa 100644 | ||
index 488769244..85dda6fdc 100644 | ||
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
@@ -223,6 +223,12 @@ public class PaperSpigotConfig | ||
warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); | ||
@@ -186,6 +186,12 @@ public class PaperSpigotConfig | ||
bookMaxPages = getInt("book.max_pages", 5); | ||
} | ||
|
||
+ public static boolean isHopperPushBased; | ||
+ private static void isHopperPushBased() | ||
+ { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From cf3816df9f197dc4278222326d5e7fa31bc16048 Mon Sep 17 00:00:00 2001 | ||
From 4a0fa4b45d9c35adb80be0c2bb80b471561fdd15 Mon Sep 17 00:00:00 2001 | ||
From: LinsaFTW <[email protected]> | ||
Date: Sun, 12 Dec 2021 20:48:26 -0300 | ||
Subject: [PATCH] Disable InventoryMoveItemEvent | ||
|
@@ -102,13 +102,13 @@ index e43cb912c..2ced846b5 100644 | |
public static TileEntityHopper getHopper(World world, BlockPosition pos) { | ||
if (world.getType(pos).getBlock() != Blocks.HOPPER) return null; | ||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
index 495618dfa..37ff6f7cf 100644 | ||
index 85dda6fdc..b23357e01 100644 | ||
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
@@ -223,6 +223,11 @@ public class PaperSpigotConfig | ||
warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); | ||
@@ -186,6 +186,11 @@ public class PaperSpigotConfig | ||
bookMaxPages = getInt("book.max_pages", 5); | ||
} | ||
|
||
+ public static boolean isHopperFireIMIE; | ||
+ private static void isHopperFireIMIE() { | ||
+ isHopperFireIMIE = getBoolean("hopper.fire-inventory-move-item-event", true); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
From d26fda7926f4db7875a77c88e328cb94e855f289 Mon Sep 17 00:00:00 2001 | ||
From 76499e71fb11633ad61d8aecf5f0c9becf23aebc Mon Sep 17 00:00:00 2001 | ||
From: LinsaFTW <[email protected]> | ||
Date: Tue, 15 Mar 2022 09:40:41 -0300 | ||
Subject: [PATCH] Option for map decorators | ||
|
@@ -36,13 +36,13 @@ index 9bf89d503..aa5c772ac 100644 | |
NBTTagList nbttaglist = itemstack.getTag().getList("Decorations", 10); | ||
|
||
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
index 37ff6f7cf..5efdaa568 100644 | ||
index b23357e01..d81055bc7 100644 | ||
--- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java | ||
@@ -223,6 +223,12 @@ public class PaperSpigotConfig | ||
warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); | ||
@@ -186,6 +186,12 @@ public class PaperSpigotConfig | ||
bookMaxPages = getInt("book.max_pages", 5); | ||
} | ||
|
||
+ public static boolean allowMapDecorations; | ||
+ private static void allowMapDecorations() | ||
+ { | ||
|
Oops, something went wrong.