# Fixed removal of spawn protection at an island causing a 1.13 server to crash.
# Fixed invitation message not creating a new line when using the string '\n'.
# Fixed NSME when pasting a structure on island creation for 1.13.1 servers.
This commit is contained in:
SystemEncryption 2018-12-16 21:22:11 +00:00
parent 70e7bef250
commit 55dc3e783d
6 changed files with 79 additions and 52 deletions

View File

@ -2,7 +2,7 @@
<groupId>com.songoda</groupId>
<artifactId>SkyBlock</artifactId>
<modelVersion>4.0.0</modelVersion>
<version>51</version>
<version>52</version>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>

View File

@ -142,7 +142,7 @@ public class InviteCommand extends SubCommand {
for (String messageList : message.split("\n")) {
chatComponent
.addExtraChatComponent(
.addExtra(
new ChatComponent(
messageManager.replaceMessage(player,
messageList
@ -158,7 +158,7 @@ public class InviteCommand extends SubCommand {
}
} else {
chatComponent
.addExtraChatComponent(new ChatComponent(
.addExtra(new ChatComponent(
messageManager.replaceMessage(player,
message.replace("%player",
targetPlayer.getName())
@ -168,7 +168,7 @@ public class InviteCommand extends SubCommand {
if (cancellationMessages.length == 1
|| i + 1 != cancellationMessages.length) {
chatComponent.addExtraChatComponent(new ChatComponent(
chatComponent.addExtra(new ChatComponent(
configLoad
.getString("Command.Island.Invite.Invited.Word.Cancel")
.toUpperCase(),
@ -194,46 +194,62 @@ public class InviteCommand extends SubCommand {
.replace("%player", targetPlayer.getName()).replace("%time", timeMessage));
}
targetPlayer.spigot().sendMessage(new ChatComponent(messageManager.replaceMessage(
targetPlayer,
ChatColor.translateAlternateColorCodes('&', configLoad
.getString("Command.Island.Invite.Invited.Target.Received.Message")
.replace("%player", player.getName()).replace("%time", timeMessage)
+ " ")),
false, null, null, null)
.addExtraChatComponent(new ChatComponent(
configLoad.getString(
"Command.Island.Invite.Invited.Word.Accept")
.toUpperCase(),
true, ChatColor.GREEN,
new ClickEvent(ClickEvent.Action.RUN_COMMAND,
"/island accept " + player.getName()),
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder(ChatColor
.translateAlternateColorCodes('&', configLoad
.getString(
"Command.Island.Invite.Invited.Word.Tutorial")
.replace("%action",
configLoad.getString(
"Command.Island.Invite.Invited.Word.Accept"))))
.create())))
.addExtraChatComponent(new ChatComponent(" | ", false,
ChatColor.DARK_GRAY, null, null))
.addExtra(new ChatComponent(
configLoad.getString("Command.Island.Invite.Invited.Word.Deny")
.toUpperCase(),
true, ChatColor.RED,
new ClickEvent(ClickEvent.Action.RUN_COMMAND,
"/island deny " + player.getName()),
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
new ComponentBuilder(ChatColor
.translateAlternateColorCodes('&', configLoad
.getString(
"Command.Island.Invite.Invited.Word.Tutorial")
.replace("%action",
configLoad.getString(
"Command.Island.Invite.Invited.Word.Deny"))))
.create()))));
String invitationMessage = configLoad
.getString("Command.Island.Invite.Invited.Target.Received.Message");
ChatComponent chatComponent = new ChatComponent("", false, null, null, null);
if (invitationMessage.contains("\n") || invitationMessage.contains("\\n")) {
invitationMessage = invitationMessage.replace("\\n", "\n");
for (String messageList : invitationMessage.split("\n")) {
chatComponent.addExtra(new ChatComponent(
messageManager.replaceMessage(player,
messageList.replace("%player", player.getName())
.replace("%time", timeMessage)),
false, null, null, null));
chatComponent.addExtra(
new TextComponent(ComponentSerializer.parse("{text: \"\n\"}")));
}
} else {
chatComponent
.addExtra(new ChatComponent(
messageManager.replaceMessage(player,
invitationMessage.replace("%player", player.getName())
.replace("%time", timeMessage)),
false, null, null, null));
}
chatComponent.addExtra(new ChatComponent(
configLoad.getString("Command.Island.Invite.Invited.Word.Accept").toUpperCase(),
true, ChatColor.GREEN,
new ClickEvent(ClickEvent.Action.RUN_COMMAND,
"/island accept " + player.getName()),
new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
ChatColor.translateAlternateColorCodes('&', configLoad
.getString("Command.Island.Invite.Invited.Word.Tutorial")
.replace("%action",
configLoad.getString(
"Command.Island.Invite.Invited.Word.Accept"))))
.create())));
chatComponent
.addExtra(new ChatComponent(" | ", false, ChatColor.DARK_GRAY, null, null));
chatComponent.addExtra(new ChatComponent(
configLoad.getString("Command.Island.Invite.Invited.Word.Deny").toUpperCase(),
true, ChatColor.RED,
new ClickEvent(ClickEvent.Action.RUN_COMMAND,
"/island deny " + player.getName()),
new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder(
ChatColor.translateAlternateColorCodes('&', configLoad
.getString("Command.Island.Invite.Invited.Word.Tutorial")
.replace("%action",
configLoad.getString(
"Command.Island.Invite.Invited.Word.Deny"))))
.create())));
targetPlayer.spigot().sendMessage(chatComponent.getTextComponent());
Invite invite = skyblock.getInviteManager().createInvite(targetPlayer, player,
island.getOwnerUUID(), respondTime);

View File

@ -15,6 +15,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
@ -46,6 +47,7 @@ import me.goodandevil.skyblock.upgrade.Upgrade;
import me.goodandevil.skyblock.upgrade.UpgradeManager;
import me.goodandevil.skyblock.utils.OfflinePlayer;
import me.goodandevil.skyblock.utils.structure.StructureUtil;
import me.goodandevil.skyblock.utils.version.Materials;
import me.goodandevil.skyblock.utils.version.NMSUtil;
import me.goodandevil.skyblock.utils.version.Sounds;
import me.goodandevil.skyblock.utils.world.LocationUtil;
@ -954,8 +956,17 @@ public class IslandManager {
}
public void removeSpawnProtection(org.bukkit.Location location) {
location.getBlock().setType(Material.AIR);
location.clone().add(0.0D, 1.0D, 0.0D).getBlock().setType(Material.AIR);
Block block = location.getBlock();
if (block.getType() == Materials.MOVING_PISTON.parseMaterial()) {
block.setType(Material.AIR);
}
block = location.clone().add(0.0D, 1.0D, 0.0D).getBlock();
if (block.getType() == Materials.MOVING_PISTON.parseMaterial()) {
block.setType(Material.AIR);
}
}
public Set<UUID> getMembersOnline(Island island) {

View File

@ -542,12 +542,12 @@ public final class BlockUtil {
worldHandle.getClass().getMethod("setTypeAndData", blockPosition.getClass(), IBlockDataClass, int.class)
.invoke(worldHandle, blockPosition, IBlockData, 2);
if (NMSUtil.getVersionReleaseNumber() > 1) {
chunk.getClass().getMethod("setType", blockPosition.getClass(), IBlockDataClass, boolean.class)
.invoke(chunk, blockPosition, IBlockData, true);
} else {
try {
chunk.getClass().getMethod("a", blockPosition.getClass(), IBlockDataClass, boolean.class)
.invoke(chunk, blockPosition, IBlockData, true);
} catch (Exception e) {
chunk.getClass().getMethod("setType", blockPosition.getClass(), IBlockDataClass, boolean.class)
.invoke(chunk, blockPosition, IBlockData, true);
}
} else {
Object IBlockData = NMSUtil.getNMSClass("Block").getMethod("getByCombinedId", int.class).invoke(null,

View File

@ -166,7 +166,7 @@ Command:
Message: "&bSkyBlock &8| &aInfo&8: &eThe player &c%player &edisconnected and didn't respond to your invite."
Target:
Received:
Message: "&bSkyBlock &8| &aInfo&8: &eYou have been invited to join &d%player's &eIsland. You have &c%time &eto respond."
Message: "&bSkyBlock &8| &aInfo&8: &eYou have been invited to join &d%player's &eIsland. You have &c%time &eto respond. "
Expired:
Message: "&bSkyBlock &8| &aInfo&8: &eYou didn't respond to &c%player's &einvite in time."
Accept:

View File

@ -1,6 +1,6 @@
name: SkyBlock
main: me.goodandevil.skyblock.SkyBlock
version: 51
version: 52
api-version: 1.13
description: A unique SkyBlock plugin
author: GoodAndEvil