mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-04-22 11:18:15 +02:00
43/103 rejected minecraft source files applied
(idk what i was counting in the previous commit...)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/commands/EnchantCommand.java
|
||||
+++ b/net/minecraft/server/commands/EnchantCommand.java
|
||||
@@ -67,7 +_,7 @@
|
||||
final CommandSourceStack source, final Collection<? extends Entity> targets, final Holder<Enchantment> enchantmentHolder, final int level
|
||||
) throws CommandSyntaxException {
|
||||
Enchantment enchantment = enchantmentHolder.value();
|
||||
- if (level > enchantment.getMaxLevel()) {
|
||||
+ if (!org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchantCommand && level > enchantment.getMaxLevel()) { // Purpur - Config to allow unsafe enchants
|
||||
throw ERROR_LEVEL_TOO_HIGH.create(level, enchantment.getMaxLevel());
|
||||
} else {
|
||||
int success = 0;
|
||||
@@ -77,7 +_,7 @@
|
||||
ItemStack item = target.getMainHandItem();
|
||||
if (!item.isEmpty()) {
|
||||
if (enchantment.canEnchant(item)
|
||||
- && EnchantmentHelper.isEnchantmentCompatible(EnchantmentHelper.getEnchantmentsForCrafting(item).keySet(), enchantmentHolder)) {
|
||||
+ && EnchantmentHelper.isEnchantmentCompatible(EnchantmentHelper.getEnchantmentsForCrafting(item).keySet(), enchantmentHolder) || (org.purpurmc.purpur.PurpurConfig.allowUnsafeEnchantCommand && !mainHandItem.hasEnchantment(enchantment))) { // Purpur - Config to allow unsafe enchants
|
||||
item.enchant(enchantmentHolder, level);
|
||||
success++;
|
||||
} else if (targets.size() == 1) {
|
||||
@@ -0,0 +1,21 @@
|
||||
--- a/net/minecraft/server/commands/GameModeCommand.java
|
||||
+++ b/net/minecraft/server/commands/GameModeCommand.java
|
||||
@@ -47,6 +_,18 @@
|
||||
}
|
||||
|
||||
private static int setMode(final CommandContext<CommandSourceStack> context, final Collection<ServerPlayer> players, final GameType type) {
|
||||
+ // Purpur start - Gamemode extra permissions
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.commandGamemodeRequiresPermission) {
|
||||
+ String gamemode = type.getName();
|
||||
+ CommandSourceStack sender = context.getSource();
|
||||
+ if (!sender.testPermission(Permissions.COMMANDS_GAMEMASTER, "minecraft.command.gamemode." + gamemode)) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ if (sender.getEntity() instanceof ServerPlayer player && (players.size() > 1 || !players.contains(player)) && !sender.testPermission(Permissions.COMMANDS_GAMEMASTER, "minecraft.command.gamemode." + gamemode + ".other")) {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end - Gamemode extra permissions
|
||||
int count = 0;
|
||||
|
||||
for (ServerPlayer player : players) {
|
||||
@@ -0,0 +1,10 @@
|
||||
--- a/net/minecraft/server/commands/GiveCommand.java
|
||||
+++ b/net/minecraft/server/commands/GiveCommand.java
|
||||
@@ -61,6 +_,7 @@
|
||||
remaining -= size;
|
||||
ItemStack copyToDrop = prototypeItemStack.copyWithCount(size);
|
||||
boolean added = player.getInventory().add(copyToDrop);
|
||||
+ if (org.purpurmc.purpur.PurpurConfig.disableGiveCommandDrops) continue; // Purpur - add config option for toggling give command dropping
|
||||
if (added && copyToDrop.isEmpty()) {
|
||||
ItemEntity drop = player.drop(prototypeItemStack.copy(), false, false, false, null); // Paper - do not fire PlayerDropItemEvent for /give command
|
||||
if (drop != null) {
|
||||
Reference in New Issue
Block a user