fix: command portals are being imported from old files with the wrong name

This commit is contained in:
Sekwah 2024-12-15 01:03:28 +00:00
parent 7f25377d6b
commit 93a7a5f53e
3 changed files with 15 additions and 8 deletions

View File

@ -84,6 +84,9 @@ public class PermissionBuilder {
}
public boolean hasPermission(HasPermission sender) {
if(sender == null) {
return true;
}
if (Permissions.hasPermissionManager) {
return sender.hasPermission(this.toString());
}

View File

@ -16,6 +16,8 @@ import com.sekwah.advancedportals.core.util.Lang;
import com.sekwah.advancedportals.core.util.PlayerUtils;
import com.sekwah.advancedportals.core.warphandler.Tag;
import com.sekwah.advancedportals.core.warphandler.TriggerType;
import javax.annotation.Nullable;
import java.util.*;
@Singleton
@ -152,11 +154,6 @@ public class PortalServices {
return false;
}
public AdvancedPortal createPortal(BlockLocation pos1, BlockLocation pos2,
List<DataTag> tags) {
return createPortal(null, pos1, pos2, tags);
}
public AdvancedPortal createPortal(PlayerContainer player,
ArrayList<DataTag> tags) {
PlayerData tempData = playerDataServices.getPlayerData(player);
@ -180,7 +177,14 @@ public class PortalServices {
tags);
}
public AdvancedPortal createPortal(PlayerContainer player,
/**
* @param player if null it is assumed an automation is creating the portal so checks for permissions are not needed
* @param pos1
* @param pos2
* @param tags
* @return
*/
public AdvancedPortal createPortal(@Nullable PlayerContainer player,
BlockLocation pos1, BlockLocation pos2,
List<DataTag> tags) {
// Find the tag with the "name" NAME

View File

@ -80,7 +80,7 @@ public class LegacyImporter {
}
if (!commands.isEmpty()) {
args.add(
new DataTag("commands", commands.toArray(new String[0])));
new DataTag("command", commands.toArray(new String[0])));
}
args.stream()
.filter(dataTag -> dataTag.NAME.startsWith("command."))
@ -94,7 +94,7 @@ public class LegacyImporter {
args.removeIf(dataTag -> dataTag.NAME.equals("delayed"));
}
var portal = portalServices.createPortal(pos1, pos2, args);
var portal = portalServices.createPortal(null, pos1, pos2, args);
if (portal != null)
count++;