mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2024-12-27 03:17:46 +01:00
commit
4d8879a255
@ -22,7 +22,9 @@ You must have gradle installed then run "gradle build". Once the build is comple
|
||||
[Bukkit Page](http://dev.bukkit.org/bukkit-plugins/advanced-portals/)
|
||||
|
||||
# Usage Data
|
||||
![Global Plugin Stats](http://i.mcstats.org/AdvancedPortals/Global+Statistics.borderless.png)
|
||||
Usage stats can be found here https://bstats.org/plugin/bukkit/AdvancedPortals
|
||||
|
||||
Were available here http://mcstats.org/plugin/AdvancedPortals but mcstats is no longer working.
|
||||
|
||||
The api isn't implemented in this version, sorry for any inconvenience. Check the recode tree for possibly a working recode at some point.
|
||||
|
||||
|
@ -27,6 +27,8 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
private int portalArgsStringLength = 0;
|
||||
|
||||
private HashSet<String> ignoreExtras = new HashSet<>(Arrays.asList("command.1", "permission"));
|
||||
|
||||
// TODO recode the portal args to be put into a hashmap and use a string array
|
||||
// to store all possible portal arguments. Makes code shorter and possibly more efficient.
|
||||
//private HashMap<String, String> portalArgs = new HashMap<>();
|
||||
@ -142,7 +144,6 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
||||
boolean hasDestination = false;
|
||||
boolean isBungeePortal = false;
|
||||
boolean needsPermission = false;
|
||||
boolean delayed = false;
|
||||
boolean executesCommand = false;
|
||||
String destination = null;
|
||||
String portalName = null;
|
||||
@ -155,37 +156,50 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
||||
|
||||
// Is completely changed in the recode but for now im leaving it as this horrible mess...
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
if (args[i].toLowerCase().startsWith("name:") && args[i].length() > 5) {
|
||||
if (startsWithPortalArg("name:", args[i])) {
|
||||
portalName = args[i].replaceFirst("name:", "");
|
||||
if(portalName.equals("")) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail + " You must include a name for the portal that isnt nothing!");
|
||||
return true;
|
||||
}
|
||||
hasName = true;
|
||||
portalName = args[i].replaceFirst("name:", "");
|
||||
} else if (args[i].toLowerCase().startsWith("name:")) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail + " You must include a name for the portal that isnt nothing!");
|
||||
return true;
|
||||
} else if (args[i].toLowerCase().startsWith("destination:") && args[i].length() > 12) {
|
||||
} else if (startsWithPortalArg("destination:", args[i])) {
|
||||
hasDestination = true;
|
||||
destination = args[i].toLowerCase().replaceFirst("destination:", "");
|
||||
} else if (args[i].toLowerCase().startsWith("desti:") && args[i].length() > 6) {
|
||||
} else if (startsWithPortalArg("desti:", args[i])) {
|
||||
hasDestination = true;
|
||||
destination = args[i].toLowerCase().replaceFirst("desti:", "");
|
||||
} else if (args[i].toLowerCase().startsWith("triggerblock:") && args[i].length() > 13) {
|
||||
} else if (startsWithPortalArg("triggerblock:", args[i])) {
|
||||
hasTriggerBlock = true;
|
||||
triggerBlock = args[i].toLowerCase().replaceFirst("triggerblock:", "");
|
||||
} else if (args[i].toLowerCase().startsWith("triggerblock:") && args[i].length() > 13) {
|
||||
} else if (startsWithPortalArg("triggerblock:", args[i])) {
|
||||
hasTriggerBlock = true;
|
||||
triggerBlock = args[i].toLowerCase().replaceFirst("triggerblock:", "");
|
||||
} else if (this.startsWithPortalArg("bungee:", args[i])) {
|
||||
isBungeePortal = true;
|
||||
serverName = args[i].substring("bungee:".length());
|
||||
} else if (args[i].toLowerCase().startsWith("permission:") && args[i].length() > 11) {
|
||||
} else if (startsWithPortalArg("permission:", args[i])) {
|
||||
needsPermission = true;
|
||||
permission = args[i].toLowerCase().replaceFirst("permission:", "");
|
||||
extraData.add(new PortalArg("permission", permission));
|
||||
} else if (args[i].toLowerCase().startsWith("delayed:") && args[i].length() > 8) {
|
||||
delayed = Boolean.parseBoolean(args[i].toLowerCase().replaceFirst("delayed:", ""));
|
||||
extraData.add(new PortalArg("delayed", Boolean.toString(delayed)));
|
||||
} else if (args[i].toLowerCase().startsWith("command:") && args[i].length() > 8) {
|
||||
} else if (startsWithPortalArg("delayed:", args[i])) {
|
||||
boolean delayed = Boolean.parseBoolean(args[i].toLowerCase().replaceFirst("delayed:", ""));
|
||||
extraData.add(new PortalArg("delayed", Boolean.toString(delayed)));
|
||||
} else if(startsWithPortalArg("message:", args[i])) {
|
||||
String message = parseArgVariable(args, i, "message:");
|
||||
if(message == null) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail + " Message quotes not closed!");
|
||||
return true;
|
||||
}
|
||||
extraData.add(new PortalArg("message", message ));
|
||||
} else if (startsWithPortalArg("command:", args[i])) {
|
||||
executesCommand = true;
|
||||
portalCommand = parseArgVariable(args, i, "command:");
|
||||
if(portalCommand == null) {
|
||||
player.sendMessage(PluginMessages.customPrefixFail + " Command quotes not closed!");
|
||||
return true;
|
||||
}
|
||||
i += this.portalArgsStringLength - 1;
|
||||
if(portalCommand.startsWith("#") && !(this.plugin.getSettings().hasCommandLevel("c")
|
||||
&& (sender.hasPermission("advancedportals.createportal.commandlevel.console"))
|
||||
@ -248,7 +262,11 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
||||
player.sendMessage("\u00A7apermission: \u00A7e(none needed)");
|
||||
}
|
||||
|
||||
player.sendMessage("\u00A7adelayed: \u00A7e" + delayed);
|
||||
for(PortalArg portalArg : extraData) {
|
||||
if(!ignoreExtras.contains(portalArg.argName)) {
|
||||
player.sendMessage("\u00A7a" + portalArg.argName + ": \u00A7e" + portalArg.value);
|
||||
}
|
||||
}
|
||||
|
||||
if (executesCommand) {
|
||||
player.sendMessage("\u00A7acommand: \u00A7e" + portalCommand);
|
||||
@ -577,10 +595,13 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
|
||||
String variableString = args[currentArg].replaceFirst(argStarter, "");
|
||||
this.portalArgsStringLength = 1;
|
||||
if (variableString.charAt(0) == '"') {
|
||||
variableString = variableString.substring(1, variableString.length());
|
||||
if (variableString.charAt(variableString.length() - 1) != '"') {
|
||||
variableString = variableString.substring(1);
|
||||
if (variableString.length() == 0 || variableString.charAt(variableString.length() - 1) != '"') {
|
||||
currentArg++;
|
||||
for (; currentArg < args.length; currentArg++) {
|
||||
for (; currentArg <= args.length; currentArg++) {
|
||||
if(currentArg == args.length) {
|
||||
return null;
|
||||
}
|
||||
variableString += " " + args[currentArg];
|
||||
this.portalArgsStringLength += 1;
|
||||
if (variableString.charAt(variableString.length() - 1) == '"') {
|
||||
|
@ -4,7 +4,6 @@ import com.sekwah.advancedportals.compat.CraftBukkit;
|
||||
import com.sekwah.advancedportals.destinations.Destination;
|
||||
import com.sekwah.advancedportals.destinations.DestinationCommand;
|
||||
import com.sekwah.advancedportals.effects.WarpEffects;
|
||||
import com.sekwah.advancedportals.injector.PacketInjector;
|
||||
import com.sekwah.advancedportals.listeners.*;
|
||||
import com.sekwah.advancedportals.metrics.Metrics;
|
||||
import com.sekwah.advancedportals.portals.Portal;
|
||||
@ -26,13 +25,7 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
|
||||
saveDefaultConfig();
|
||||
|
||||
try {
|
||||
Metrics metrics = new Metrics(this);
|
||||
|
||||
metrics.start();
|
||||
} catch (IOException e) {
|
||||
// Failed to submit the stats :-(
|
||||
}
|
||||
Metrics metrics = new Metrics(this);
|
||||
|
||||
try {
|
||||
|
||||
|
@ -13,8 +13,8 @@ public class PluginMessages {
|
||||
ConfigAccessor config = new ConfigAccessor(this.plugin, "config.yml");
|
||||
this.useCustomPrefix = config.getConfig().getBoolean("UseCustomPrefix");
|
||||
if (useCustomPrefix) {
|
||||
PluginMessages.customPrefix = config.getConfig().getString("CustomPrefix").replaceAll("&", "\u00A7");
|
||||
PluginMessages.customPrefixFail = config.getConfig().getString("CustomPrefixFail").replaceAll("&", "\u00A7");
|
||||
PluginMessages.customPrefix = config.getConfig().getString("CustomPrefix").replaceAll("&(?=[0-9a-fk-or])", "\u00A7");
|
||||
PluginMessages.customPrefixFail = config.getConfig().getString("CustomPrefixFail").replaceAll("&(?=[0-9a-fk-or])", "\u00A7");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,10 @@ public class Destination {
|
||||
}
|
||||
|
||||
public static boolean warp(Player player, String name) {
|
||||
return warp(player, name, false);
|
||||
}
|
||||
|
||||
public static boolean warp(Player player, String name, boolean hideActionbar) {
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
|
||||
if (config.getConfig().getString(name + ".world") != null) {
|
||||
Location loc = player.getLocation();
|
||||
@ -137,10 +141,8 @@ public class Destination {
|
||||
player.sendMessage("");
|
||||
player.sendMessage(PluginMessages.customPrefixFail + "\u00A7a You have been warped to \u00A7e" + name.replaceAll("_", " ") + "\u00A7a.");
|
||||
player.sendMessage("");
|
||||
} else if (PORTAL_MESSAGE_DISPLAY == 2) {
|
||||
} else if (PORTAL_MESSAGE_DISPLAY == 2 && !hideActionbar) {
|
||||
plugin.compat.sendActionBarMessage("\u00A7aYou have warped to \u00A7e" + name.replaceAll("_", " ") + "\u00A7a.", player);
|
||||
/**plugin.nmsAccess.sendActionBarMessage("[{text:\"You have warped to \",color:green},{text:\"" + config.getConfig().getString(Portal.portals[portalId].portalName + ".destination").replaceAll("_", " ")
|
||||
+ "\",color:yellow},{\"text\":\".\",color:green}]", player);*/
|
||||
}
|
||||
|
||||
return true;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -391,6 +391,8 @@ public class Portal {
|
||||
cooldown.put(player.getName(), System.currentTimeMillis());
|
||||
boolean showFailMessage = !portal.hasArg("command.1");
|
||||
|
||||
boolean hasMessage = portal.getArg("message") != null;
|
||||
|
||||
//plugin.getLogger().info(portal.getName() + ":" + portal.getDestiation());
|
||||
boolean warped = false;
|
||||
if (portal.getBungee() != null) {
|
||||
@ -409,7 +411,7 @@ public class Portal {
|
||||
else if (portal.getDestiation() != null) {
|
||||
ConfigAccessor configDesti = new ConfigAccessor(plugin, "destinations.yml");
|
||||
if (configDesti.getConfig().getString(portal.getDestiation() + ".world") != null) {
|
||||
warped = Destination.warp(player, portal.getDestiation());
|
||||
warped = Destination.warp(player, portal.getDestiation(), hasMessage);
|
||||
if(!warped){
|
||||
throwPlayerBack(player);
|
||||
}
|
||||
@ -469,6 +471,12 @@ public class Portal {
|
||||
} while (command != null);
|
||||
}
|
||||
|
||||
if(warped) {
|
||||
if(hasMessage) {
|
||||
plugin.compat.sendActionBarMessage(portal.getArg("message").replaceAll("&(?=[0-9a-fk-or])", "\u00A7"), player);
|
||||
}
|
||||
}
|
||||
|
||||
return warped;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
main: com.sekwah.advancedportals.AdvancedPortalsPlugin
|
||||
name: AdvancedPortals
|
||||
version: 0.1.0
|
||||
version: 0.2.0
|
||||
author: sekwah41
|
||||
description: An advanced portals plugin for bukkit.
|
||||
api-version: 1.13
|
||||
|
Loading…
Reference in New Issue
Block a user