# 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> <groupId>com.songoda</groupId>
<artifactId>SkyBlock</artifactId> <artifactId>SkyBlock</artifactId>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<version>51</version> <version>52</version>
<build> <build>
<defaultGoal>clean package</defaultGoal> <defaultGoal>clean package</defaultGoal>
<plugins> <plugins>

View File

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

View File

@ -15,6 +15,7 @@ import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; 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.upgrade.UpgradeManager;
import me.goodandevil.skyblock.utils.OfflinePlayer; import me.goodandevil.skyblock.utils.OfflinePlayer;
import me.goodandevil.skyblock.utils.structure.StructureUtil; 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.NMSUtil;
import me.goodandevil.skyblock.utils.version.Sounds; import me.goodandevil.skyblock.utils.version.Sounds;
import me.goodandevil.skyblock.utils.world.LocationUtil; import me.goodandevil.skyblock.utils.world.LocationUtil;
@ -954,8 +956,17 @@ public class IslandManager {
} }
public void removeSpawnProtection(org.bukkit.Location location) { public void removeSpawnProtection(org.bukkit.Location location) {
location.getBlock().setType(Material.AIR); Block block = location.getBlock();
location.clone().add(0.0D, 1.0D, 0.0D).getBlock().setType(Material.AIR);
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) { 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) worldHandle.getClass().getMethod("setTypeAndData", blockPosition.getClass(), IBlockDataClass, int.class)
.invoke(worldHandle, blockPosition, IBlockData, 2); .invoke(worldHandle, blockPosition, IBlockData, 2);
if (NMSUtil.getVersionReleaseNumber() > 1) { try {
chunk.getClass().getMethod("setType", blockPosition.getClass(), IBlockDataClass, boolean.class)
.invoke(chunk, blockPosition, IBlockData, true);
} else {
chunk.getClass().getMethod("a", blockPosition.getClass(), IBlockDataClass, boolean.class) chunk.getClass().getMethod("a", blockPosition.getClass(), IBlockDataClass, boolean.class)
.invoke(chunk, blockPosition, IBlockData, true); .invoke(chunk, blockPosition, IBlockData, true);
} catch (Exception e) {
chunk.getClass().getMethod("setType", blockPosition.getClass(), IBlockDataClass, boolean.class)
.invoke(chunk, blockPosition, IBlockData, true);
} }
} else { } else {
Object IBlockData = NMSUtil.getNMSClass("Block").getMethod("getByCombinedId", int.class).invoke(null, 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." Message: "&bSkyBlock &8| &aInfo&8: &eThe player &c%player &edisconnected and didn't respond to your invite."
Target: Target:
Received: 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: Expired:
Message: "&bSkyBlock &8| &aInfo&8: &eYou didn't respond to &c%player's &einvite in time." Message: "&bSkyBlock &8| &aInfo&8: &eYou didn't respond to &c%player's &einvite in time."
Accept: Accept:

View File

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