This commit is contained in:
boy0001 2015-07-21 14:09:37 +10:00
parent e6ea62ad1e
commit 8151ec8e1a

View File

@ -171,9 +171,9 @@ public class PlotListener extends APlotListener {
player.playEffect(lastLoc, Effect.RECORD_PLAY, 0); player.playEffect(lastLoc, Effect.RECORD_PLAY, 0);
if (id == 0) { if (id == 0) {
pp.deleteMeta("music"); pp.deleteMeta("music");
return true;
} }
} }
if (id != 0) {
try { try {
pp.setMeta("music", loc); pp.setMeta("music", loc);
player.playEffect(loc, Effect.RECORD_PLAY, Material.getMaterial(id)); player.playEffect(loc, Effect.RECORD_PLAY, Material.getMaterial(id));
@ -181,6 +181,7 @@ public class PlotListener extends APlotListener {
catch (Exception e) {} catch (Exception e) {}
} }
} }
}
else { else {
org.bukkit.Location lastLoc = (org.bukkit.Location) pp.getMeta("music"); org.bukkit.Location lastLoc = (org.bukkit.Location) pp.getMeta("music");
if (lastLoc != null) { if (lastLoc != null) {
@ -201,11 +202,11 @@ public class PlotListener extends APlotListener {
TaskManager.runTaskLaterAsync(new Runnable() { TaskManager.runTaskLaterAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
PlotId id = (PlotId) pp.getMeta("lastplotid"); Plot lastPlot = (Plot) pp.getMeta("lastplot");
if (plot.id.equals(id)) { if (plot.id.equals(lastPlot.id)) {
Map<String, String> replacements = new HashMap<>(); Map<String, String> replacements = new HashMap<>();
replacements.put("%x%", id.x + ""); replacements.put("%x%", lastPlot.id.x + "");
replacements.put("%z%", id.y + ""); replacements.put("%z%", lastPlot.id.y + "");
replacements.put("%world%", plot.world); replacements.put("%world%", plot.world);
replacements.put("%greeting%", greeting); replacements.put("%greeting%", greeting);
replacements.put("%alias", plot.toString()); replacements.put("%alias", plot.toString());