-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgraded to vesrion 1.2.0 if BlockTyper
- Loading branch information
BuildTools
committed
Feb 8, 2017
1 parent
3d4b100
commit 7f2f697
Showing
7 changed files
with
87 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/com/blocktyper/yearmarked/days/listeners/earthday/SendDayInfoListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package com.blocktyper.yearmarked.days.listeners.earthday; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.block.BlockPlaceEvent; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
import com.blocktyper.yearmarked.YearmarkedPlugin; | ||
import com.blocktyper.yearmarked.days.listeners.YearmarkedListenerBase; | ||
|
||
public class SendDayInfoListener extends YearmarkedListenerBase { | ||
|
||
public SendDayInfoListener(YearmarkedPlugin plugin) { | ||
super(plugin); | ||
} | ||
|
||
@EventHandler | ||
public void onFarmersMarketStandPlaced(BlockPlaceEvent event) { | ||
|
||
if (event.getBlock() == null || event.getPlayer() == null) { | ||
return; | ||
} | ||
|
||
Player player = event.getPlayer(); | ||
|
||
ItemStack itemInHand = plugin.getPlayerHelper().getItemInHand(player); | ||
|
||
if (itemInHand == null) { | ||
return; | ||
} | ||
|
||
if (!itemHasExpectedNbtKey(itemInHand, "")) { | ||
return; | ||
} | ||
|
||
int playerX = player.getLocation().getBlockX(); | ||
int playerZ = player.getLocation().getBlockY(); | ||
|
||
int blockX = event.getBlock().getX(); | ||
int blockZ = event.getBlock().getZ(); | ||
|
||
int dx = playerX - blockX; | ||
int dz = playerZ - blockZ; | ||
|
||
if ((dx == 0 && dz == 0) || (dx != 0 && dz != 0)) { | ||
event.setCancelled(true); | ||
} | ||
|
||
boolean zAxis = dx != 0; | ||
|
||
if (!placeStall(player, zAxis, event.getBlock().getLocation(), itemInHand)) { | ||
event.setCancelled(true); | ||
} | ||
} | ||
|
||
private boolean placeStall(Player player, boolean zAxis, Location location, ItemStack stallItem) { | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
|
||
if [[ -z $1 ]]; then | ||
echo "original version required as first parameter" | ||
elif [[ -z $2 ]]; then | ||
echo "new version required as second parameter" | ||
else | ||
grep -rl $1 src/main/java/com/blocktyper | xargs sed -i "s/$1/$2/g" | ||
fi |