Skip to content

Commit

Permalink
* Fixed an issue allowing vanilla portals to still teleport player wi…
Browse files Browse the repository at this point in the history
…thin a simple portal.
  • Loading branch information
BuildTools committed Jan 18, 2022
1 parent d643618 commit b0ff968
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 73 deletions.
1 change: 1 addition & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 21 additions & 21 deletions SimplePortals.iml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-api:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-config:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-event:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-protocol:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:brigadier:1.0.16-SNAPSHOT" level="project" />
<orderEntry type="module-library" scope="PROVIDED">
<library>
<CLASSES>
Expand All @@ -42,22 +36,10 @@
<jarDirectory url="file://$MODULE_DIR$/../../Plugin Dependencies" recursive="false" type="SOURCES" />
</library>
</orderEntry>
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="module-library" scope="PROVIDED">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/../../Server Jars" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$MODULE_DIR$/../../Server Jars" />
</SOURCES>
<jarDirectory url="file://$MODULE_DIR$/../../Server Jars" recursive="false" />
<jarDirectory url="file://$MODULE_DIR$/../../Server Jars" recursive="false" type="SOURCES" />
</library>
</orderEntry>
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-api:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.8" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: jline:jline:2.12.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-iostreams:2.14.1" level="project" />
Expand Down Expand Up @@ -106,6 +88,24 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.httpcomponents:httpcore:4.4.14" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.slf4j:jcl-over-slf4j:1.7.30" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-codec:4.1.72.Final" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-config:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-event:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-protocol:1.18-R0.1-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:brigadier:1.0.16-SNAPSHOT" level="project" />
<orderEntry type="module-library" scope="PROVIDED">
<library>
<CLASSES>
<root url="file://$MODULE_DIR$/../../Server Jars" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="file://$MODULE_DIR$/../../Server Jars" />
</SOURCES>
<jarDirectory url="file://$MODULE_DIR$/../../Server Jars" recursive="false" />
<jarDirectory url="file://$MODULE_DIR$/../../Server Jars" recursive="false" type="SOURCES" />
</library>
</orderEntry>
<orderEntry type="library" scope="PROVIDED" name="Maven: net.sf.trove4j:core:3.1.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: se.llbit:jo-nbt:1.3.0" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.netty:netty-transport-native-unix-common:4.1.72.Final" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>xzot1k.plugins.sp</groupId>
<artifactId>SimplePortals</artifactId>
<version>1.6.8</version>
<version>1.6.9</version>
<packaging>jar</packaging>

<name>SimplePortals</name>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/xzot1k/plugins/sp/SimplePortals.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public void onEnable() {
saveDefaultConfigs();
reloadConfigs();
updateConfigs();
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");

setPrismaInstalled(getServer().getPluginManager().getPlugin("Prisma") != null);
manager = new Manager(this);
Expand Down Expand Up @@ -78,6 +79,7 @@ public void onEnable() {
@Override
public void onDisable() {
getServer().getScheduler().cancelTasks(this);
getServer().getMessenger().unregisterOutgoingPluginChannel(this);
}

private void updateConfigs() {
Expand Down
16 changes: 9 additions & 7 deletions src/main/java/xzot1k/plugins/sp/api/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package xzot1k.plugins.sp.api;

import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.configuration.ConfigurationSection;
Expand Down Expand Up @@ -724,16 +726,16 @@ public void clearAllVisuals(Player player) {
*/
public void switchServer(Player player, String serverName) {
try {
Bukkit.getMessenger().registerOutgoingPluginChannel(getPluginInstance(), "BungeeCord");
ByteArrayOutputStream byteArray = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(byteArray);
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
out.writeUTF("Connect");
out.writeUTF(serverName);
player.sendPluginMessage(getPluginInstance(), "BungeeCord", byteArray.toByteArray());
out.writeShort(b.toByteArray().length);
out.write(b.toByteArray());
player.sendPluginMessage(getPluginInstance(), "BungeeCord", b.toByteArray());
} catch (Exception ex) {
ex.printStackTrace();
getPluginInstance().log(Level.WARNING,
"There seems to have been a issue when switching the player to the " + serverName + " server.");
getPluginInstance().log(Level.WARNING, "There seems to have been a issue when switching the player to the " + serverName + " server.");
}
}

Expand Down Expand Up @@ -790,7 +792,7 @@ public String getPortalName(Portal portal, boolean withCoordinates) {
*/
public boolean handleVanillaPortalReplacements(Player player, World world, PortalType portalType) {
for (String line : getPluginInstance().getConfig().getStringList((portalType == PortalType.NETHER ? "nether" : "end") + "-portal-locations")) {
if (line == null || line.isEmpty() || !line.contains(":") || !line.contains(",")) continue;
if (line == null || !line.contains(":") || !line.contains(",")) continue;
String[] mainSplit = line.split(":");
if (!mainSplit[0].equalsIgnoreCase(world.getName())) continue;
String[] subSplit = mainSplit[1].split(",");
Expand Down
Loading

0 comments on commit b0ff968

Please sign in to comment.