for got to add a ! to reverse the boolean warped

This commit is contained in:
sekwah41 2013-12-18 22:18:00 +00:00
parent 4fe6bfe955
commit 024fa7c2a0
2 changed files with 15 additions and 11 deletions

View File

@ -86,21 +86,25 @@ public class Listeners implements Listener {
boolean warped = Portal.activate(player, portal.toString());
DataCollector.playerWarped();
if(warped){
if(!warped){
player.teleport(fromloc);
event.setCancelled(true);
}
else{
DataCollector.playerWarped();
}
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(){
finalplayer.removeMetadata("HasWarped", plugin);
}
}, 20);
if(Portal.triggers[portalId].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(){
finalplayer.removeMetadata("HasWarped", plugin);
}
}, 20);
}
}
}

View File

@ -233,7 +233,7 @@ public class Portal {
}
}
else{
player.sendMessage("§cThe destination you are attempting to warp to doesnt exist!");
player.sendMessage("§cThe portal you are trying to use doesn't have a destination!");
plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
+ "attempt and either the data is corrupt or portal doesn't exist!");
return false;