Skip to content

Commit

Permalink
v1.0.45
Browse files Browse the repository at this point in the history
  • Loading branch information
ZombieStriker authored Sep 25, 2018
1 parent d54dc21 commit cfd8065
Show file tree
Hide file tree
Showing 6 changed files with 370 additions and 35 deletions.
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
1.0.45
Fixed GlowEnchantments so that it does not display a name/ does not default to Protection

1.0.44
Added ReflectionUtil to its own package, so other plugins can easily access it without the REMOVELATER

1.0.43
Added full 1.13 support for RGBBlockColor

Expand Down
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
main: me.zombie_striker.pluginconstructor.PluginConstructorAPI
version: 1.0.42
version: 1.0.45
api-version: 1.13
name: PluginConstructorAPI
author:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public int getMaxLevel() {

@Override
public String getName() {
return null;
return ". ";
}

@Override
Expand Down
31 changes: 23 additions & 8 deletions src/me/zombie_striker/pluginconstructor/MapWallUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@

public class MapWallUtil {

@SuppressWarnings("deprecation")
public static ItemStack getMap(BufferedImage BUFFEREDIMAGE) {

MapView mv = Bukkit.createMap(Bukkit.getWorlds().get(0));
short mapIds = mv.getId();
ItemStack is = new ItemStack(Material.MAP, 1, (short) mapIds);
for (MapRenderer mr : mv.getRenderers()) {
mv.removeRenderer(mr);
}
mv.addRenderer(new CustomImageRenderer(BUFFEREDIMAGE, CustomImageRenderer.TICK_FOR_STILLS));

return is;
}

/**
* Remember: The image has to be a multiple of 128
*
Expand All @@ -48,10 +62,11 @@ public static ItemStack[][] getMaps(BufferedImage[] whole) {
height = whole[i].getHeight();
}
int wd1 = (int) (0.999999999 + (((double) width) / 128));
int hd1 = (int) (0.999999999+(((double) height) / 128));
int hd1 = (int) (0.999999999 + (((double) height) / 128));
ItemStack[][] stacks = new ItemStack[wd1][hd1];
if(wd1==0||hd1==0) {
Bukkit.broadcast("Image is invalid. Width="+wd1+" Height="+hd1+".", "pluginconstructorapi.detectImage");
if (wd1 == 0 || hd1 == 0) {
Bukkit.broadcast("Image is invalid. Width=" + wd1 + " Height=" + hd1 + ".",
"pluginconstructorapi.detectImage");
}
for (int x = 0; x < wd1; x++) {
for (int y = 0; y < hd1; y++) {
Expand All @@ -69,13 +84,13 @@ public static ItemStack[][] getMaps(BufferedImage[] whole) {
}
int cW = 127;
int cH = 127;
//if ((x * 128) + cW == whole[frame].getWidth())
// continue;
// if ((x * 128) + cW == whole[frame].getWidth())
// continue;
if ((x * 128) + cW > whole[frame].getWidth())
cW = whole[frame].getWidth()-((x * 128));
cW = whole[frame].getWidth() - ((x * 128));
if ((y * 128) + cH > whole[frame].getHeight())
cH = whole[frame].getHeight()-((y * 128)) ;
if(cH<=0||cW<=0)
cH = whole[frame].getHeight() - ((y * 128));
if (cH <= 0 || cW <= 0)
continue;
bip[frame] = whole[frame].getSubimage(x * 128, y * 128, cW, cH);
}
Expand Down
37 changes: 12 additions & 25 deletions src/me/zombie_striker/pluginconstructor/PluginConstructorAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
public class PluginConstructorAPI extends JavaPlugin {

static Plugin instance;
static Enchantment glowEffect =null;

static Enchantment glowEffect = null;

@Override
public void onEnable() {
Expand Down Expand Up @@ -122,12 +122,12 @@ public void run() {
}.runTaskTimerAsynchronously(PluginConstructorAPI.instance, (15 * 60 * 20) + (k * 40), 30 * 60 * 20);
}
}

@Deprecated
public static int registerGlow() {
return 0;
}

@SuppressWarnings("deprecation")
public static Enchantment registerGlowEnchantment() {
try {
Field f = Enchantment.class.getDeclaredField("acceptingNew");
Expand All @@ -136,32 +136,19 @@ public static Enchantment registerGlowEnchantment() {
} catch (Exception e) {
e.printStackTrace();
}
if(glowEffect!=null) {
if (glowEffect != null) {
return glowEffect;
}
try {
try {
InWorldGlowEnchantment glow = new InWorldGlowEnchantment(
new NamespacedKey(instance, "PluginConstructorAPI:Glow"));
if (Enchantment.getByName(glow.getName()) == null) {
Enchantment.registerEnchantment(glow);
}
glowEffect = glow;
return glow;
} catch (Error
| Exception e45) {/*
* if (Enchantment.getById(id) == null) { InWorldGlowEnchantmentPre13 glow = new
* InWorldGlowEnchantmentPre13(id); if (Enchantment.getByName(glow.getName()) ==
* null) { Enchantment.registerEnchantment(glow); return id; } else { return
* Enchantment.getByName(glow.getName()).getId(); } }
*/
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
InWorldGlowEnchantment glow = new InWorldGlowEnchantment(
new NamespacedKey(instance, "PluginConstructorAPI.Glow"));
Enchantment.registerEnchantment(glow);
glowEffect = glow;
return glow;
} catch (Error | Exception e45) {
e45.printStackTrace();
}
return Enchantment.PROTECTION_ENVIRONMENTAL;
return Enchantment.PROTECTION_PROJECTILE;

}

Expand Down
Loading

0 comments on commit cfd8065

Please sign in to comment.