Skip to content

Commit

Permalink
# Plugin Changes
Browse files Browse the repository at this point in the history
- Adjusted the configuration updater for 1.17 values.
- Adjusted velocity calculations for teleportation.

Signed-off-by: Jeremiah Osborne <[email protected]>
  • Loading branch information
XZot1K committed Jul 2, 2021
1 parent adecde1 commit 11ab4d4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: SimplePortals
version: 1.6.5
version: 1.6.6
api-version: 1.13
main: xzot1k.plugins.sp.SimplePortals
author: XZot1K
Expand Down
4 changes: 1 addition & 3 deletions src/xzot1k/plugins/sp/SimplePortals.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ private void updateConfigs() {

if (name.equalsIgnoreCase("config")) {
String createSound = getConfig().getString("teleport-sound");
if (!getServerVersion().startsWith("v1_9") && !getServerVersion().startsWith("v1_10") && !getServerVersion().startsWith("v1_11")
&& !getServerVersion().startsWith("v1_12") && !getServerVersion().startsWith("v1_13") && !getServerVersion().startsWith("v1_14")
&& !getServerVersion().startsWith("v1_15") && !getServerVersion().startsWith("v1_16")) {
if (getServerVersion().startsWith("v1_8") || getServerVersion().startsWith("v1_7")) {
if (createSound != null && createSound.equalsIgnoreCase("ENTITY_GHAST_SHOOT")) {
getConfig().set("teleport-sound", "GHAST_CHARGE");
updateCount++;
Expand Down
8 changes: 5 additions & 3 deletions src/xzot1k/plugins/sp/api/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ public void loadPortals() {
Portal portal = getPortalFromFile(file.getName().toLowerCase().replace(".yml", ""));
getPortalMap().put(portal.getPortalId(), portal);
} catch (PortalFormException e) {
getPluginInstance().log(Level.WARNING, "The file \"" + file.getName()
+ "\" has a portal within that was unable to be parsed. Please check this portal.");
getPluginInstance().log(Level.WARNING, e.getMessage());
}
}
}
Expand Down Expand Up @@ -408,6 +407,10 @@ public Portal getPortalFromFile(String portalId) throws PortalFormException {
throw new PortalFormException("The portal's point one and point two have mismatching world names ('" + pointTwo.getWorldName()
+ "' does NOT equal '" + pointTwo.getWorldName() + "').");

World world = getPluginInstance().getServer().getWorld(pointOne.getWorldName());
if (world == null)
throw new PortalFormException("The portal \"" + portalId + "\" has a world assigned to it that no longer exists.");

final Region region = new Region(getPluginInstance(), pointOne, pointTwo);
final Portal portal = new Portal(getPluginInstance(), file.getName().toLowerCase().replace(".yml", ""), region);
portal.setTeleportLocation(teleportLocation);
Expand Down Expand Up @@ -510,7 +513,6 @@ public void teleportWithEntity(Entity entity, Location location) {
}, 5);
} else {
Vector newDirection = entity.getVelocity().clone();

entity.teleport(location);
if (entityVelocity) entity.setVelocity(newDirection);
else entity.setVelocity(new Vector(0, 0, 0));
Expand Down

0 comments on commit 11ab4d4

Please sign in to comment.