Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ElgarL/Towny
base: 6413a2e4c0
...
head fork: ElgarL/Towny
compare: bed3b1c422
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 28, 2012
@Zren Zren 'plotborder' smoke is now sent to the target player only. 1774014
@ElgarL Merge pull request #21 from Zren/master
'plotborder' smoke is now sent to the target player only.
bed3b1c
View
4 src/com/palmergames/bukkit/towny/listeners/TownyCustomListener.java
@@ -10,7 +10,7 @@
import com.palmergames.bukkit.towny.object.CellBorder;
import com.palmergames.bukkit.towny.object.WorldCoord;
import com.palmergames.bukkit.towny.utils.BorderUtil;
-import com.palmergames.bukkit.util.DrawSmokeTask;
+import com.palmergames.bukkit.util.DrawSmokeTaskFactory;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -61,7 +61,7 @@ public void onPlayerChangePlotEvent(PlayerChangePlotEvent event) {
if (plugin.hasPlayerMode(player, "plotborder")) {
CellBorder cellBorder = BorderUtil.getPlotBorder(to);
- cellBorder.runBorderedOnSurface(1, 2, DrawSmokeTask.DEFAULT);
+ cellBorder.runBorderedOnSurface(1, 2, DrawSmokeTaskFactory.sendToPlayer(player));
}
}
}
View
24 src/com/palmergames/bukkit/util/DrawSmokeTask.java
@@ -1,24 +0,0 @@
-package com.palmergames.bukkit.util;
-
-import org.bukkit.Effect;
-import org.bukkit.Location;
-import org.bukkit.block.BlockFace;
-import org.bukkit.util.Vector;
-
-/**
- * @author Chris H (Zren / Shade)
- * Date: 4/15/12
- */
-public class DrawSmokeTask implements LocationRunnable {
-
- BlockFace smokeDirection = BlockFace.UP;
- Vector offset = new Vector(0.5, 0.5, 0.5);
-
- @Override
- public void run(Location loc) {
-
- loc.getWorld().playEffect(loc.add(offset), Effect.SMOKE, smokeDirection);
- }
-
- public static final DrawSmokeTask DEFAULT = new DrawSmokeTask();
-}
View
47 src/com/palmergames/bukkit/util/DrawSmokeTaskFactory.java
@@ -0,0 +1,47 @@
+package com.palmergames.bukkit.util;
+
+import org.bukkit.Effect;
+import org.bukkit.Location;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Player;
+import org.bukkit.util.Vector;
+
+/**
+ * @author Chris H (Zren / Shade)
+ * Date: 4/15/12
+ */
+public class DrawSmokeTaskFactory {
+ public static final LocationRunnable SEND_TO_WORLD = sendToWorld();
+
+ /**
+ * Send to all players in the world the location is in.
+ * @return
+ */
+ private static LocationRunnable sendToWorld() {
+ return new LocationRunnable() {
+ BlockFace smokeDirection = BlockFace.UP;
+ Vector offset = new Vector(0.5, 0.5, 0.5);
+
+ @Override
+ public void run(Location loc) {
+ loc.getWorld().playEffect(loc.add(offset), Effect.SMOKE, smokeDirection);
+ }
+ };
+ }
+
+ /**
+ * Send to the smoke effect to the player.
+ * @return
+ */
+ public static LocationRunnable sendToPlayer(final Player player) {
+ return new LocationRunnable() {
+ BlockFace smokeDirection = BlockFace.UP;
+ Vector offset = new Vector(0.5, 0.5, 0.5);
+
+ @Override
+ public void run(Location loc) {
+ player.playEffect(loc.add(offset), Effect.SMOKE, smokeDirection);
+ }
+ };
+ }
+}
View
2  src/com/palmergames/bukkit/util/DrawUtil.java
@@ -41,6 +41,6 @@ public static void runOnSurface(World world, int x1, int z1, int x2, int z2, int
public static void drawSmokeOnSurface(World world, int x1, int z1, int x2, int z2, int height) {
- runOnSurface(world, x1, z1, x2, z2, height, DrawSmokeTask.DEFAULT);
+ runOnSurface(world, x1, z1, x2, z2, height, DrawSmokeTaskFactory.SEND_TO_WORLD);
}
}

No commit comments for this range

Something went wrong with that request. Please try again.