This repository has been archived by the owner on Jun 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from ProjectG-Plugins/1.3.1
1.3.1
- Loading branch information
Showing
20 changed files
with
344 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/dev/projectg/geyserhub/config/updaters/MAIN_5.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package dev.projectg.geyserhub.config.updaters; | ||
|
||
import dev.projectg.geyserhub.config.ConfigUpdater; | ||
import org.bukkit.configuration.ConfigurationSection; | ||
|
||
import java.util.Objects; | ||
|
||
public class MAIN_5 implements ConfigUpdater { | ||
|
||
@Override | ||
public boolean update(ConfigurationSection config) throws IllegalArgumentException { | ||
if (!config.contains("Join-Teleporter.Coordinates", true)) { | ||
throw new IllegalArgumentException("Main config must contain Join-Teleporter config section and Coordinates string value"); | ||
} | ||
|
||
ConfigurationSection teleporter = config.getConfigurationSection("Join-Teleporter"); | ||
Objects.requireNonNull(teleporter); | ||
|
||
String composedCoords = Objects.requireNonNull(teleporter.getString("Coordinates")); | ||
String[] coordinates = composedCoords.split(";", 3); | ||
|
||
try { | ||
teleporter.set("X", Integer.parseInt(coordinates[0])); | ||
teleporter.set("Y", Integer.parseInt(coordinates[1])); | ||
teleporter.set("Z", Integer.parseInt(coordinates[2])); | ||
teleporter.set("Yaw", 0); // Default | ||
teleporter.set("Pitch", 0); // Default | ||
|
||
config.set("Join-Teleporter.Coordinates", null); // Remove | ||
config.set("Config-Version", 6); | ||
|
||
return true; | ||
} catch (NumberFormatException e) { | ||
throw new IllegalArgumentException("Config contains invalid coordinates value: string must be 3 integers separated by 2 semicolons."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.