mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-10-31 01:23:44 +01:00 
			
		
		
		
	Compare commits
	
		
			7 Commits
		
	
	
		
			6.3.0
			...
			fix/v6/nul
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 4c166d057e | ||
|   | 827f46566c | ||
|   | 6f4d2f6d5a | ||
|   | 6073b96317 | ||
| ![renovate[bot]](/assets/img/avatar_default.png)  | 74a490f9f0 | ||
|   | 3a752db698 | ||
|   | 7cdde5a822 | 
							
								
								
									
										2
									
								
								.github/workflows/release-drafter.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/release-drafter.yml
									
									
									
									
										vendored
									
									
								
							| @@ -13,6 +13,6 @@ jobs: | ||||
|   update_release_draft: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: release-drafter/release-drafter@v5.15.0 | ||||
|       - uses: release-drafter/release-drafter@v5.17.5 | ||||
|         env: | ||||
|           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|   | ||||
							
								
								
									
										4
									
								
								.lift.toml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								.lift.toml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| jdkVersion = "17" | ||||
| build = "gradle clean build -x test" | ||||
| tools = ["findsecbugs", "ErrorProne", "Semgrep", "Detekt", "Infer"] | ||||
| ignoreRules = ["CatchAndPrintStackTrace", "ReferenceEquality", "FallThrough", "FutureReturnValueIgnored", "MixedMutabilityReturnType", "EmptyCatch", "MissingCasesInEnumSwitch", "OperatorPrecedence", "StaticAssignmentInConstructor", "ReferenceEquality", "EqualsHashCode", "EqualsGetClass", "TypeParameterUnusedInFormals"] | ||||
| @@ -218,6 +218,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl | ||||
|     private PlatformWorldManager<World> worldManager; | ||||
|     private Locale serverLocale; | ||||
|  | ||||
|     @SuppressWarnings("StringSplitter") | ||||
|     @Override | ||||
|     public int @NonNull [] serverVersion() { | ||||
|         if (this.version == null) { | ||||
| @@ -970,7 +971,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl | ||||
|                                                 } | ||||
|                                                 iterator.remove(); | ||||
|                                                 entity.remove(); | ||||
|                                                 continue; | ||||
|                                             } | ||||
|                                         } | ||||
|                                     } else { | ||||
| @@ -982,7 +982,6 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl | ||||
|                                             } | ||||
|                                             iterator.remove(); | ||||
|                                             entity.remove(); | ||||
|                                             continue; | ||||
|                                         } | ||||
|                                     } | ||||
|                                 } | ||||
| @@ -1223,7 +1222,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl | ||||
|  | ||||
|     @Override | ||||
|     @NonNull | ||||
|     @SuppressWarnings("ALL") | ||||
|     @SuppressWarnings("unchecked") | ||||
|     public PlayerManager<? extends PlotPlayer<Player>, ? extends Player> playerManager() { | ||||
|         return (PlayerManager<BukkitPlayer, Player>) injector().getInstance(PlayerManager.class); | ||||
|     } | ||||
|   | ||||
| @@ -461,6 +461,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { | ||||
|         this.tamed.tamed = tamed.isTamed(); | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("deprecation") // Paper deprecation | ||||
|     @Override | ||||
|     public Entity spawn(World world, int xOffset, int zOffset) { | ||||
|         Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset); | ||||
|   | ||||
| @@ -36,6 +36,7 @@ import org.bukkit.World; | ||||
|  | ||||
| public class WorldManagerModule extends AbstractModule { | ||||
|  | ||||
|     @SuppressWarnings("removal") // Internal use only | ||||
|     @Provides | ||||
|     @Singleton | ||||
|     PlatformWorldManager<World> provideWorldManager() { | ||||
|   | ||||
| @@ -36,7 +36,6 @@ import com.plotsquared.core.plot.world.PlotAreaManager; | ||||
| import net.kyori.adventure.text.minimessage.Template; | ||||
| import org.bukkit.block.Banner; | ||||
| import org.bukkit.block.Beacon; | ||||
| import org.bukkit.block.Bed; | ||||
| import org.bukkit.block.BlockState; | ||||
| import org.bukkit.block.CommandBlock; | ||||
| import org.bukkit.block.Comparator; | ||||
| @@ -51,6 +50,7 @@ import org.bukkit.block.Jukebox; | ||||
| import org.bukkit.block.Sign; | ||||
| import org.bukkit.block.Skull; | ||||
| import org.bukkit.block.Structure; | ||||
| import org.bukkit.block.data.type.Bed; | ||||
| import org.bukkit.event.EventHandler; | ||||
| import org.bukkit.event.block.BlockPlaceEvent; | ||||
| import org.checkerframework.checker.nullness.qual.NonNull; | ||||
|   | ||||
| @@ -154,7 +154,6 @@ import org.checkerframework.checker.nullness.qual.NonNull; | ||||
|  | ||||
| import java.lang.reflect.Field; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.HashSet; | ||||
| import java.util.List; | ||||
| import java.util.Locale; | ||||
| @@ -224,6 +223,7 @@ public class PlayerEventListener extends PlotListener implements Listener { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("StringSplitter") | ||||
|     @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) | ||||
|     public void playerCommand(PlayerCommandPreprocessEvent event) { | ||||
|         String msg = event.getMessage().toLowerCase().replaceAll("/", "").trim(); | ||||
| @@ -379,6 +379,7 @@ public class PlayerEventListener extends PlotListener implements Listener { | ||||
|         this.eventDispatcher.doRespawnTask(pp); | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("deprecation") // We explicitly want #getHomeSynchronous here | ||||
|     @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) | ||||
|     public void onTeleport(PlayerTeleportEvent event) { | ||||
|         Player player = event.getPlayer(); | ||||
| @@ -1063,9 +1064,13 @@ public class PlayerEventListener extends PlotListener implements Listener { | ||||
|         if (area == null) { | ||||
|             return; | ||||
|         } | ||||
|         PlayerBlockEventType eventType = null; | ||||
|         PlayerBlockEventType eventType; | ||||
|         BlockType blocktype1; | ||||
|         Block block = event.getClickedBlock(); | ||||
|         if (block == null) { | ||||
|             // We do not care in this case, the player is likely interacting with air ("nothing"). | ||||
|             return; | ||||
|         } | ||||
|         Location location = BukkitUtil.adapt(block.getLocation()); | ||||
|         Action action = event.getAction(); | ||||
|         switch (action) { | ||||
| @@ -1667,6 +1672,7 @@ public class PlayerEventListener extends PlotListener implements Listener { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("deprecation") // #getLocate is needed for Spigot compatibility | ||||
|     @EventHandler | ||||
|     public void onLocaleChange(final PlayerLocaleChangeEvent event) { | ||||
|         // The event is fired before the player is deemed online upon login | ||||
|   | ||||
| @@ -43,7 +43,6 @@ import java.lang.reflect.Method; | ||||
|  | ||||
| import static com.plotsquared.core.util.ReflectionUtils.getRefClass; | ||||
|  | ||||
| @SuppressWarnings("unused") | ||||
| public class SingleWorldListener implements Listener { | ||||
|  | ||||
|     private final Method methodGetHandleChunk; | ||||
|   | ||||
| @@ -162,6 +162,7 @@ public class BukkitPlayer extends PlotPlayer<Player> { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("StringSplitter") | ||||
|     @Override | ||||
|     @NonNegative | ||||
|     public int hasPermissionRange( | ||||
| @@ -319,7 +320,7 @@ public class BukkitPlayer extends PlotPlayer<Player> { | ||||
|         if (id == ItemTypes.AIR) { | ||||
|             // Let's just stop all the discs because why not? | ||||
|             for (final Sound sound : Arrays.stream(Sound.values()) | ||||
|                     .filter(sound -> sound.name().contains("DISC")).collect(Collectors.toList())) { | ||||
|                     .filter(sound -> sound.name().contains("DISC")).toList()) { | ||||
|                 player.stopSound(sound); | ||||
|             } | ||||
|             // this.player.playEffect(BukkitUtil.getLocation(location), Effect.RECORD_PLAY, Material.AIR); | ||||
| @@ -331,6 +332,7 @@ public class BukkitPlayer extends PlotPlayer<Player> { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("deprecation") // Needed for Spigot compatibility | ||||
|     @Override | ||||
|     public void kick(final String message) { | ||||
|         this.player.kickPlayer(message); | ||||
|   | ||||
| @@ -199,7 +199,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { | ||||
|                     } | ||||
|                 } | ||||
|                 if (localChunk.getTiles().size() > 0) { | ||||
|                     localChunk.getTiles().forEach(((blockVector3, tag) -> { | ||||
|                     localChunk.getTiles().forEach((blockVector3, tag) -> { | ||||
|                         try { | ||||
|                             BaseBlock block = getWorld().getBlock(blockVector3).toBaseBlock(tag); | ||||
|                             getWorld().setBlock(blockVector3, block, noSideEffectSet); | ||||
| @@ -207,7 +207,7 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator { | ||||
|                             StateWrapper sw = new StateWrapper(tag); | ||||
|                             sw.restoreTag(getWorld().getName(), blockVector3.getX(), blockVector3.getY(), blockVector3.getZ()); | ||||
|                         } | ||||
|                     })); | ||||
|                     }); | ||||
|                 } | ||||
|                 if (localChunk.getEntities().size() > 0) { | ||||
|                     localChunk.getEntities().forEach((location, entity) -> getWorld().createEntity(location, entity)); | ||||
|   | ||||
| @@ -166,6 +166,7 @@ public class StateWrapper { | ||||
|         return str; | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("deprecation") // #setLine is needed for Spigot compatibility | ||||
|     public boolean restoreTag(String worldName, int x, int y, int z) { | ||||
|         if (this.tag == null) { | ||||
|             return false; | ||||
|   | ||||
| @@ -77,6 +77,7 @@ public class BukkitInventoryUtil extends InventoryUtil { | ||||
|         return stack; | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("deprecation") // Paper deprecation | ||||
|     @Override | ||||
|     public void open(PlotInventory inv) { | ||||
|         BukkitPlayer bp = (BukkitPlayer) inv.getPlayer(); | ||||
| @@ -113,6 +114,7 @@ public class BukkitInventoryUtil extends InventoryUtil { | ||||
|         bp.player.updateInventory(); | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("deprecation") // Paper deprecation | ||||
|     public PlotItemStack getItem(ItemStack item) { | ||||
|         if (item == null) { | ||||
|             return null; | ||||
| @@ -145,6 +147,7 @@ public class BukkitInventoryUtil extends InventoryUtil { | ||||
|                 .toArray(PlotItemStack[]::new); | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("deprecation") // #getTitle is needed for Spigot compatibility | ||||
|     @Override | ||||
|     public boolean isOpen(PlotInventory plotInventory) { | ||||
|         if (!plotInventory.isOpen()) { | ||||
|   | ||||
| @@ -61,6 +61,7 @@ public class UpdateUtility implements Listener { | ||||
|         internalVersion = PlotSquared.get().getVersion(); | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings({"deprecation", "DefaultCharset"}) // Suppress Json deprecation, we can't use features from gson 2.8.1 and newer yet | ||||
|     public void updateChecker() { | ||||
|         task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.javaPlugin, () -> { | ||||
|             try { | ||||
| @@ -68,7 +69,7 @@ public class UpdateUtility implements Listener { | ||||
|                         "https://api.spigotmc.org/simple/0.1/index.php?action=getResource&id=77506") | ||||
|                         .openConnection(); | ||||
|                 connection.setRequestMethod("GET"); | ||||
|                 JsonObject result = (new JsonParser()) | ||||
|                 JsonObject result = new JsonParser() | ||||
|                         .parse(new JsonReader(new InputStreamReader(connection.getInputStream()))) | ||||
|                         .getAsJsonObject(); | ||||
|                 spigotVersion = result.get("current_version").getAsString(); | ||||
| @@ -91,7 +92,7 @@ public class UpdateUtility implements Listener { | ||||
|                 notify = false; | ||||
|                 LOGGER.info("Congratulations! You are running the latest PlotSquared version"); | ||||
|             } | ||||
|         }, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20); | ||||
|         }, 0L, (long) Settings.UpdateChecker.POLL_RATE * 60 * 20); | ||||
|     } | ||||
|  | ||||
|     private void cancelTask() { | ||||
|   | ||||
| @@ -75,6 +75,7 @@ public class FaweSchematicHandler extends SchematicHandler { | ||||
|         return delegate.save(tag, path); | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("removal") // Just the override | ||||
|     @Override | ||||
|     public void upload(final CompoundTag tag, final UUID uuid, final String file, final RunnableVal<URL> whenDone) { | ||||
|         delegate.upload(tag, uuid, file, whenDone); | ||||
|   | ||||
| @@ -106,7 +106,7 @@ public class Add extends Command { | ||||
|                                         .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) { | ||||
|                             player.sendMessage( | ||||
|                                     TranslatableCaption.of("errors.invalid_player"), | ||||
|                                     Template.of("value", PlayerManager.getName(uuid)) | ||||
|                                     Template.of("value", PlayerManager.resolveName(uuid).getComponent(player)) | ||||
|                             ); | ||||
|                             iterator.remove(); | ||||
|                             continue; | ||||
| @@ -114,7 +114,7 @@ public class Add extends Command { | ||||
|                         if (plot.isOwner(uuid)) { | ||||
|                             player.sendMessage( | ||||
|                                     TranslatableCaption.of("member.already_added"), | ||||
|                                     Template.of("player", PlayerManager.getName(uuid)) | ||||
|                                     Template.of("player", PlayerManager.resolveName(uuid).getComponent(player)) | ||||
|                             ); | ||||
|                             iterator.remove(); | ||||
|                             continue; | ||||
| @@ -122,7 +122,7 @@ public class Add extends Command { | ||||
|                         if (plot.getMembers().contains(uuid)) { | ||||
|                             player.sendMessage( | ||||
|                                     TranslatableCaption.of("member.already_added"), | ||||
|                                     Template.of("player", PlayerManager.getName(uuid)) | ||||
|                                     Template.of("player", PlayerManager.resolveName(uuid).getComponent(player)) | ||||
|                             ); | ||||
|                             iterator.remove(); | ||||
|                             continue; | ||||
|   | ||||
| @@ -125,7 +125,7 @@ public class Deny extends SubCommand { | ||||
|                     } else if (plot.getDenied().contains(uuid)) { | ||||
|                         player.sendMessage( | ||||
|                                 TranslatableCaption.of("member.already_added"), | ||||
|                                 Template.of("player", PlayerManager.getName(uuid)) | ||||
|                                 Template.of("player", PlayerManager.resolveName(uuid).getComponent(player)) | ||||
|                         ); | ||||
|                         return; | ||||
|                     } else { | ||||
|   | ||||
| @@ -142,7 +142,7 @@ public class Owner extends SetCommand { | ||||
|             if (plot.isOwner(uuid)) { | ||||
|                 player.sendMessage( | ||||
|                         TranslatableCaption.of("member.already_owner"), | ||||
|                         Template.of("player", PlayerManager.getName(uuid, false)) | ||||
|                         Template.of("player", PlayerManager.resolveName(uuid, false).getComponent(player)) | ||||
|                 ); | ||||
|                 return; | ||||
|             } | ||||
| @@ -151,7 +151,7 @@ public class Owner extends SetCommand { | ||||
|                 if (other == null) { | ||||
|                     player.sendMessage( | ||||
|                             TranslatableCaption.of("errors.invalid_player_offline"), | ||||
|                             Template.of("player", PlayerManager.getName(uuid)) | ||||
|                             Template.of("player", PlayerManager.resolveName(uuid).getComponent(player)) | ||||
|                     ); | ||||
|                     return; | ||||
|                 } | ||||
|   | ||||
| @@ -112,7 +112,7 @@ public class Trust extends Command { | ||||
|                                     .hasPermission(player, Permission.PERMISSION_ADMIN_COMMAND_TRUST))) { | ||||
|                         player.sendMessage( | ||||
|                                 TranslatableCaption.of("errors.invalid_player"), | ||||
|                                 Template.of("value", PlayerManager.getName(uuid)) | ||||
|                                 Template.of("value", PlayerManager.resolveName(uuid).getComponent(player)) | ||||
|                         ); | ||||
|                         iterator.remove(); | ||||
|                         continue; | ||||
| @@ -120,7 +120,7 @@ public class Trust extends Command { | ||||
|                     if (currentPlot.isOwner(uuid)) { | ||||
|                         player.sendMessage( | ||||
|                                 TranslatableCaption.of("member.already_added"), | ||||
|                                 Template.of("value", PlayerManager.getName(uuid)) | ||||
|                                 Template.of("value", PlayerManager.resolveName(uuid).getComponent(player)) | ||||
|                         ); | ||||
|                         iterator.remove(); | ||||
|                         continue; | ||||
| @@ -128,7 +128,7 @@ public class Trust extends Command { | ||||
|                     if (currentPlot.getTrusted().contains(uuid)) { | ||||
|                         player.sendMessage( | ||||
|                                 TranslatableCaption.of("member.already_added"), | ||||
|                                 Template.of("value", PlayerManager.getName(uuid)) | ||||
|                                 Template.of("value", PlayerManager.resolveName(uuid).getComponent(player)) | ||||
|                         ); | ||||
|                         iterator.remove(); | ||||
|                         continue; | ||||
|   | ||||
| @@ -70,7 +70,7 @@ public final class Templates { | ||||
|      * @return Generated template | ||||
|      */ | ||||
|     public static @NonNull Template of(final @NonNull String key, final @NonNull UUID uuid) { | ||||
|         final String username = PlayerManager.getName(uuid); | ||||
|         final String username = PlayerManager.resolveName(uuid).getComponent(LocaleHolder.console()); | ||||
|         return Template.of(key, username); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -198,13 +198,7 @@ public class PlotListener { | ||||
|                         final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); | ||||
|                         if (owner != null && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { | ||||
|                             Caption caption = TranslatableCaption.of("notification.notify_enter"); | ||||
|                             Template playerTemplate = Template.of("player", player.getName()); | ||||
|                             Template plotTemplate = Template.of("plot", plot.getId().toString()); | ||||
|                             if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { | ||||
|                                 owner.sendMessage(caption, playerTemplate, plotTemplate); | ||||
|                             } else { | ||||
|                                 owner.sendActionBar(caption, playerTemplate, plotTemplate); | ||||
|                             } | ||||
|                             notifyPlotOwner(player, plot, owner, caption); | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
| @@ -327,7 +321,7 @@ public class PlotListener { | ||||
|                         } | ||||
|                         if ((lastPlot != null) && plot.getId().equals(lastPlot.getId()) && plot.hasOwner()) { | ||||
|                             final UUID plotOwner = plot.getOwnerAbs(); | ||||
|                             String owner = PlayerManager.getName(plotOwner, false); | ||||
|                             String owner = PlayerManager.resolveName(plotOwner, false).getComponent(player); | ||||
|                             Caption header = fromFlag ? StaticCaption.of(title) : TranslatableCaption.of("titles" + | ||||
|                                     ".title_entered_plot"); | ||||
|                             Caption subHeader = fromFlag ? StaticCaption.of(subtitle) : TranslatableCaption.of("titles" + | ||||
| @@ -443,13 +437,7 @@ public class PlotListener { | ||||
|                             final PlotPlayer<?> owner = PlotSquared.platform().playerManager().getPlayerIfExists(uuid); | ||||
|                             if ((owner != null) && !owner.getUUID().equals(player.getUUID()) && owner.canSee(player)) { | ||||
|                                 Caption caption = TranslatableCaption.of("notification.notify_leave"); | ||||
|                                 Template playerTemplate = Template.of("player", player.getName()); | ||||
|                                 Template plotTemplate = Template.of("plot", plot.getId().toString()); | ||||
|                                 if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { | ||||
|                                     owner.sendMessage(caption, playerTemplate, plotTemplate); | ||||
|                                 } else { | ||||
|                                     owner.sendActionBar(caption, playerTemplate, plotTemplate); | ||||
|                                 } | ||||
|                                 notifyPlotOwner(player, plot, owner, caption); | ||||
|                             } | ||||
|                         } | ||||
|                     } | ||||
| @@ -497,6 +485,17 @@ public class PlotListener { | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     private void notifyPlotOwner(final PlotPlayer<?> player, final Plot plot, final PlotPlayer<?> owner, final Caption caption) { | ||||
|         Template playerTemplate = Template.of("player", player.getName()); | ||||
|         Template plotTemplate = Template.of("plot", plot.getId().toString()); | ||||
|         Template areaTemplate = Template.of("area", plot.getArea().toString()); | ||||
|         if (!Settings.Chat.NOTIFICATION_AS_ACTIONBAR) { | ||||
|             owner.sendMessage(caption, playerTemplate, plotTemplate, areaTemplate); | ||||
|         } else { | ||||
|             owner.sendActionBar(caption, playerTemplate, plotTemplate, areaTemplate); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void logout(UUID uuid) { | ||||
|         feedRunnable.remove(uuid); | ||||
|         healRunnable.remove(uuid); | ||||
|   | ||||
| @@ -53,7 +53,7 @@ public abstract class MetaDataAccess<T> implements AutoCloseable { | ||||
|         this.lockAccess = lockAccess; | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("ALL") | ||||
|     @SuppressWarnings("unchecked") | ||||
|     private static <E extends Throwable> void sneakyThrow(final Throwable e) throws E { | ||||
|         throw (E) e; | ||||
|     } | ||||
|   | ||||
| @@ -2838,7 +2838,7 @@ public class Plot { | ||||
|                             if (time != 0) { | ||||
|                                 seen = TimeUtil.secToTime(time); | ||||
|                             } else { | ||||
|                                 seen = TranslatableCaption.of("info.known").getComponent(player); | ||||
|                                 seen = TranslatableCaption.of("info.unknown").getComponent(player); | ||||
|                             } | ||||
|                         } | ||||
|                     } else { | ||||
|   | ||||
| @@ -30,6 +30,7 @@ import com.plotsquared.core.PlotSquared; | ||||
| import com.plotsquared.core.configuration.ConfigurationUtil; | ||||
| import com.plotsquared.core.configuration.Settings; | ||||
| import com.plotsquared.core.configuration.caption.Caption; | ||||
| import com.plotsquared.core.configuration.caption.LocaleHolder; | ||||
| import com.plotsquared.core.configuration.caption.TranslatableCaption; | ||||
| import com.plotsquared.core.database.DBFunc; | ||||
| import com.plotsquared.core.events.PlotComponentSetEvent; | ||||
| @@ -358,7 +359,8 @@ public final class PlotModificationManager { | ||||
|         if (createSign) { | ||||
|             queue.setCompleteTask(() -> TaskManager.runTaskAsync(() -> { | ||||
|                 for (Plot current : plots) { | ||||
|                     current.getPlotModificationManager().setSign(PlayerManager.getName(current.getOwnerAbs())); | ||||
|                     current.getPlotModificationManager().setSign(PlayerManager.resolveName(current.getOwnerAbs()).getComponent( | ||||
|                             LocaleHolder.console())); | ||||
|                 } | ||||
|             })); | ||||
|         } | ||||
|   | ||||
| @@ -96,7 +96,7 @@ public class FlagContainer { | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Cast a plot flag with wildcard parameters into a parametrisized | ||||
|      * Cast a plot flag with wildcard parameters into a parametrized | ||||
|      * PlotFlag. This is an unsafe operation, and should only be performed | ||||
|      * if the generic parameters are known beforehand. | ||||
|      * | ||||
| @@ -105,7 +105,7 @@ public class FlagContainer { | ||||
|      * @param <T>  Flag type | ||||
|      * @return Casted flag | ||||
|      */ | ||||
|     @SuppressWarnings("ALL") | ||||
|     @SuppressWarnings("unchecked") | ||||
|     public static <V, T extends PlotFlag<V, ?>> T castUnsafe( | ||||
|             final PlotFlag<?, ?> flag | ||||
|     ) { | ||||
| @@ -181,6 +181,7 @@ public class FlagContainer { | ||||
|      * @param <V>  flag value type | ||||
|      * @return value of flag removed | ||||
|      */ | ||||
|     @SuppressWarnings("unchecked") | ||||
|     public <V, T extends PlotFlag<V, ?>> V removeFlag(final T flag) { | ||||
|         final Object value = this.flagMap.remove(flag.getClass()); | ||||
|         if (this.plotFlagUpdateHandler != null) { | ||||
|   | ||||
| @@ -73,6 +73,7 @@ public class EntityUtil { | ||||
|         return i; | ||||
|     } | ||||
|  | ||||
|     @SuppressWarnings("unchecked") | ||||
|     public static boolean checkEntity(Plot plot, PlotFlag<Integer, ?>... flags) { | ||||
|         if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot)) { | ||||
|             return true; | ||||
|   | ||||
| @@ -27,7 +27,9 @@ package com.plotsquared.core.util; | ||||
|  | ||||
| import com.plotsquared.core.PlotSquared; | ||||
| import com.plotsquared.core.configuration.Settings; | ||||
| import com.plotsquared.core.configuration.caption.Caption; | ||||
| import com.plotsquared.core.configuration.caption.LocaleHolder; | ||||
| import com.plotsquared.core.configuration.caption.StaticCaption; | ||||
| import com.plotsquared.core.configuration.caption.TranslatableCaption; | ||||
| import com.plotsquared.core.database.DBFunc; | ||||
| import com.plotsquared.core.player.ConsolePlayer; | ||||
| @@ -162,7 +164,9 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> { | ||||
|      * | ||||
|      * @param owner Owner UUID | ||||
|      * @return The player's name, None, Everyone or Unknown | ||||
|      * @deprecated Use {@link #resolveName(UUID)} | ||||
|      */ | ||||
|     @Deprecated(forRemoval = true, since = "TODO") | ||||
|     public static @NonNull String getName(final @Nullable UUID owner) { | ||||
|         return getName(owner, true); | ||||
|     } | ||||
| @@ -173,7 +177,9 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> { | ||||
|      * @param owner    Owner UUID | ||||
|      * @param blocking Whether or not the operation can be blocking | ||||
|      * @return The player's name, None, Everyone or Unknown | ||||
|      * @deprecated Use {@link #resolveName(UUID, boolean)} | ||||
|      */ | ||||
|     @Deprecated(forRemoval = true, since = "TODO") | ||||
|     public static @NonNull String getName(final @Nullable UUID owner, final boolean blocking) { | ||||
|         if (owner == null) { | ||||
|             TranslatableCaption.of("info.none"); | ||||
| @@ -203,6 +209,57 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> { | ||||
|         return name; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Attempts to resolve the username by an uuid | ||||
|      * <p> | ||||
|      * <b>Note:</b> blocks the thread until the name was resolved or failed | ||||
|      * | ||||
|      * @param owner The UUID of the owner | ||||
|      * @return A caption containing either the name, {@code None}, {@code Everyone} or {@code Unknown} | ||||
|      * @see #resolveName(UUID, boolean) | ||||
|      * @since TODO | ||||
|      */ | ||||
|     public static @NonNull Caption resolveName(final @Nullable UUID owner) { | ||||
|         return resolveName(owner, true); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Attempts to resolve the username by an uuid | ||||
|      * | ||||
|      * @param owner    The UUID of the owner | ||||
|      * @param blocking If the operation should block the current thread for {@link Settings.UUID#BLOCKING_TIMEOUT} milliseconds | ||||
|      * @return A caption containing either the name, {@code None}, {@code Everyone} or {@code Unknown} | ||||
|      * @since TODO | ||||
|      */ | ||||
|     public static @NonNull Caption resolveName(final @Nullable UUID owner, final boolean blocking) { | ||||
|         if (owner == null) { | ||||
|             return TranslatableCaption.of("info.none"); | ||||
|         } | ||||
|         if (owner.equals(DBFunc.EVERYONE)) { | ||||
|             return TranslatableCaption.of("info.everyone"); | ||||
|         } | ||||
|         if (owner.equals(DBFunc.SERVER)) { | ||||
|             return TranslatableCaption.of("info.server"); | ||||
|         } | ||||
|         final String name; | ||||
|         if (blocking) { | ||||
|             name = PlotSquared.get().getImpromptuUUIDPipeline() | ||||
|                     .getSingle(owner, Settings.UUID.BLOCKING_TIMEOUT); | ||||
|         } else { | ||||
|             final UUIDMapping uuidMapping = | ||||
|                     PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(owner); | ||||
|             if (uuidMapping != null) { | ||||
|                 name = uuidMapping.getUsername(); | ||||
|             } else { | ||||
|                 name = null; | ||||
|             } | ||||
|         } | ||||
|         if (name == null) { | ||||
|             return TranslatableCaption.of("info.unknown"); | ||||
|         } | ||||
|         return StaticCaption.of(name); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Remove a player from the player map | ||||
|      * | ||||
|   | ||||
| @@ -116,7 +116,7 @@ public final class PlaceholderRegistry { | ||||
|             } | ||||
|  | ||||
|             try { | ||||
|                 return PlayerManager.getName(plotOwner, false); | ||||
|                 return PlayerManager.resolveName(plotOwner, false).getComponent(player); | ||||
|             } catch (final Exception ignored) { | ||||
|             } | ||||
|             return legacyComponent(TranslatableCaption.of("info.unknown"), player); | ||||
|   | ||||
| @@ -60,8 +60,8 @@ | ||||
|   "worldedit.worldedit_bypassed": "<prefix><gray>Currently bypassing WorldEdit restriction.</gray>", | ||||
|   "gamemode.gamemode_was_bypassed": "<prefix><gold>You bypassed the gamemode (</gold><gray><gamemode></gray><gold>) <gold>set for </gold><gray><plot>.</gray>", | ||||
|   "height.height_limit": "<prefix><gold>This plot area has building height limits: Min height: </gold><gray><minHeight></gray><gold>, Max height: </gold><gray><maxHeight></gray>", | ||||
|   "notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><plot></gold><gray>).</gray>", | ||||
|   "notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><plot></gold><gray>).</gray>", | ||||
|   "notification.notify_enter": "<prefix><gray><player> entered your plot (</gray><gold><area>;<plot></gold><gray>).</gray>", | ||||
|   "notification.notify_leave": "<prefix><gray><player> left your plot (</gray><gold><area>;<plot></gold><gray>).</gray>", | ||||
|   "swap.swap_overlap": "<prefix><red>The proposed areas are not allowed to overlap.</red>", | ||||
|   "swap.swap_success": "<prefix><dark_aqua>Successfully swapped plots</dark_aqua> <gold><origin></gold><dark_aqua> -> </dark_aqua><gold><target></gold>", | ||||
|   "swap.swap_merged": "<prefix><red>Merged plots may not be swapped. Please unmerge the plots before performing the swap.</red>", | ||||
|   | ||||
| @@ -18,7 +18,7 @@ plugins { | ||||
|     idea | ||||
| } | ||||
|  | ||||
| version = "6.3.0" | ||||
| version = "6.3.1-SNAPSHOT" | ||||
|  | ||||
| allprojects { | ||||
|     group = "com.plotsquared" | ||||
|   | ||||
| @@ -18,7 +18,7 @@ adventure-platform-bukkit = "4.0.1" | ||||
|  | ||||
| # Plugins | ||||
| worldedit = "7.2.8" | ||||
| fawe = "2.0.0-SNAPSHOT" | ||||
| fawe = "2.0.0" | ||||
| vault = "1.7.1" | ||||
| placeholderapi = "2.11.1" | ||||
| luckperms = "5.3" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user