From 1dcc0246a5ecc206e0003e95a6672b74ca8c9ef2 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 7 Apr 2011 17:26:58 +0200 Subject: [PATCH] Some bugfixes related to slabs, half blocks and some improved messages --- .../ancientgates/commands/CommandList.class | Bin 1877 -> 2017 bytes .../ancientgates/commands/CommandOpen.class | Bin 1725 -> 2040 bytes .../commands/CommandSetFrom.class | Bin 1512 -> 2144 bytes .../listeners/PluginPlayerListener.class | Bin 3181 -> 3451 bytes plugin.yml | 2 +- .../ancientgates/commands/CommandList.java | 1 + .../ancientgates/commands/CommandOpen.java | 7 +++++++ .../ancientgates/commands/CommandSetFrom.java | 18 +++++++++++++++++- .../listeners/PluginPlayerListener.java | 8 ++++++-- 9 files changed, 32 insertions(+), 4 deletions(-) diff --git a/bin/org/mcteam/ancientgates/commands/CommandList.class b/bin/org/mcteam/ancientgates/commands/CommandList.class index bc13f9bc5486042d5af28f45280faf1fec42ec46..f91bbe42916a1eadd900d429568a1e340708d173 100644 GIT binary patch delta 338 zcmXAi+e!ja7=_oKnViwa3<-*e*p-H;H`QH82PjM^2#TVMAhVrX<4o-tEjv6wcgZ}7 z1!D(@E~BdmdVpRe`b8H1X??K%pMl?4^z-lK4ZtjJbttXHM0;jkn=^38Ftl9}Qt%>G zsV=3kJ*&wh$l=ID9}c?Pv57p&3}dN+|D}$u8K^Q0^K#J>E_ZD1RjMv`g=`2p&%;>4 zsR;`!4E-g?a^zOi^+e5p&7fo{`V3OXIYY8FIO4x+G1Z0l_^sJ2oP|aLT7Dt4lYd2S zFJA1RlzGN3LjV!41lS0$8DKx1>EaF+9&i$1HD2qHCpZM#l%ZjgdKwY`BQ&w>(shq1 q62PH$e;|P*O#^qRBMOFbQUe!Ia7n&NPLDNdyYi>?lzvUVf}4Mw(o1;& delta 213 zcmaFJf0d8-)W2Q(7#J9g7)sa~m?qk*Y&7&?(coloU`XO&NM>+hWZ+KD&&e+et}HG| z&E;T7Wn^H|QQ%@oXUJq{$e7H}s>PhekiFT4HII>#i-83Q85oKuZ)OYA)ZWct6S^OeU?a zveKm>S-H39wjxus=m&7+$8lABNok4T;$7Z7=iYPAeeXy7&t&}9@%Nv=3a?bg-mj+m z$BKGzYgy?%;GxQvVA}I**;2RBaDr^!D_eo%H8mbl6hv!wuKVZ;~CEds#GhyZrOsQ6zh%DZdifsJC>W9z@n^D`q$Mdtx-XCkFVXk zFSsyj=d>ahr6#ypsM|(OY8qv)>sE}W7Z_g4Zf1-DQT4qY!}V5AHZ`2ikhdH^6Jr@i zW0IG0NP1~IiYu5o6Wg;oLm9i0iPG%9Q*I<%f~gJ9w+*LR^^Cgh+qVrB|KyqD=h{rf zX!jG5w+R)6C{x6kN8>8-{^!V*n3y4gkl(Z4{~g)tnIVO5Yzw~dVxO3)S3_0~%&#nl z)IXq^dP4%ANSpeOyqHI<7j^HDyGOK(hjbJrBnZieYz`Ww?l=oF-jO>o9G;L-$6#9G zvvS=e*SW|hbJ)zU(cm(!q<1CV;~H;B@sUO87wLLvRH7-Fb>&fsEM(^Nlq7a#I>z2# Dy8W2w delta 309 zcmXAky-osA5QV>m<$}1#vccc@a}f$;6B0>GjE#wfl_nI3f}$c^g$4|oSlSsa%~p1H z)-+23(FgD`Y<&SM`~ijqF~lj%wy3RK3^G#_WlKz2EIA+3s9+WlQzcmJD+`mW+uS z6H#hjT0A5|m&{3YeFHycPyL!ZJM*_>0+LvF-Q#W^0Z zJEB$@aAul5=RSKrMNRkhZIIOeGnVdCT0E|8Y$OT2PvSDoIx`fRr^*5i9iYt;kF4kz ZV2%ArlbO@7u1jF1@=it*7a9d<`~h{lIdT91 diff --git a/bin/org/mcteam/ancientgates/commands/CommandSetFrom.class b/bin/org/mcteam/ancientgates/commands/CommandSetFrom.class index 1740b904d0de98a6168888739fb085fbe9cfc3f4..e0c8087ff9bfd60e8692077e860176b5331ff964 100644 GIT binary patch delta 1057 zcmZ{j%TE+(6vcmERcm2WWUz^V3Ruhtfd*}#_`oMRI*hc)OGQO3+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ca^$M7)Nk2$=dn$+Uxt)x7Yr&`1fG` z_m{u;8mQ-Ug~#A#ZTNy?zm`n2oj2?}$|zUdsMmYKW`z0rD^Eq)0v0J28eE@9_C$p>EZ=_@ccPs8P z$p3!@hkLkJ|KcsTHgcb0lfLY&HSgyE9rblu5AlfNVd)_3U!90=b%@cUPx?x3Xkm*( zFLQ*nKenSw^aU{JbLeM4|K_W+>lktvW}6OKl~%&xQMT)LYm@%j8kcZha|&a}06iFF~p*dMYK zue;kn*+uhg#tde4Bw||z;(eu?`$ytKO{D?$p&fj@sbhAry@7)chd8W9?TEdPafi1! zs?XZZg~tqhrHS~J69)sl%lnG=_WR4t4>+MK{EhY~ryM@yBi-k()Mu=)9`n~56Z)b* zX%y&Xfs(ZGH(mlVZ$DOL$UlO2LSkWt;w+^GlT@4#$mkTXI?G~%uG!qw=$&F&mgR5S-_X!xg{%zim)PLOj_;9^$#5(FX#>0f(1fWXV7l+x*VGg#-|TfUm{XjE!9Qi1-81v+<#dHJ#<%H*@#a_ zLuRh69)hx-gQ5_d5XJHdGmp8HvVgKQ)s)jpM22fV8(GL8i`XXUE_p6{h_Y8+;sKU$ zn57(*+>EKeJBN_a+Yy}BmLvmVBYPV(ZH?AuiE z#s&7vl^)1&q~LA&5$D}?hIgho?xvsg@ZU8Qiy&Aj6swpiEd*&3-_~HZ(5@HHC|Y`& kk8=uEaE4Dr(M*={saR*`+{i=bv_&zh_)O9!bE41v12zE`$N&HU diff --git a/plugin.yml b/plugin.yml index 2226b78..5a3ab39 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ name: AncientGates -version: 1.0.0 +version: 1.0.1 main: org.mcteam.ancientgates.Plugin commands: gate: diff --git a/src/org/mcteam/ancientgates/commands/CommandList.java b/src/org/mcteam/ancientgates/commands/CommandList.java index c2415d5..2c71ce2 100644 --- a/src/org/mcteam/ancientgates/commands/CommandList.java +++ b/src/org/mcteam/ancientgates/commands/CommandList.java @@ -30,6 +30,7 @@ public class CommandList extends BaseCommand { return; } + sendMessage("There are currently "+ids.size()+" gates on this server: "); sendMessage(TextUtil.implode(ids, Conf.colorSystem+", ")); } diff --git a/src/org/mcteam/ancientgates/commands/CommandOpen.java b/src/org/mcteam/ancientgates/commands/CommandOpen.java index 7d06704..d0d49ec 100644 --- a/src/org/mcteam/ancientgates/commands/CommandOpen.java +++ b/src/org/mcteam/ancientgates/commands/CommandOpen.java @@ -1,5 +1,7 @@ package org.mcteam.ancientgates.commands; +import org.bukkit.Material; + public class CommandOpen extends BaseCommand { public CommandOpen() { @@ -22,6 +24,11 @@ public class CommandOpen extends BaseCommand { sendMessage("To fix that: " + new CommandSetTo().getUseageTemplate(true, true)); } + if (gate.getFrom().getBlock().getType() != Material.AIR) { + sendMessage("The gate could not open. The from location is not air."); + return; + } + if (gate.open()) { sendMessage("The gate was opened."); } else { diff --git a/src/org/mcteam/ancientgates/commands/CommandSetFrom.java b/src/org/mcteam/ancientgates/commands/CommandSetFrom.java index b50221e..16b8877 100644 --- a/src/org/mcteam/ancientgates/commands/CommandSetFrom.java +++ b/src/org/mcteam/ancientgates/commands/CommandSetFrom.java @@ -1,5 +1,8 @@ package org.mcteam.ancientgates.commands; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.mcteam.ancientgates.Gate; public class CommandSetFrom extends BaseCommand { @@ -13,7 +16,20 @@ public class CommandSetFrom extends BaseCommand { } public void perform() { - gate.setFrom(player.getLocation()); + // The player might stand in a halfblock or a sign or whatever + // Therefore we load som extra locations and blocks + Block playerBlock = player.getLocation().getBlock(); + Block upBlock = playerBlock.getFace(BlockFace.UP); + + if (playerBlock.getType() == Material.AIR) { + gate.setFrom(playerBlock.getLocation()); + } else if (upBlock.getType() == Material.AIR) { + gate.setFrom(upBlock.getLocation()); + } else { + sendMessage("There is not enough room for a gate to open here"); + return; + } + sendMessage("From location for gate \""+gate.getId()+"\" is now where you stand."); sendMessage("Build a frame around that block and:"); sendMessage(new CommandOpen().getUseageTemplate(true, true)); diff --git a/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java b/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java index 41ef37a..675d884 100644 --- a/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java +++ b/src/org/mcteam/ancientgates/listeners/PluginPlayerListener.java @@ -7,6 +7,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.event.player.PlayerListener; import org.bukkit.event.player.PlayerMoveEvent; import org.mcteam.ancientgates.Conf; @@ -22,11 +23,14 @@ public class PluginPlayerListener extends PlayerListener { return; } - if (event.getTo().getBlock().getType() != Material.PORTAL) { + Block blockTo = event.getTo().getBlock(); + Block blockToUp = blockTo.getFace(BlockFace.UP); + + if (blockTo.getType() != Material.PORTAL && blockToUp.getType() != Material.PORTAL) { return; } - // Ok so a player walks into a partal block + // Ok so a player walks into a portal block // Find the nearest gate! Gate nearestGate = null; Location playerLocation = event.getPlayer().getLocation();