Merge pull request #49 from sgdc3/develop

Fix 1.13.2 support
This commit is contained in:
tastybento 2019-10-07 09:56:52 -07:00 committed by GitHub
commit fc471a2bee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 113 additions and 22 deletions

86
.gitignore vendored Normal file
View File

@ -0,0 +1,86 @@
# Git
*.orig
!.gitignore
# Windows
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
*.stackdump
[Dd]esktop.ini
$RECYCLE.BIN/
*.lnk
# Linux
*~
.fuse_hidden*
.directory
.Trash-*
.nfs*
# MacOS
.DS_Store
.AppleDouble
.LSOverride
._*
# Java
*.class
*.log
*.ctxt
.mtj.tmp/
*.jar
*.war
*.nar
*.ear
hs_err_pid*
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
# Intellij
*.iml
*.java___jb_tmp___
.idea/*
*.ipr
*.iws
/out/
.idea_modules/
# Eclipse
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.project
.externalToolBuilders/
*.launch
.cproject
.classpath
.buildpath
.target
# NetBeans
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/

View File

@ -45,7 +45,7 @@
<!-- Non-minecraft related dependencies -->
<powermock.version>2.0.2</powermock.version>
<!-- More visible way how to change dependency versions -->
<spigot.version>1.14.4-R0.1-SNAPSHOT</spigot.version>
<spigot.version>1.13.2-R0.1-SNAPSHOT</spigot.version>
<bentobox.version>1.6.0</bentobox.version>
<!-- Revision variable removes warning about dynamic version -->
<revision>${build.version}-SNAPSHOT</revision>

View File

@ -3,6 +3,7 @@ package bentobox.addon.limits.commands;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Material;
@ -50,7 +51,6 @@ public class LimitPanel {
E2M.put(EntityType.MINECART_FURNACE, Material.FURNACE_MINECART);
E2M.put(EntityType.MINECART_HOPPER, Material.HOPPER_MINECART);
E2M.put(EntityType.MINECART_MOB_SPAWNER, Material.MINECART);
E2M.put(EntityType.MINECART_TNT, Material.TNT_MINECART);
// Disallowed
E2M.put(EntityType.PRIMED_TNT, null);
E2M.put(EntityType.EVOKER_FANGS, null);
@ -59,7 +59,6 @@ public class LimitPanel {
E2M.put(EntityType.AREA_EFFECT_CLOUD, null);
E2M.put(EntityType.ENDER_SIGNAL, null);
E2M.put(EntityType.SMALL_FIREBALL, null);
E2M.put(EntityType.DRAGON_FIREBALL, null);
E2M.put(EntityType.FIREBALL, null);
E2M.put(EntityType.THROWN_EXP_BOTTLE, null);
E2M.put(EntityType.EXPERIENCE_ORB, null);
@ -76,11 +75,15 @@ public class LimitPanel {
E2M.put(EntityType.ENDER_PEARL, null);
E2M.put(EntityType.ENDER_DRAGON, null);
// Block to Material icons
B2M.put(Material.SWEET_BERRY_BUSH, Material.SWEET_BERRIES);
Optional.ofNullable(Material.getMaterial("SWEET_BERRY_BUSH")).ifPresent(material -> {
B2M.put(material, Material.getMaterial("SWEET_BERRIES"));
});
B2M.put(Material.POTATOES, Material.POTATO);
B2M.put(Material.CARROTS, Material.CARROT);
B2M.put(Material.BEETROOTS, Material.BEETROOT);
B2M.put(Material.BAMBOO_SAPLING, Material.BAMBOO);
Optional.ofNullable(Material.getMaterial("BAMBOO_SAPLING")).ifPresent(material -> {
B2M.put(material, Material.getMaterial("BAMBOO"));
});
B2M.put(Material.REDSTONE_WIRE, Material.REDSTONE);
}

View File

@ -1,10 +1,6 @@
package bentobox.addon.limits.listeners;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import org.bukkit.Bukkit;
import org.bukkit.Material;
@ -49,7 +45,15 @@ public class BlockLimitsListener implements Listener {
* Blocks that are not counted
*/
private static final List<Material> DO_NOT_COUNT = Arrays.asList(Material.LAVA, Material.WATER, Material.AIR, Material.FIRE, Material.END_PORTAL, Material.NETHER_PORTAL);
private static final List<Material> STACKABLE = Arrays.asList(Material.SUGAR_CANE, Material.BAMBOO);
private static final List<Material> STACKABLE;
static {
List<Material> stackable = new ArrayList<>();
stackable.add(Material.SUGAR_CANE);
Optional.ofNullable(Material.getMaterial("BAMBOO")).ifPresent(stackable::add);
STACKABLE = Collections.unmodifiableList(stackable);
}
/**
* Save every 10 blocks of change
*/
@ -265,24 +269,22 @@ public class BlockLimitsListener implements Listener {
// Return equivalents.
public Material fixMaterial(Material b) {
switch (b) {
case REDSTONE_WALL_TORCH:
if (b == Material.REDSTONE_WALL_TORCH) {
return Material.REDSTONE_TORCH;
case WALL_TORCH:
} else if (b == Material.WALL_TORCH) {
return Material.TORCH;
case ZOMBIE_WALL_HEAD:
} else if (b == Material.ZOMBIE_WALL_HEAD) {
return Material.ZOMBIE_HEAD;
case CREEPER_WALL_HEAD:
} else if (b == Material.CREEPER_WALL_HEAD) {
return Material.CREEPER_HEAD;
case PLAYER_WALL_HEAD:
} else if (b == Material.PLAYER_WALL_HEAD) {
return Material.PLAYER_HEAD;
case DRAGON_WALL_HEAD:
} else if (b == Material.DRAGON_WALL_HEAD) {
return Material.DRAGON_HEAD;
case BAMBOO_SAPLING:
return Material.BAMBOO;
default:
return b;
} else if (b != null && b == Material.getMaterial("BAMBOO_SAPLING")) {
return Material.getMaterial("BAMBOO");
}
return b;
}
/**