Skip to content

Commit

Permalink
Allow wild card for floor blocks to make adding glass and wood easier.
Browse files Browse the repository at this point in the history
Misc deperication update as well.
  • Loading branch information
croxis committed Aug 14, 2018
1 parent 03436d8 commit 6343541
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 20 deletions.
12 changes: 10 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sourceCompatibility = '1.8'
targetCompatibility = '1.8'

//dependencies versions
ext.bukkitVersion = '1.13-pre7-R0.1-SNAPSHOT'
ext.bukkitVersion = '1.13-R0.1-SNAPSHOT'

//dependencies declaration
dependencies {
Expand All @@ -25,7 +25,15 @@ dependencies {
compile 'org.spongepowered:spongeapi:7.0.0-SNAPSHOT'

testCompile group: 'junit', name: 'junit', version: '4.11'
}
}

allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<bukkitVersion>1.13-pre7-R0.1-SNAPSHOT</bukkitVersion>
<bukkitVersion>1.13-R0.1-SNAPSHOT</bukkitVersion>
<spongeVersion>7.0.0-SNAPSHOT</spongeVersion>
</properties>

Expand Down
14 changes: 13 additions & 1 deletion src/main/java/net/croxis/plugins/lift/BukkitConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,19 @@ public void loadConfig(BukkitLift plugin){
}
List<String> configFloorMaterials = plugin.getConfig().getStringList("floorBlocks");
for (String key : configFloorMaterials){
BukkitConfig.floorMaterials.add(Material.valueOf(key));
if (key.contains("*")){
// Probably be smarter to iterate through the material list first, then see if config matches
for (Material material : Material.values()){
if (material.toString().matches(key.replace("*", ".*?"))){
BukkitConfig.floorMaterials.add(material);
plugin.logInfo("Floor material added: " + material.toString());
}

};
} else {
BukkitConfig.floorMaterials.add(Material.valueOf(key));
plugin.logInfo("Floor material added: " + key);
}
}
BukkitConfig.stringOneFloor = plugin.getConfig().getString("STRING_oneFloor", "There is only one floor silly.");
BukkitConfig.stringCurrentFloor = plugin.getConfig().getString("STRING_currentFloor", "Current Floor:");
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/net/croxis/plugins/lift/BukkitElevatorManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.HashSet;
import java.util.Iterator;

import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;

import org.bukkit.Location;
Expand Down Expand Up @@ -371,8 +372,10 @@ public static void setupPlayer(Player player){

player.setAllowFlight(true);

if (BukkitConfig.useNoCheatPlus)
NCPExemptionManager.exemptPermanently(player, fr.neatmonster.nocheatplus.checks.CheckType.FIGHT);
if (BukkitConfig.useNoCheatPlus){
NCPExemptionManager.exemptPermanently(player, CheckType.MOVING_NOFALL);
NCPExemptionManager.exemptPermanently(player, CheckType.MOVING_SURVIVALFLY);
}
}

static void restorePlayer(Player player){
Expand All @@ -385,8 +388,10 @@ static void restorePlayer(Player player){
} else {
player.setAllowFlight(false);
plugin.logDebug("Removing player from flight");
if (BukkitConfig.useNoCheatPlus)
NCPExemptionManager.unexempt(player, fr.neatmonster.nocheatplus.checks.CheckType.FIGHT);
if (BukkitConfig.useNoCheatPlus){
NCPExemptionManager.unexempt(player, CheckType.MOVING_NOFALL);
NCPExemptionManager.unexempt(player, CheckType.MOVING_SURVIVALFLY);
}
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/main/java/net/croxis/plugins/lift/BukkitLift.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,19 @@

import java.util.logging.Level;

import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.command.*;

public class BukkitLift extends JavaPlugin implements Listener {
public static BukkitElevatorManager manager;
static BukkitConfig config = new BukkitConfig();
NoCheatPlusAPI ncp = null;

public Double getBlockSpeed(Material material) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,13 @@
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.inventory.InventoryPickupItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand Down Expand Up @@ -118,7 +117,7 @@ public void onPlayerInteract(PlayerInteractEvent event){
}

@EventHandler
public void onPlayerItemPickup(PlayerPickupItemEvent event){
public void onPlayerItemPickup(EntityPickupItemEvent event){
if (BukkitElevatorManager.isPassenger(event.getItem()))
BukkitElevatorManager.removePassenger(event.getItem());
}
Expand Down
9 changes: 5 additions & 4 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Note: Smaller values result in less lag. Lift speed less than 0.4 may not work well for non spout servers.
# Note: Smaller area and height values result in less lag.
# baseBlockSpeeds speed less than 0.4 may not work well.
# autoPlace will automatically move players to be fully in the elevator
# checkGlass will make sure all floors have glass blocks (at the cost of possible lag when starting a lift)
# checkFloor will make sure all floors have glass blocks (at the cost of possible lag when starting a lift)
# preventEntry will prevent players from entering an active elevator (at the cost of possible lag when lifts are running)
metrics: true
maxLiftArea: 16
Expand All @@ -12,8 +13,8 @@ preventLeave: true
checkFloor: false
liftMobs: true
floorBlocks:
- GLASS
- STAINED_GLASS
- GLASS
- "!_STAINED_GLASS"
redstone: false
baseBlockSpeeds:
IRON_BLOCK: 0.5
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ commands:
usage: /<command>
permission: lift
permission-message: You don't have lift permissions
api-version: 1.13

0 comments on commit 6343541

Please sign in to comment.