Skip to content

Commit

Permalink
Partial fix for #156
Browse files Browse the repository at this point in the history
  • Loading branch information
Flo56958 committed Dec 23, 2020
1 parent 182748c commit 8148650
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package de.flo56958.minetinker.commands;

import de.flo56958.minetinker.api.SubCommand;
import de.flo56958.minetinker.commands.subs.*;
import de.flo56958.minetinker.modifiers.ModManager;
import de.flo56958.minetinker.modifiers.Modifier;
import de.flo56958.minetinker.utils.ChatWriter;
import de.flo56958.minetinker.utils.LanguageManager;
import de.flo56958.minetinker.api.SubCommand;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.World;
Expand Down Expand Up @@ -238,7 +238,8 @@ private void parseArguments(@NotNull CommandSender sender, @NotNull SubCommand s
Player player = Bukkit.getPlayer(uuid);
if (player != null) args[i] = player.getName();
else {
sendError(sender, LanguageManager.getString("Commands.Failure.Cause.PlayerNotFound")
sendError(sender,
LanguageManager.getString("Commands.Failure.Cause.PlayerNotFound")
.replace("%p", args[i]));
}
} catch (IllegalArgumentException ignored) {
Expand Down Expand Up @@ -283,7 +284,8 @@ private void parseArguments(@NotNull CommandSender sender, @NotNull SubCommand s
}

public static void sendError(CommandSender sender, String cause) {
ChatWriter.sendMessage(sender, ChatColor.RED, LanguageManager.getString("Commands.Failure.Main")
ChatWriter.sendMessage(sender, ChatColor.RED,
LanguageManager.getString("Commands.Failure.Main")
.replaceAll("%cause", cause));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ private boolean placeBlock(@NotNull final Block b, @NotNull final Player player,
}
}

nb.setType(item.getType());
nb.setType(item.getType(), true); //incl. physics update
final BlockData bd = nb.getBlockData();

if (bd instanceof Directional) {
Expand All @@ -521,7 +521,14 @@ private boolean placeBlock(@NotNull final Block b, @NotNull final Player player,
((Slab) bd).setType(((Slab) behind.getBlockData()).getType());
}

nb.setBlockData(bd);
nb.setBlockData(bd, true); //incl. physics update

//Update the block behind (for Physics Calculation of the current block)
//to counteract bugged blockstates (e.g. flying torches)
behind.setType(item.getType(), true);
behind.setBlockData(behind.getBlockData(), true);

//TODO: some bugged blockstates still get through

return true;
}
Expand Down

0 comments on commit 8148650

Please sign in to comment.