Updates Stargate for Spigot 1.19
Some checks failed
EpicKnarvik97/Stargate/pipeline/head There was a failure building this commit

This commit is contained in:
Kristian Knarvik 2022-06-17 12:40:15 +02:00
parent 92f452df00
commit 92c3eadf8f
8 changed files with 24 additions and 21 deletions

View File

@ -28,7 +28,7 @@ version of Stargate compliant with Spigot 1.17, even if it means changing the en
## License ## License
Stargate is licensed under the GNU Lesser General Public License Version 3.0. This includes every source and resource Stargate is licensed under the GNU Lesser General Public License Version 3.0. This includes every source and resource
file. See the HEADER file for a more detailed license description. file. See the HEADER file for a more detailed license description.
## Migration ## Migration

View File

@ -4,7 +4,7 @@
<groupId>net.knarcraft</groupId> <groupId>net.knarcraft</groupId>
<artifactId>Stargate</artifactId> <artifactId>Stargate</artifactId>
<version>0.9.3.7</version> <version>0.9.4.0</version>
<licenses> <licenses>
<license> <license>
@ -34,7 +34,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.18.1-R0.1-SNAPSHOT</version> <version>1.19-R0.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>net.milkbowl.vault</groupId> <groupId>net.milkbowl.vault</groupId>

View File

