fixed problems with lava portals and portal block portals

This commit is contained in:
Alastair 2016-03-14 12:11:04 +00:00
parent 5d5f916750
commit 57bc18b994
4 changed files with 15 additions and 9 deletions

View File

@ -17,11 +17,12 @@ commands:
usage: /<command>
permissions:
advancedportals.*:
description: Gives access to all portal commands
description: Gives access to all commands
children:
advancedportals.createportal: true
advancedportals.portal: true
advancedportals.build: true
advancedportals.desti.*: true
advancedportals.createportal:
description: Allows you to create portals
default: op
@ -31,3 +32,10 @@ permissions:
advancedportals.build:
description: Allows you to build in the portal regions
default: op
advancedportals.desti.*:
description: Gives access to all desti commands
children:
advancedportals.desti.create: true
advancedportals.desti.create:
description: Allows users to create portal destinations
default: op

View File

@ -540,7 +540,7 @@ public class AdvancedPortalsCommand implements CommandExecutor, TabCompleter {
Player player = (Player)sender;
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 + "\"}}"
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 + "\"}}"
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eShow\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Show the selected portal\"},\"clickEvent\":{\"action\":\"clickEvent\",\"value\":\"/portal show " + portalName + "\"}}"
+ ",{\"text\":\" \"},{\"text\":\"\u00A7eRename\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"Change the name of the portal\"},\"clickEvent\":{\"action\":\"suggest_command\",\"value\":\"/portal rename \"}}"
+ ",{\"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);

View File

@ -35,7 +35,7 @@ public class DestinationCommand implements CommandExecutor, TabCompleter {
public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
if(args.length > 0){
if(args[0].toLowerCase().equals("create")){
if(sender.hasPermission("advancedportals.create")){
if(sender.hasPermission("advancedportals.desti.create")){
if(args.length > 1){
ConfigAccessor config = new ConfigAccessor(plugin, "destinations.yml");
String posX = config.getConfig().getString(args[1].toLowerCase() + ".pos.X");

View File

@ -141,25 +141,23 @@ public class Listeners implements Listener {
}
if(portal.trigger.equals(Material.PORTAL)){
final Player finalplayer = event.getPlayer();
if(player.getGameMode().equals(GameMode.CREATIVE)){
player.setMetadata("hasWarped", new FixedMetadataValue(plugin, true));
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
public void run(){
if(finalplayer != null && finalplayer.isOnline()){
finalplayer.removeMetadata("hasWarped", plugin);
if(player != null && player.isOnline()){
player.removeMetadata("hasWarped", plugin);
}
}
}, 10);
}
}
else if(portal.trigger.equals(Material.LAVA)){
final Player finalplayer = event.getPlayer();
player.setMetadata("lavaWarped", new FixedMetadataValue(plugin, true));
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
public void run(){
finalplayer.removeMetadata("lavaWarped", plugin);
finalplayer.setFireTicks(-1);
player.removeMetadata("lavaWarped", plugin);
player.setFireTicks(0);
}
}, 10);
}