From 485a80f6ef2a94e4467b1a87a4a21c4b7de7ee89 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Sun, 9 Aug 2020 11:41:15 +0200 Subject: [PATCH] Fixes #2209 --- CHANGELOG.md | 1 + .../thebusybiscuit/slimefun4/api/gps/GPSNetwork.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7953b951..870503d15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ * Fixed #2168 * Fixed #2203 * Fixed #2205 +* Fixed #2209 ## Release Candidate 15 (01 Aug 2020) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/GPSNetwork.java b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/GPSNetwork.java index 511c8e418..9fd78d6b1 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/GPSNetwork.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/api/gps/GPSNetwork.java @@ -283,6 +283,14 @@ public class GPSNetwork { if (!event.isCancelled()) { String id = ChatColor.stripColor(ChatColors.color(event.getName())).toUpperCase(Locale.ROOT).replace(' ', '_'); + + for (Waypoint wp : profile.getWaypoints()) { + if (wp.getId().equals(id)) { + SlimefunPlugin.getLocalization().sendMessage(p, "gps.waypoint.duplicate", true, msg -> msg.replace("%waypoint%", event.getName())); + return; + } + } + profile.addWaypoint(new Waypoint(profile, id, event.getLocation(), event.getName())); p.playSound(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_PLING, 1F, 1F);