@ -8,7 +8,6 @@ import net.knarcraft.stargate.portal.Portal;
import net.knarcraft.stargate.portal.PortalRegistry; import net.knarcraft.stargate.portal.PortalRegistry;
import net.knarcraft.stargate.portal.PortalSignDrawer; import net.knarcraft.stargate.portal.PortalSignDrawer;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.apache.commons.lang.StringUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
@ -416,7 +415,7 @@ public class CommandConfig implements CommandExecutor {
Object defaultValue = option.getDefaultValue(); Object defaultValue = option.getDefaultValue();
String stringValue = String.valueOf(defaultValue); String stringValue = String.valueOf(defaultValue);
if (option.getDataType() == OptionDataType.STRING_LIST) { if (option.getDataType() == OptionDataType.STRING_LIST) {
stringValue = "[" + StringUtils.join((String[]) defaultValue, ",") + "]"; stringValue = "[" + String.join(",", (String[]) defaultValue) + "]";
} }
return ChatColor.GOLD + option.getName() + ChatColor.WHITE + " - " + ChatColor.GREEN + option.getDescription() + return ChatColor.GOLD + option.getName() + ChatColor.WHITE + " - " + ChatColor.GREEN + option.getDescription() +
ChatColor.DARK_GRAY + " (Default: " + ChatColor.GRAY + stringValue + ChatColor.DARK_GRAY + ")"; ChatColor.DARK_GRAY + " (Default: " + ChatColor.GRAY + stringValue + ChatColor.DARK_GRAY + ")";

View File

@ -2,12 +2,13 @@ package net.knarcraft.stargate.command;
import net.knarcraft.stargate.Stargate; import net.knarcraft.stargate.Stargate;
import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatColor;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
/** /**
* This command represents any command which starts with stargate * This command represents any command which starts with stargate
* *
@ -25,7 +26,7 @@ public class CommandStarGate implements CommandExecutor {
} else if (args[0].equalsIgnoreCase("reload")) { } else if (args[0].equalsIgnoreCase("reload")) {
return new CommandReload().onCommand(commandSender, command, s, args); return new CommandReload().onCommand(commandSender, command, s, args);
} else if (args[0].equalsIgnoreCase("config")) { } else if (args[0].equalsIgnoreCase("config")) {
String[] subArgs = (String[]) ArrayUtils.remove(args, 0); String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
return new CommandConfig().onCommand(commandSender, command, s, subArgs); return new CommandConfig().onCommand(commandSender, command, s, subArgs);
} }
return false; return false;

View File

@ -1,6 +1,5 @@
package net.knarcraft.stargate.command; package net.knarcraft.stargate.command;
import org.apache.commons.lang.ArrayUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter; import org.bukkit.command.TabCompleter;
@ -9,6 +8,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@ -29,7 +29,7 @@ public class StarGateTabCompleter implements TabCompleter {
} }
return matchingCommands; return matchingCommands;
} else if (args.length > 1 && args[0].equalsIgnoreCase("config")) { } else if (args.length > 1 && args[0].equalsIgnoreCase("config")) {
String[] subArgs = (String[]) ArrayUtils.remove(args, 0); String[] subArgs = Arrays.copyOfRange(args, 1, args.length);
return new ConfigTabCompleter().onTabComplete(commandSender, command, s, subArgs); return new ConfigTabCompleter().onTabComplete(commandSender, command, s, subArgs);
} else { } else {
return new ArrayList<>(); return new ArrayList<>();

View File

@ -230,11 +230,14 @@ public class PlayerEventListener implements Listener {
EquipmentSlot hand = event.getHand(); EquipmentSlot hand = event.getHand();
if (hand != null && (PermissionHelper.hasPermission(player, "stargate.admin.dye") || if (hand != null && (PermissionHelper.hasPermission(player, "stargate.admin.dye") ||
portal.isOwner(player))) { portal.isOwner(player))) {
String itemName = player.getInventory().getItem(hand).getType().toString(); ItemStack item = player.getInventory().getItem(hand);
if (itemName.endsWith("DYE") || itemName.endsWith("INK_SAC")) { if (item != null) {
event.setUseInteractedBlock(Event.Result.ALLOW); String itemName = item.getType().toString();
Bukkit.getScheduler().scheduleSyncDelayedTask(Stargate.getInstance(), portal::drawSign, 1); if (itemName.endsWith("DYE") || itemName.endsWith("INK_SAC")) {
return; event.setUseInteractedBlock(Event.Result.ALLOW);
Bukkit.getScheduler().scheduleSyncDelayedTask(Stargate.getInstance(), portal::drawSign, 1);
return;
}
} }
} }
@ -325,7 +328,7 @@ public class PlayerEventListener implements Listener {
} else { } else {
//Display information about the portal if it has no sign //Display information about the portal if it has no sign
ItemStack heldItem = player.getInventory().getItem(hand); ItemStack heldItem = player.getInventory().getItem(hand);
if (heldItem.getType().isAir() || !heldItem.getType().isBlock()) { if (heldItem != null && (heldItem.getType().isAir() || !heldItem.getType().isBlock())) {
displayPortalInfo(block, player); displayPortalInfo(block, player);
} }
} }

View File

@ -57,9 +57,9 @@ gates:
# enableCraftBookRemoveOnEjectFix - Whether to enable a fix that causes loss of NBT data, but allows vehicle teleportation to work when CraftBook's remove minecart/boat on eject setting is enabled # enableCraftBookRemoveOnEjectFix - Whether to enable a fix that causes loss of NBT data, but allows vehicle teleportation to work when CraftBook's remove minecart/boat on eject setting is enabled
enableCraftBookRemoveOnEjectFix: false enableCraftBookRemoveOnEjectFix: false
# I------------I-------------I # #############################
# stargate economy options # # stargate economy options #
# I------------I-------------I # ############################
economy: economy:
# useEconomy - Whether to use an economy plugin # useEconomy - Whether to use an economy plugin
useEconomy: false useEconomy: false
@ -78,9 +78,9 @@ economy:
# freeGatesColor - The color to use for marking free gates # freeGatesColor - The color to use for marking free gates
freeGatesColor: DARK_GREEN freeGatesColor: DARK_GREEN
# I-------I-------I # #################
# Debug options # # Debug options #
# I-------I-------I # #################
debugging: debugging:
# debug - Debug -- Only enable if you have issues, massive console output # debug - Debug -- Only enable if you have issues, massive console output
debug: false debug: false

View File

@ -1,11 +1,11 @@
name: Stargate name: Stargate
main: net.knarcraft.stargate.Stargate main: net.knarcraft.stargate.Stargate
version: 0.9.3.7 version: 0.9.4.0
description: Stargate mod for Bukkit Revived description: Stargate mod for Bukkit Revived
author: EpicKnarvik97 author: EpicKnarvik97
authors: [ Drakia, PseudoKnight, EpicKnarvik97 ] authors: [ Drakia, PseudoKnight, EpicKnarvik97 ]
website: https://git.knarcraft.net/EpicKnarvik97/Stargate website: https://git.knarcraft.net/EpicKnarvik97/Stargate
api-version: 1.18 api-version: 1.19
softdepend: [ Vault ] softdepend: [ Vault ]
commands: commands:
stargate: stargate: