Skip to content

Commit 9adfc2e

Browse files
committed
Removed 1.7 support and added 1.9
1 parent bbd9984 commit 9adfc2e

12 files changed

+45
-127
lines changed

src/com/sekwah/advancedportals/AdvancedPortalsCommand.java

+7-13
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ else if(args[0].toLowerCase().equals("gui")){
262262
sender.sendMessage("");
263263
sender.sendMessage("\u00A7c[\u00A77AdvancedPortals\u00A7c] Are you sure you would like to remove the portal \u00A7e" + args[2] + "\u00A7c?");
264264
sender.sendMessage("");
265-
plugin.nmsAccess.sendRawMessage("{text:\" \",extra:[{text:\"\u00A7e[Yes]\",hoverEvent:{action:show_text,value:\"Confirm removing this portal\"},clickEvent:{action:run_command,value:\"/portal remove " + args[2] + "\"}}, " +
266-
"{text:\" \"},{text:\"\u00A7e[No]\",hoverEvent:{action:show_text,value:\"Cancel removing this portal\"},clickEvent:{action:run_command,value:\"/portal edit " + args[2] + "\"}}]}", player);
265+
plugin.nmsAccess.sendRawMessage("{\"text\":\" \",\"extra\":[{\"text\":\"\u00A7e[Yes]\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Confirm removing this portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal remove " + args[2] + "\"}}, " +
266+
"{\"text\":\" \"},{\"text\":\"\u00A7e[No]\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Cancel removing this portal\"},\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/portal edit " + args[2] + "\"}}]}", player);
267267
sender.sendMessage("");
268268
}
269269
}
@@ -540,17 +540,11 @@ private void portalEditMenu(CommandSender sender, ConfigAccessor portalConfig, S
540540

541541
Player player = (Player)sender;
542542

543-
plugin.nmsAccess.sendRawMessage("{text:\"\u00A7aFunctions\u00A7e: \",extra:[{text:\"\u00A7eRemove\",hoverEvent:{action:show_text,value:\"Remove the selected portal\"},clickEvent:{action:run_command,value:\"/portal gui remove " + portalName + "\"}}"
544-
+ ",{text:\" \"},{text:\"\u00A7eShow\",hoverEvent:{action:show_text,value:\"Show the selected portal\"},clickEvent:{action:run_command,value:\"/portal show " + portalName + "\"}}"
545-
+ ",{text:\" \"},{text:\"\u00A7eRename\",hoverEvent:{action:show_text,value:\"Change the name of the portal\"},clickEvent:{action:suggest_command,value:\"/portal rename \"}}"
546-
+ ",{text:\" \"},{text:\"\u00A7eActivate\",hoverEvent:{action:show_text,value:\"Teleport to the set destination\n(same as entering the portal)\"},clickEvent:{action:run_command,value:\"/warp " + destination + "\"}}]}", player);
547-
548-
/**IChatBaseComponent comp = ChatSerializer.a("{text:\"\u00A7aFunctions\u00A7e: \",extra:[{text:\"\u00A7eRemove\",hoverEvent:{action:show_text,value:\"Remove the selected portal\"},clickEvent:{action:run_command,value:\"/portal gui remove " + portalName + "\"}}"
549-
+ ",{text:\" \"},{text:\"\u00A7eShow\",hoverEvent:{action:show_text,value:\"Show the selected portal\"},clickEvent:{action:run_command,value:\"/portal show " + portalName + "\"}}"
550-
+ ",{text:\" \"},{text:\"\u00A7eRename\",hoverEvent:{action:show_text,value:\"Change the name of the portal\"},clickEvent:{action:suggest_command,value:\"/portal rename \"}}"
551-
+ ",{text:\" \"},{text:\"\u00A7eActivate\",hoverEvent:{action:show_text,value:\"Teleport to the set destination\n(same as entering the portal)\"},clickEvent:{action:run_command,value:\"/warp " + destination + "\"}}]}");
552-
PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
553-
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);*/
543+
plugin.nmsAccess.sendRawMessage("{\"text\":\"\u00A7aFunctions\u00A7e: \",\"extra\":[{\"text\":\"\u00A7eRemove\",\"hoverEvent\":{\"action\":show_text,\"value\":\"Remove the selected portal\"},\"clickEvent\":{\"action\":\"clickEvent\",\"value\":\"/portal gui remove " + portalName + "\"}}"
544+
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eShow\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Show the selected portal\"},\"clickEvent\":{\"action\":\"clickEvent\",\"value\":\"/portal show " + portalName + "\"}}"
545+
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eRename\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Change the name of the portal\"},\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/portal rename \"}}"
546+
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eActivate\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Teleport to the set destination\n(same as entering the portal)\"},\"clickEvent\":{\"action\":\"clickEvent\",\"value\":\"/warp " + destination + "\"}}]}", player);
547+
554548
sender.sendMessage("");
555549

556550
}

src/com/sekwah/advancedportals/AdvancedPortalsPlugin.java

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.sekwah.advancedportals.DataCollector.DataCollector;
44
import com.sekwah.advancedportals.compat.bukkit.NMS;
55
import com.sekwah.advancedportals.destinations.Destination;
6+
import com.sekwah.advancedportals.effects.WarpEffects;
67
import com.sekwah.advancedportals.metrics.Metrics;
78
import com.sekwah.advancedportals.portals.Portal;
89
import org.bukkit.plugin.java.JavaPlugin;
@@ -82,6 +83,8 @@ public void onEnable() {
8283
new AdvancedPortalsCommand(this);
8384
new DestinationCommand(this);
8485
new WarpCommand(this);
86+
87+
new WarpEffects(this);
8588

8689

8790
// These register the listeners

src/com/sekwah/advancedportals/DestinationCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ else if(args[0].toLowerCase().equals("goto") || args[0].toLowerCase().equals("wa
8585
}
8686
else if(PortalMessagesDisplay == 2){
8787
ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
88-
plugin.nmsAccess.sendActionBarMessage("{text:\"\u00A7aYou have warped to \u00A7e" + args[1].replaceAll("_", " ") + "\u00A7a.\"}", (Player) sender);
88+
plugin.nmsAccess.sendActionBarMessage("{\"text\":\"\u00A7aYou have warped to \u00A7e" + args[1].replaceAll("_", " ") + "\u00A7a.\"}", (Player) sender);
8989
/**plugin.nmsAccess.sendActionBarMessage("[{text:\"You have warped to \",color:green},{text:\"" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination").replaceAll("_", " ")
9090
+ "\",color:yellow},{\"text\":\".\",color:green}]", player);*/
9191
}

src/com/sekwah/advancedportals/Listeners.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void onMoveEvent(PlayerMoveEvent event) {
116116
}
117117
else if(PortalMessagesDisplay == 2 && warped){
118118
ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
119-
plugin.nmsAccess.sendActionBarMessage("{text:\"\u00A7aYou have been warped to \u00A7e" + portal.destiation.replaceAll("_", " ") + "\u00A7a.\"}", player);
119+
plugin.nmsAccess.sendActionBarMessage("{\"text\":\"\u00A7aYou have been warped to \u00A7e" + portal.destiation.replaceAll("_", " ") + "\u00A7a.\"}", player);
120120
/**plugin.nmsAccess.sendActionBarMessage("[{text:\"You have warped to \",color:green},{text:\"" + config.getConfig().getString(portal.portalName + ".destination").replaceAll("_", " ")
121121
+ "\",color:yellow},{\"text\":\".\",color:green}]", player);*/
122122
}

src/com/sekwah/advancedportals/WarpCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String command, Stri
3737
}
3838
else if(DestinationCommand.PortalMessagesDisplay == 2){
3939
ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
40-
plugin.nmsAccess.sendActionBarMessage("{text:\"\u00A7aYou have warped to \u00A7e" + args[0].replaceAll("_", " ") + "\u00A7a.\"}", (Player) sender);
40+
plugin.nmsAccess.sendActionBarMessage("{\"text\":\"\u00A7aYou have warped to \u00A7e" + args[0].replaceAll("_", " ") + "\u00A7a.\"}", (Player) sender);
4141
/**plugin.nmsAccess.sendActionBarMessage("[{text:\"You have warped to \",color:green},{text:\"" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination").replaceAll("_", " ")
4242
+ "\",color:yellow},{\"text\":\".\",color:green}]", player);*/
4343
}

src/com/sekwah/advancedportals/compat/bukkit/v1_7_R1.java

-25
This file was deleted.

src/com/sekwah/advancedportals/compat/bukkit/v1_7_R2.java

-25
This file was deleted.

src/com/sekwah/advancedportals/compat/bukkit/v1_7_R3.java

-26
This file was deleted.

src/com/sekwah/advancedportals/compat/bukkit/v1_7_R4.java

-25
This file was deleted.

src/com/sekwah/advancedportals/effects/WarpEffects.java

+30-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.sekwah.advancedportals.effects;
22

3+
import com.sekwah.advancedportals.AdvancedPortalsPlugin;
34
import com.sekwah.advancedportals.Assets;
45
import org.bukkit.Effect;
56
import org.bukkit.Location;
@@ -9,6 +10,27 @@
910

1011
public class WarpEffects {
1112

13+
public boolean oldSoundLoc = true;
14+
15+
public static Sound[] sounds = new Sound[1];
16+
17+
public static boolean soundError = false;
18+
19+
public WarpEffects(AdvancedPortalsPlugin plugin) {
20+
try {
21+
sounds[0] = Sound.valueOf("ENTITY_ENDERMEN_TELEPORT");
22+
plugin.getLogger().info("Sounds found");
23+
} catch (IllegalArgumentException e) {
24+
plugin.getLogger().info("Using old effect names");
25+
try {
26+
sounds[0] = Sound.valueOf("ENDERMAN_TELEPORT");
27+
} catch (IllegalArgumentException e2) {
28+
plugin.getLogger().warning("There was an error using both the old and new names.");
29+
soundError = true;
30+
}
31+
}
32+
}
33+
1234
public static void activateParticles(Player player) {
1335
Location loc = player.getLocation();
1436
World world = player.getWorld();
@@ -27,15 +49,15 @@ public static void activateParticles(Player player) {
2749
}
2850

2951
public static void activateSound(Player player) {
30-
Location loc = player.getLocation();
31-
World world = player.getWorld();
32-
switch (Assets.currentWarpParticles){
33-
case 1:
34-
world.playSound(loc, Sound.ENDERMAN_TELEPORT, 1F, 1F);
35-
default: break;
52+
if(!soundError){
53+
Location loc = player.getLocation();
54+
World world = player.getWorld();
55+
switch (Assets.currentWarpParticles){
56+
case 1:
57+
world.playSound(loc, sounds[0], 1F, 1F);
58+
default: break;
59+
}
3660
}
37-
38-
3961
}
4062

4163
}

src/com/sekwah/advancedportals/metrics/Metrics.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ private void postPlugin(final boolean isPing) throws IOException {
323323
String serverVersion = Bukkit.getVersion();
324324
// make sure that the older versions of bukkit are added first in project imports, so it can be compiled
325325
// against an older version
326-
int playersOnline = Bukkit.getOnlinePlayers().length;//Bukkit.getServer().getOnlinePlayers().length;
326+
int playersOnline = Bukkit.getOnlinePlayers().size(); //Bukkit.getServer().getOnlinePlayers().length;
327327

328328
// END server software specific section -- all code below does not use any code outside of this class / Java
329329

src/plugin.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
22
name: AdvancedPortals
3-
version: 0.0.12
3+
version: 0.0.13
44
author: SEKWAH41
55
description: An advanced portals plugin for bukkit.
66
commands:

0 commit comments

Comments
 (0)