Skip to content

Commit

Permalink
upgraded to vesrion 1.2.0 if BlockTyper
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Feb 8, 2017
1 parent 3d4b100 commit 7f2f697
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<dependency>
<groupId>com.blocktyper</groupId>
<artifactId>blocktyperplugin</artifactId>
<version>1.1.8</version>
<version>1.2.0</version>
<scope>compile</scope>
</dependency>

Expand Down
11 changes: 9 additions & 2 deletions src/main/java/com/blocktyper/yearmarked/YearmarkedPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

import org.bukkit.scheduler.BukkitRunnable;

import com.blocktyper.v1_1_8.plugin.BlockTyperPlugin;
import com.blocktyper.v1_2_0.BlockTyperBasePlugin;
import com.blocktyper.v1_2_0.recipes.IRecipe;
import com.blocktyper.yearmarked.commands.YmCommand;
import com.blocktyper.yearmarked.days.listeners.YearmarkedListenerBase;
import com.blocktyper.yearmarked.days.listeners.earthday.EarthdayListener;
import com.blocktyper.yearmarked.monitors.HolographicDisplayMonitor;
import com.blocktyper.yearmarked.monitors.TimeMonitor;

public class YearmarkedPlugin extends BlockTyperPlugin {
public class YearmarkedPlugin extends BlockTyperBasePlugin {

public static String NBT_RECIPE_KEY = "YearmarkedPluginNBTRecipeKey";

Expand Down Expand Up @@ -108,4 +109,10 @@ public String getRecipesNbtKey() {
return NBT_RECIPE_KEY;
}

@Override
public IRecipe bootstrapRecipe(IRecipe recipe) {
// TODO Auto-generated method stub
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;

import com.blocktyper.v1_1_8.nbt.NBTItem;
import com.blocktyper.v1_2_0.nbt.NBTItem;
import com.blocktyper.yearmarked.YearmarkedPlugin;
import com.blocktyper.yearmarked.days.listeners.earthday.EarthdayListener;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;

import com.blocktyper.v1_1_8.nbt.NBTItem;
import com.blocktyper.v1_2_0.nbt.NBTItem;
import com.blocktyper.yearmarked.YearmarkedPlugin;
import com.blocktyper.yearmarked.days.listeners.diamonday.DiamondayListener;
import com.blocktyper.yearmarked.days.listeners.donnerstag.DonnerstagListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

import com.blocktyper.v1_1_8.nbt.NBTItem;
import com.blocktyper.v1_1_8.recipes.BlockTyperRecipe;
import com.blocktyper.v1_2_0.nbt.NBTItem;
import com.blocktyper.v1_2_0.recipes.AbstractBlockTyperRecipe;
import com.blocktyper.v1_2_0.recipes.BlockTyperRecipe;
import com.blocktyper.yearmarked.ConfigKey;
import com.blocktyper.yearmarked.LocalizedMessage;
import com.blocktyper.yearmarked.YearmarkedPlugin;
Expand Down Expand Up @@ -598,7 +599,7 @@ private static void registerEarthdayArrowRecipe(EntityType entityType, Map<Strin
materialMatrix.add(8, Material.ARROW);

String recipeKey = getEarthdayEntityArrowRecipeKey(entityType);
BlockTyperRecipe recipe = new BlockTyperRecipe(recipeKey, materialMatrix, Material.ARROW, plugin);
AbstractBlockTyperRecipe recipe = new BlockTyperRecipe(recipeKey, materialMatrix, null, Material.ARROW, plugin);

recipe.setName("Earthday " + entityType.name());
recipe.setNbtStringData(nbtStringData);
Expand Down
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;
}

}
10 changes: 10 additions & 0 deletions upgradeVersion
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

0 comments on commit 7f2f697

Please sign in to comment.