diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6f3c62b --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +# Eclipse stuff +/.classpath +/.project +/.settings +/.checkstyle + +# we use maven! +/build.xml + +# maven +dependency-reduced-pom.xml + +# intellij +*.iml +*.ipr +*.iws +.idea/ + +# Build stuff +/target +/classes \ No newline at end of file diff --git a/out/artifacts/stayput_jar/stayput.jar b/out/artifacts/stayput_jar/stayput.jar deleted file mode 100644 index ded6de6..0000000 Binary files a/out/artifacts/stayput_jar/stayput.jar and /dev/null differ diff --git a/pom.xml b/pom.xml index ecc0572..2afbb03 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,8 @@ org.spigotmc spigot-api - 1.11.2-R0.1-SNAPSHOT + Spigot-API 1.13.1-R0.1-SNAPSHOT + jar provided diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF index c996e02..2a85017 100644 --- a/src/main/java/META-INF/MANIFEST.MF +++ b/src/main/java/META-INF/MANIFEST.MF @@ -1,3 +1,3 @@ Manifest-Version: 1.0 -Main-Class: nl.zandervdm.stayput.Main +Main-Class: nl.zandervdm.stayput.StayPut diff --git a/src/main/java/nl/zandervdm/stayput/Commands/StayputCommand.java b/src/main/java/nl/zandervdm/stayput/Commands/StayputCommand.java index 7f44983..99608a9 100644 --- a/src/main/java/nl/zandervdm/stayput/Commands/StayputCommand.java +++ b/src/main/java/nl/zandervdm/stayput/Commands/StayputCommand.java @@ -1,19 +1,23 @@ package nl.zandervdm.stayput.Commands; -import nl.zandervdm.stayput.Main; +import com.google.common.collect.*; +import nl.zandervdm.stayput.StayPut; import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; +import java.util.HashMap; + public class StayputCommand implements CommandExecutor { - protected Main plugin; + protected StayPut plugin; - public StayputCommand(Main plugin) { + public StayputCommand(StayPut plugin) { this.plugin = plugin; } + @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { if(strings.length == 0){ @@ -30,16 +34,37 @@ public boolean onCommand(CommandSender commandSender, Command command, String s, } this.plugin.reloadConfig(); this.plugin.setupConfig(); + this.plugin.checkTableRebuild(); + // Re-setup the dimensions if the config got altered. + this.plugin.setupDimensions(); this.sendMessage(commandSender, "Config has been reloaded!"); return true; } + if(executedCommand.equals("listworlds")) { + this.sendMessage(commandSender, "-- Dimension List --"); + ImmutableMultimap dimensions = this.plugin.getDimensionManager().getDimensions(); + for(String dimension_name : dimensions.keySet() ) { + this.sendMessage(commandSender, dimension_name + ":"); + dimensions.get(dimension_name).forEach(world_name -> { + this.sendMessage(commandSender," - " + world_name); + }); + } + } + + if(executedCommand.equals("rebuildTables")) { + this.sendMessage(commandSender, "-- Deleting and Rebuilding Position --"); + this.plugin.rebuildTables(); + } + return true; } protected void sendInfoMessage(CommandSender commandSender){ this.sendMessage(commandSender, "Available commands:"); this.sendMessage(commandSender, "/stayput reload - Reloads the config files"); + this.sendMessage(commandSender, "/stayput listdimensions - Lists all the dimensions"); + this.sendMessage(commandSender, "/stayput rebuildTables - DO NOT RUN THIS"); } protected void sendMessage(CommandSender commandSender, String message){ diff --git a/src/main/java/nl/zandervdm/stayput/Listeners/PlayerTeleportEventListener.java b/src/main/java/nl/zandervdm/stayput/Listeners/PlayerTeleportEventListener.java index 98a502b..765d2d1 100644 --- a/src/main/java/nl/zandervdm/stayput/Listeners/PlayerTeleportEventListener.java +++ b/src/main/java/nl/zandervdm/stayput/Listeners/PlayerTeleportEventListener.java @@ -1,35 +1,27 @@ package nl.zandervdm.stayput.Listeners; import com.onarandombox.MultiverseCore.event.MVTeleportEvent; -import javafx.geometry.Pos; -import nl.zandervdm.stayput.Main; -import nl.zandervdm.stayput.Models.Position; +import com.onarandombox.MultiversePortals.event.MVPortalEvent; +import nl.zandervdm.stayput.StayPut; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.World; import org.bukkit.block.BlockFace; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerTeleportEvent; - -import java.sql.SQLException; -import java.util.List; public class PlayerTeleportEventListener implements Listener { - protected Main plugin; + private StayPut plugin; - public PlayerTeleportEventListener(Main plugin) { + public PlayerTeleportEventListener(StayPut plugin) { this.plugin = plugin; } @EventHandler public void onPlayerTeleportEvent(MVTeleportEvent event){ - if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("PlayerTeleportEvent activated"); + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("PlayerTeleportEvent activated"); Player player = event.getTeleportee(); - World fromWorld = event.getFrom().getWorld(); - World toWorld = event.getDestination().getLocation(player).getWorld(); if(!this.plugin.getRuleManager().shouldUpdateLocation(player, event.getFrom(), event.getDestination().getLocation(player))){ return; @@ -39,61 +31,105 @@ public void onPlayerTeleportEvent(MVTeleportEvent event){ //he left the previous world this.plugin.getPositionRepository().updateLocationForPlayer(player, event.getFrom()); - Location previousLocation = this.plugin.getRuleManager().shouldTeleportPlayer(player, event.getFrom(), event.getDestination().getLocation(player)); + Location previousLocation = this.plugin.getRuleManager().shouldTeleportPlayer(player, event.getDestination().getLocation(player)); if(previousLocation != null) { - if(this.isPressureplate(previousLocation)){ + if(this.isPressurePlate(previousLocation)){ // Find a valid spot around the location Location newLocation = this.findAvailableLocation(previousLocation); if(newLocation != null) previousLocation = newLocation; } //There is a location, and the player should teleport, so teleport him - if (Main.config.getBoolean("debug")) + if (StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Teleporting player to his previous location"); event.setCancelled(true); player.teleport(previousLocation); } } - protected boolean isPressureplate(Location toLocation) { + @EventHandler + public void onPlayerPortalEvent(MVPortalEvent event) { + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("PlayerPortalEvent activated"); + Player player = event.getTeleportee(); + + if(!this.plugin.getRuleManager().shouldUpdateLocation(player, event.getFrom(), event.getDestination().getLocation(player))){ + return; + } + + //We should always update the previous location for the previous world for this player because at this point + //he left the previous world + this.plugin.getPositionRepository().updateLocationForPlayer(player, event.getFrom()); + + Location previousLocation = this.plugin.getRuleManager().shouldTeleportPlayer(player, event.getDestination().getLocation(player)); + + if(previousLocation != null) { + if(this.isPressurePlate(previousLocation)){ + // Find a valid spot around the location + Location newLocation = this.findAvailableLocation(previousLocation); + if(newLocation != null) previousLocation = newLocation; + } + + //There is a location, and the player should teleport, so teleport him + if (StayPut.config.getBoolean("debug")) + this.plugin.getLogger().info("Teleporting player to his previous location"); + event.setCancelled(true); + player.teleport(previousLocation); + } + } + + private boolean isPressurePlate(Location toLocation) { Location blockBelow = new Location(toLocation.getWorld(), toLocation.getX(), toLocation.getY()-1, toLocation.getZ()); - if(blockBelow.getBlock().getType().equals(Material.STONE_PLATE)) return true; - if(blockBelow.getBlock().getType().equals(Material.WOOD_PLATE)) return true; - if(blockBelow.getBlock().getType().equals(Material.IRON_PLATE)) return true; - if(blockBelow.getBlock().getType().equals(Material.GOLD_PLATE)) return true; - if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.STONE_PLATE)) return true; - if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.GOLD_PLATE)) return true; - if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.IRON_PLATE)) return true; - if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.WOOD_PLATE)) return true; - if(toLocation.getBlock().getType().equals(Material.STONE_PLATE)) return true; - if(toLocation.getBlock().getType().equals(Material.WOOD_PLATE)) return true; - if(toLocation.getBlock().getType().equals(Material.IRON_PLATE)) return true; - if(toLocation.getBlock().getType().equals(Material.GOLD_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.ACACIA_PRESSURE_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.BIRCH_PRESSURE_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.DARK_OAK_PRESSURE_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.JUNGLE_PRESSURE_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.OAK_PRESSURE_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.SPRUCE_PRESSURE_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.STONE_PRESSURE_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.HEAVY_WEIGHTED_PRESSURE_PLATE)) return true; + if(blockBelow.getBlock().getType().equals(Material.LIGHT_WEIGHTED_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.ACACIA_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.BIRCH_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.DARK_OAK_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.JUNGLE_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.OAK_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.SPRUCE_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.STONE_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.HEAVY_WEIGHTED_PRESSURE_PLATE)) return true; + if(toLocation.getBlock().getRelative(BlockFace.DOWN).getType().equals(Material.LIGHT_WEIGHTED_PRESSURE_PLATE)) return true; return false; } - protected Location findAvailableLocation(Location location) { + private Location findAvailableLocation(Location location) { //The current given location isn't valid (most likely it is a pressure plate) - //Get the location in front, back, left and right of it and check if it is air. + //Get the location in front, back, left and right of it and check if it is air or water. //Also check the block above it to make sure the block can't suffocate. - Location block1Down = new Location(location.getWorld(), location.getX()-1, location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - Location block2Down = new Location(location.getWorld(), location.getX()+1, location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - Location block3Down = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ()-1, location.getYaw(), location.getPitch()); - Location block4Down = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ()+1, location.getYaw(), location.getPitch()); - - if(block1Down.getBlock().getType().equals(Material.AIR)){ - Location block1Up = new Location(location.getWorld(), location.getX()-1, location.getY()+1, location.getZ()); - if(block1Up.getBlock().getType().equals(Material.AIR)) return block1Down; - }else if(block2Down.getBlock().getType().equals(Material.AIR)){ - Location block2Up = new Location(location.getWorld(), location.getX()+1, location.getY()+1, location.getZ()); - if(block2Up.getBlock().getType().equals(Material.AIR)) return block2Down; - }else if(block3Down.getBlock().getType().equals(Material.AIR)){ - Location block3Up = new Location(location.getWorld(), location.getX(), location.getY()+1, location.getZ()-1); - if(block3Up.getBlock().getType().equals(Material.AIR)) return block3Down; - }else if(block4Down.getBlock().getType().equals(Material.AIR)){ - Location block4Up = new Location(location.getWorld(), location.getX(), location.getY()+1, location.getZ()+1); - if(block4Up.getBlock().getType().equals(Material.AIR)) return block4Down; + Location location1Down = new Location(location.getWorld(), location.getX()-1, location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + Location location2Down = new Location(location.getWorld(), location.getX()+1, location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + Location location3Down = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ()-1, location.getYaw(), location.getPitch()); + Location location4Down = new Location(location.getWorld(), location.getX(), location.getY(), location.getZ()+1, location.getYaw(), location.getPitch()); + Material block1Down = location1Down.getBlock().getType(); + Material block2Down = location2Down.getBlock().getType(); + Material block3Down = location3Down.getBlock().getType(); + Material block4Down = location4Down.getBlock().getType(); + + if(block1Down.equals(Material.AIR) || block1Down.equals(Material.WATER)){ + Location location1Up = new Location(location.getWorld(), location.getX()-1, location.getY()+1, location.getZ(), location.getYaw(), location.getPitch()); + Material block1Up = location1Up.getBlock().getType(); + if(block1Up.equals(Material.AIR) || block1Up.equals(Material.WATER)) return location1Down; + }else if(block2Down.equals(Material.AIR) || block2Down.equals(Material.WATER)){ + Location location2Up = new Location(location.getWorld(), location.getX()+1, location.getY()+1, location.getZ(), location.getYaw(), location.getPitch()); + Material block2Up = location2Up.getBlock().getType(); + if(block2Up.equals(Material.AIR) || block2Up.equals(Material.WATER)) return location2Down; + }else if(block3Down.equals(Material.AIR) || block3Down.equals(Material.WATER)){ + Location location3Up = new Location(location.getWorld(), location.getX(), location.getY()+1, location.getZ()-1, location.getYaw(), location.getPitch()); + Material block3Up = location3Up.getBlock().getType(); + if(block3Up.equals(Material.AIR) || block3Up.equals(Material.WATER)) return location3Down; + }else if(block4Down.equals(Material.AIR) || block4Down.equals(Material.WATER)){ + Location location4Up = new Location(location.getWorld(), location.getX(), location.getY()+1, location.getZ()+1, location.getYaw(), location.getPitch()); + Material block4Up = location4Up.getBlock().getType(); + if(block4Up.equals(Material.AIR) || block4Up.equals(Material.WATER)) return location4Down; } return null; } diff --git a/src/main/java/nl/zandervdm/stayput/Main.java b/src/main/java/nl/zandervdm/stayput/Main.java deleted file mode 100644 index a3cb1d9..0000000 --- a/src/main/java/nl/zandervdm/stayput/Main.java +++ /dev/null @@ -1,158 +0,0 @@ -package nl.zandervdm.stayput; - -import com.j256.ormlite.dao.Dao; -import com.j256.ormlite.dao.DaoManager; -import com.j256.ormlite.jdbc.JdbcConnectionSource; -import com.j256.ormlite.support.ConnectionSource; -import com.j256.ormlite.table.TableUtils; -import nl.zandervdm.stayput.Commands.StayputCommand; -import nl.zandervdm.stayput.Listeners.PlayerTeleportEventListener; -import nl.zandervdm.stayput.Models.Position; -import nl.zandervdm.stayput.Repositories.PositionRepository; -import nl.zandervdm.stayput.Utils.ConfigManager; -import nl.zandervdm.stayput.Utils.RuleManager; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import java.io.File; -import java.sql.SQLException; -import java.util.Collection; -import java.util.List; - -public class Main extends JavaPlugin { - - public static FileConfiguration config; - - //Util classes - protected ConfigManager configManager; - protected RuleManager ruleManager; - - //Database connection stuff - protected ConnectionSource connectionSource; - - //Data mappers - protected Dao positionMapper; - - //Repositories - protected PositionRepository positionRepository; - - /** - * Permissions: - * stayput.use - * stayput.override - * stayput.admin - */ - - @Override - public void onEnable(){ - setupClasses(); - setupConfig(); - setupListeners(); - setupCommands(); - setupDatabase(); - setupDao(); - setupTables(); - } - - @Override - public void onDisable(){ - syncPlayerstoDatabase(); - } - - public Dao getPositionMapper(){ - return this.positionMapper; - } - - public PositionRepository getPositionRepository(){ - return this.positionRepository; - } - - public RuleManager getRuleManager(){ - return this.ruleManager; - } - - protected void setupClasses(){ - this.configManager = new ConfigManager(this); - this.ruleManager = new RuleManager(this); - - this.positionRepository = new PositionRepository(this); - } - - public void setupConfig(){ - this.configManager.createConfig(); - config = getConfig(); - if(Main.config.getBoolean("debug")) getLogger().info("Setting up config"); - } - - protected void setupListeners(){ - getServer().getPluginManager().registerEvents(new PlayerTeleportEventListener(this), this); - if(Main.config.getBoolean("debug")) getLogger().info("Setting up listeners"); - } - - protected void setupCommands(){ - this.getCommand("stayput").setExecutor(new StayputCommand(this)); - } - - protected void setupDatabase(){ - if(Main.config.getString("type").equals("sqlite")){ - try { - Class.forName("org.sqlite.JDBC"); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - } - File file = new File(this.getDataFolder(), "database.db"); - String datasource = "jdbc:sqlite:" + file; - connectionSource = null; - try { - connectionSource = new JdbcConnectionSource(datasource); - } catch (SQLException e) { - e.printStackTrace(); - } - }else if(Main.config.getString("type").equals("mysql")) { - String host = Main.config.getString("mysql.host"); - Integer port = Main.config.getInt("mysql.port"); - String database = Main.config.getString("mysql.database"); - String username = Main.config.getString("mysql.username"); - String password = Main.config.getString("mysql.password"); - String datasource = "jdbc:mysql://" + host + ":" + port + "/" + database + "?autoReconnect=true"; - connectionSource = null; - try { - connectionSource = new JdbcConnectionSource(datasource, username, password); - } catch (SQLException e) { - e.printStackTrace(); - } - }else{ - getLogger().warning("Invalid database connection type chosen!"); - } - if(Main.config.getBoolean("debug")) getLogger().info("Setting up database"); - } - - protected void setupDao(){ - positionMapper = null; - try { - positionMapper = DaoManager.createDao(connectionSource, Position.class); - } catch (SQLException e) { - e.printStackTrace(); - } - } - - protected void setupTables() { - try { - TableUtils.createTableIfNotExists(connectionSource, Position.class); - } catch (SQLException e) { - e.printStackTrace(); - } - if(Main.config.getBoolean("debug")) getLogger().info("Setting up tables"); - } - - protected void syncPlayerstoDatabase(){ - Collection players = getServer().getOnlinePlayers(); - for(Player player : players){ - if(player.hasPermission("stayput.use")) { - this.getPositionRepository().updateLocationForPlayer(player, player.getLocation()); - } - } - } - -} diff --git a/src/main/java/nl/zandervdm/stayput/Models/Position.java b/src/main/java/nl/zandervdm/stayput/Models/Position.java index c54de58..6410d47 100644 --- a/src/main/java/nl/zandervdm/stayput/Models/Position.java +++ b/src/main/java/nl/zandervdm/stayput/Models/Position.java @@ -7,36 +7,41 @@ public class Position { @DatabaseField(generatedId = true) - protected Integer id; + private Integer id; @DatabaseField() - protected String uuid; + private String uuid; @DatabaseField() - protected String player_name; + private String player_name; @DatabaseField() - protected String world_name; + private String world_name; @DatabaseField() - protected Double coordinate_x; + private Double coordinate_x; @DatabaseField() - protected Double coordinate_y; + private Double coordinate_y; @DatabaseField() - protected Double coordinate_z; + private Double coordinate_z; @DatabaseField() - protected Float yaw; + private Float yaw; @DatabaseField() - protected Float pitch; + private Float pitch; + + @DatabaseField + private String dimension_name; + + @DatabaseField + private boolean dimension_last_location; public Float getPitch() { return pitch; } - public void setPitch(Float pitch) { this.pitch = pitch; } @@ -44,7 +49,6 @@ public void setPitch(Float pitch) { public Integer getId() { return id; } - public void setId(Integer id) { this.id = id; } @@ -52,7 +56,6 @@ public void setId(Integer id) { public String getUuid() { return uuid; } - public void setUuid(String uuid) { this.uuid = uuid; } @@ -60,7 +63,6 @@ public void setUuid(String uuid) { public String getPlayer_name() { return player_name; } - public void setPlayer_name(String player_name) { this.player_name = player_name; } @@ -68,7 +70,6 @@ public void setPlayer_name(String player_name) { public String getWorld_name() { return world_name; } - public void setWorld_name(String world_name) { this.world_name = world_name; } @@ -76,15 +77,11 @@ public void setWorld_name(String world_name) { public Double getCoordinate_x() { return coordinate_x; } - - public void setCoordinate_x(Double coordinate_x) { - this.coordinate_x = coordinate_x; - } + public void setCoordinate_x(Double coordinate_x) { this.coordinate_x = coordinate_x; } public Double getCoordinate_y() { return coordinate_y; } - public void setCoordinate_y(Double coordinate_y) { this.coordinate_y = coordinate_y; } @@ -92,16 +89,18 @@ public void setCoordinate_y(Double coordinate_y) { public Double getCoordinate_z() { return coordinate_z; } - public void setCoordinate_z(Double coordinate_z) { this.coordinate_z = coordinate_z; } - public Float getYaw() { - return yaw; - } - + public Float getYaw() { return yaw; } public void setYaw(Float yaw) { this.yaw = yaw; } + + public String getDimension_name() { return dimension_name; } + public void setDimension_name(String dimension_name) { this.dimension_name = dimension_name; } + + public boolean getDimensionLastLocation() { return dimension_last_location; } + public void setDimensionLastLocation(Boolean dimension_last_location) { this.dimension_last_location = dimension_last_location; } } \ No newline at end of file diff --git a/src/main/java/nl/zandervdm/stayput/Repositories/PositionRepository.java b/src/main/java/nl/zandervdm/stayput/Repositories/PositionRepository.java index 4da29d6..0e58bf8 100644 --- a/src/main/java/nl/zandervdm/stayput/Repositories/PositionRepository.java +++ b/src/main/java/nl/zandervdm/stayput/Repositories/PositionRepository.java @@ -1,18 +1,23 @@ package nl.zandervdm.stayput.Repositories; -import nl.zandervdm.stayput.Main; +import com.google.common.collect.*; +import com.onarandombox.MultiverseCore.api.MVWorldManager; +import com.onarandombox.MultiverseCore.api.MultiverseWorld; +import nl.zandervdm.stayput.StayPut; import nl.zandervdm.stayput.Models.Position; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Player; import java.sql.SQLException; +import java.util.*; public class PositionRepository { - protected Main plugin; + private StayPut plugin; + private MVWorldManager worldManager; - public PositionRepository(Main plugin) { + public PositionRepository(StayPut plugin) { this.plugin = plugin; } @@ -33,14 +38,18 @@ public void updateLocationForPlayer(Player player, Location location){ if(position == null) { position = new Position(); } - position.setWorld_name(location.getWorld().getName()); + String world_name = location.getWorld().getName(); + position.setWorld_name(world_name); position.setPlayer_name(player.getName()); position.setUuid(player.getUniqueId().toString()); - position.setCoordinate_x(location.getX() * 1.0); - position.setCoordinate_y(location.getY() * 1.0); - position.setCoordinate_z(location.getZ() * 1.0); + position.setCoordinate_x(location.getX()); + position.setCoordinate_y(location.getY()); + position.setCoordinate_z(location.getZ()); position.setYaw(location.getYaw()); position.setPitch(location.getPitch()); + // Reset dimension last location. + position.setDimension_name(updateDimension(position.getDimension_name(), world_name)); + position.setDimensionLastLocation(true); try { this.plugin.getPositionMapper().createOrUpdate(position); } catch (SQLException e) { @@ -48,7 +57,7 @@ public void updateLocationForPlayer(Player player, Location location){ } } - public Location getPreviousLocation(Player player, World world){ + private Location getPreviousLocationIgnoringDimension(Player player, World world){ Position position = null; try { position = this.plugin.getPositionMapper() @@ -62,12 +71,148 @@ public Location getPreviousLocation(Player player, World world){ return null; } if(position == null) return null; - double coordX = position.getCoordinate_x(); - double coordY = position.getCoordinate_y(); - double coordZ = position.getCoordinate_z(); + double coordinate_x = position.getCoordinate_x(); + double coordinate_y = position.getCoordinate_y(); + double coordinate_z = position.getCoordinate_z(); float yaw = position.getYaw(); float pitch = position.getPitch(); - return new Location(world, coordX, coordY, coordZ, yaw, pitch); + return new Location(world, coordinate_x, coordinate_y, coordinate_z, yaw, pitch); } + + private String updateDimension(String dimension_name, String world_name) { + if(dimension_name == null || dimension_name.isEmpty()) { + dimension_name = this.plugin.getDimensionManager().getDimension(world_name); + } + if(dimension_name != null && !dimension_name.isEmpty()) { + List dimension_positions = null; + try { + dimension_positions = this.plugin.getPositionMapper() + .queryBuilder() + .where() + .eq("dimension_name", dimension_name) + .query(); + } catch (SQLException e) { + e.printStackTrace(); + } + for (Position position : dimension_positions) { + position.setDimensionLastLocation(false); + try { + this.plugin.getPositionMapper().createOrUpdate(position); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + return dimension_name; + } + + // Need to check and update all locations to new dimensions as necessary. + public void updateDimensionOfPositions(ImmutableMultimap dimensions) { + if(dimensions != null && !dimensions.isEmpty()) { + for (String dimension_name : dimensions.keySet()) { + ImmutableCollection worlds = dimensions.get(dimension_name); + if (worlds == null || worlds.isEmpty()) { + plugin.getLogger().info("Dimension " + dimension_name + " has no worlds. Skipping."); + } else { + if (plugin.getConfig().getBoolean("debug")) plugin.getLogger().info("Updating positions for dimension: " + dimension_name); + List world_positions = null; + try { + world_positions = this.plugin.getPositionMapper() + .queryBuilder() + .where().in("world_name", worlds) + .query(); + } catch (SQLException e) { + e.printStackTrace(); + } + if (plugin.getConfig().getBoolean("debug")) plugin.getLogger().info("Found: " + world_positions.size() + " worlds"); + for(Position position : world_positions) { + try{ + this.plugin.getPositionMapper().createOrUpdate(position); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + removeDimensionalOverlap(dimension_name); + } + } + } + + // Occasionally check if an update to dimensions has caused an overlap of last_locations. + private void removeDimensionalOverlap(String dimension_name) { + List dimension_last_positions = null; + try { + dimension_last_positions = this.plugin.getPositionMapper() + .queryBuilder() + .where() + .eq("dimension_name", dimension_name) + .and() + .eq("dimension_last_location", true) + .query(); + } catch (SQLException e) { + e.printStackTrace(); + } + if( dimension_last_positions != null && dimension_last_positions.size() >= 2) { + for(Position position : dimension_last_positions) { + position.setDimensionLastLocation(false); + try { + this.plugin.getPositionMapper().createOrUpdate(position); + } catch (SQLException e) { + e.printStackTrace(); + } + } + } + } + + public Location getPreviousLocation(Player player, World intended_world) { + String world_name = intended_world.getName(); + Position intended_position = null; + Position actual_position; + String dimension_name = null; + try { + intended_position = this.plugin.getPositionMapper() + .queryBuilder() + .where() + .eq("uuid", player.getUniqueId().toString()) + .and() + .eq("world_name", world_name) + .queryForFirst(); + } catch (SQLException e) { + e.printStackTrace(); + } + + if(intended_position == null) { + dimension_name = this.plugin.getDimensionManager().getDimension(world_name); + } else { + dimension_name = intended_position.getDimension_name(); + } + + // Stop and just go to the intended location. + if(intended_position != null && intended_position.getDimensionLastLocation()) { + if(plugin.getConfig().getBoolean("debug")) plugin.getLogger().info("Dimension - intended location is last location."); + return getPreviousLocationIgnoringDimension(player, intended_world); + } else if(dimension_name == null || dimension_name.isEmpty()) { + return getPreviousLocationIgnoringDimension(player, intended_world); + } else { + try { + actual_position = this.plugin.getPositionMapper() + .queryBuilder() + .where() + .eq("dimension_name", dimension_name) + .and() + .eq("dimension_last_location", true) + .queryForFirst(); + World actual_world = this.plugin.getMultiverseCore().getMVWorldManager().getMVWorld(actual_position.getWorld_name()).getCBWorld(); + + if(plugin.getConfig().getBoolean("debug")) plugin.getLogger().info("Intended to go to " + intended_world.getName() + " going to " + actual_world.getName() + " in dimension " + actual_position.getDimension_name()); + return new Location(actual_world, actual_position.getCoordinate_x(), actual_position.getCoordinate_y(), actual_position.getCoordinate_z(), actual_position.getYaw(), actual_position.getPitch()); + } catch (SQLException e) { + e.printStackTrace(); + } + } + if(plugin.getConfig().getBoolean("debug")) plugin.getLogger().info("getLastWorldInDimension - We should never get here. This is a problem."); + return null; + } + } diff --git a/src/main/java/nl/zandervdm/stayput/StayPut.java b/src/main/java/nl/zandervdm/stayput/StayPut.java new file mode 100644 index 0000000..12077dd --- /dev/null +++ b/src/main/java/nl/zandervdm/stayput/StayPut.java @@ -0,0 +1,215 @@ +package nl.zandervdm.stayput; + +import com.j256.ormlite.dao.Dao; +import com.j256.ormlite.dao.DaoManager; +import com.j256.ormlite.jdbc.JdbcConnectionSource; +import com.j256.ormlite.stmt.UpdateBuilder; +import com.j256.ormlite.support.ConnectionSource; +import com.j256.ormlite.table.TableUtils; +import com.onarandombox.MultiverseCore.MultiverseCore; +import com.onarandombox.MultiverseCore.api.MVWorldManager; +import nl.zandervdm.stayput.Commands.StayputCommand; +import nl.zandervdm.stayput.Listeners.PlayerTeleportEventListener; +import nl.zandervdm.stayput.Models.Position; +import nl.zandervdm.stayput.Repositories.PositionRepository; +import nl.zandervdm.stayput.Utils.ConfigManager; +import nl.zandervdm.stayput.Utils.DimensionManager; +import nl.zandervdm.stayput.Utils.RuleManager; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.java.JavaPlugin; + +import java.io.File; +import java.io.IOException; +import java.sql.SQLException; +import java.util.Collection; + +public class StayPut extends JavaPlugin { + + public static FileConfiguration config; + + //Util classes + private ConfigManager configManager; + private DimensionManager dimensionManager; + private RuleManager ruleManager; + + //Database connection stuff + private ConnectionSource connectionSource; + + //Data mappers + private Dao positionMapper; + + //Repositories + private PositionRepository positionRepository; + + /** + * Permissions: + * stayput.use + * stayput.override + * stayput.admin + */ + + @Override + public void onEnable(){ + setupClasses(); + setupConfig(); + setupListeners(); + setupCommands(); + setupDatabase(); + checkTableRebuild(); + setupDao(); + setupTables(); + setupDimensions(); + } + + @Override + public void onDisable(){ + syncPlayersToDatabase(); + } + + public ConnectionSource getConnectionSource() { + return this.connectionSource; + } + + public Dao getPositionMapper(){ + return this.positionMapper; + } + + public PositionRepository getPositionRepository(){ + return this.positionRepository; + } + + public DimensionManager getDimensionManager() { return this.dimensionManager; } + + public RuleManager getRuleManager(){ + return this.ruleManager; + } + + public MultiverseCore getMultiverseCore() { + Plugin plugin = getServer().getPluginManager().getPlugin("Multiverse-Core"); + + if (plugin instanceof MultiverseCore) { + return (MultiverseCore) plugin; + } + + // Get the name of all plugins. + Plugin[] pluginList = getServer().getPluginManager().getPlugins(); + for(Plugin plug : pluginList) { + getLogger().info("Plugin: " + plug.getName() ); + } + + throw new RuntimeException("MultiVerse not found!"); + } + + private void setupClasses(){ + this.configManager = new ConfigManager(this); + this.dimensionManager = new DimensionManager(this); + this.ruleManager = new RuleManager(this); + + this.positionRepository = new PositionRepository(this); + + if(getMultiverseCore().getMVWorldManager().getMVWorlds().isEmpty()) { + getLogger().info("No worlds found !!!!!!!!! fuck"); + } + } + + public void setupConfig(){ + this.configManager.createConfig(); + config = getConfig(); + if(config.getBoolean("debug")) getLogger().info("Setting up config"); + } + + public void setupDimensions() { + this.dimensionManager.loadDimensions(); + this.positionRepository.updateDimensionOfPositions(this.dimensionManager.getDimensions()); + if(config.getBoolean("debug")) getLogger().info("Setting up dimensions"); + } + + private void setupListeners(){ + getServer().getPluginManager().registerEvents(new PlayerTeleportEventListener(this), this); + if(StayPut.config.getBoolean("debug")) getLogger().info("Setting up listeners"); + } + + private void setupCommands(){ + this.getCommand("stayput").setExecutor(new StayputCommand(this)); + } + + private void setupDatabase(){ + if(StayPut.config.getString("type").equals("sqlite")){ + try { + Class.forName("org.sqlite.JDBC"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + File file = new File(this.getDataFolder(), "database.db"); + String data_source = "jdbc:sqlite:" + file; + connectionSource = null; + try { + connectionSource = new JdbcConnectionSource(data_source); + } catch (SQLException e) { + e.printStackTrace(); + } + }else if(StayPut.config.getString("type").equals("mysql")) { + String host = StayPut.config.getString("mysql.host"); + Integer port = StayPut.config.getInt("mysql.port"); + String database = StayPut.config.getString("mysql.database"); + String username = StayPut.config.getString("mysql.username"); + String password = StayPut.config.getString("mysql.password"); + String data_source = "jdbc:mysql://" + host + ":" + port + "/" + database + "?autoReconnect=true"; + connectionSource = null; + try { + connectionSource = new JdbcConnectionSource(data_source, username, password); + } catch (SQLException e) { + e.printStackTrace(); + } + }else{ + getLogger().warning("Invalid database connection type chosen!"); + } + if(StayPut.config.getBoolean("debug")) getLogger().info("Setting up database"); + } + + public void checkTableRebuild() { + if(config.getBoolean("rebuild-db")) { + rebuildTables(); + } + } + + private void setupDao(){ + this.positionMapper = null; + try { + this.positionMapper = DaoManager.createDao(connectionSource, Position.class); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + private void setupTables() { + try { + TableUtils.createTableIfNotExists(connectionSource, Position.class); + } catch (SQLException e) { + e.printStackTrace(); + } + if(StayPut.config.getBoolean("debug")) getLogger().info("Setting up tables"); + } + + public void rebuildTables() { + try { + TableUtils.dropTable(connectionSource, Position.class, false); + setupTables(); + if(StayPut.config.getBoolean("debug")) getLogger().info("Rebuilding Stayput tables"); + } catch (SQLException e) { + e.printStackTrace(); + } + } + + private void syncPlayersToDatabase(){ + Collection players = getServer().getOnlinePlayers(); + for(Player player : players){ + if(player.hasPermission("stayput.use")) { + this.getPositionRepository().updateLocationForPlayer(player, player.getLocation()); + } + } + } + +} diff --git a/src/main/java/nl/zandervdm/stayput/Utils/ConfigManager.java b/src/main/java/nl/zandervdm/stayput/Utils/ConfigManager.java index f245276..06d0975 100644 --- a/src/main/java/nl/zandervdm/stayput/Utils/ConfigManager.java +++ b/src/main/java/nl/zandervdm/stayput/Utils/ConfigManager.java @@ -1,14 +1,15 @@ package nl.zandervdm.stayput.Utils; -import nl.zandervdm.stayput.Main; +import nl.zandervdm.stayput.StayPut; import java.io.File; +import java.io.IOException; public class ConfigManager { - protected Main plugin; + private StayPut plugin; - public ConfigManager(Main plugin) { + public ConfigManager(StayPut plugin) { this.plugin = plugin; } @@ -23,5 +24,4 @@ public void createConfig(){ this.plugin.saveDefaultConfig(); } } - } diff --git a/src/main/java/nl/zandervdm/stayput/Utils/DimensionManager.java b/src/main/java/nl/zandervdm/stayput/Utils/DimensionManager.java new file mode 100644 index 0000000..695605c --- /dev/null +++ b/src/main/java/nl/zandervdm/stayput/Utils/DimensionManager.java @@ -0,0 +1,84 @@ +package nl.zandervdm.stayput.Utils; + +import com.google.common.collect.*; +import com.onarandombox.MultiverseCore.api.MultiverseWorld; +import nl.zandervdm.stayput.StayPut; +import nl.zandervdm.stayput.Repositories.PositionRepository; +import org.bukkit.Location; +import org.bukkit.configuration.ConfigurationSection; + +import java.util.*; + +public class DimensionManager { + + private StayPut plugin; + private ImmutableMultimap dimensions; + private static String SECTION = "dimensions"; + + public DimensionManager(StayPut plugin) { + this.plugin = plugin; + } + + public void loadDimensions() { + this.ensureConfigIsPrepared(); + this.checkDimensionalDuplication(); + ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); + ConfigurationSection dimensions_section = this.plugin.getConfig().getConfigurationSection(SECTION); + Set dimension_section_keys = this.plugin.getConfig().getConfigurationSection(SECTION).getKeys(false); + for(String dimension_key : dimension_section_keys) { + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Loading dimension " + dimension_key + ":"); + if(dimensions_section.isList(dimension_key)) { + List sub_dimension = dimensions_section.getStringList(dimension_key); + for (String world_name : sub_dimension) { + MultiverseWorld world = this.plugin.getMultiverseCore().getMVWorldManager().getMVWorld(world_name); + if (world != null) { + if (StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("--- Loading world " + world_name); + builder.put(dimension_key, world_name); + } else { + this.plugin.getLogger().info(" world " + world_name + " could not be found for dimension " + dimension_key); + } + } + } else { + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Dimension " + dimension_key + " is not a list."); + } + } + this.dimensions = builder.build(); + if(StayPut.config.getBoolean("debug") && dimension_section_keys.isEmpty()) this.plugin.getLogger().info("Dimensions list is empty."); + } + + public ImmutableMultimap getDimensions() { return this.dimensions; } + + private void ensureConfigIsPrepared() { + if (this.plugin.getConfig().getConfigurationSection(SECTION) == null) { + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Adding dimensions to config."); + this.plugin.getConfig().createSection(SECTION); + } + } + + private void checkDimensionalDuplication() { + final Set duplicateDimensions = new HashSet<>(); + final Set intermediateSet = new HashSet<>(); + List dimensionsList = this.plugin.getConfig().getStringList(SECTION); + for (String dimension : dimensionsList) { + if (!intermediateSet.add(dimension)) { + duplicateDimensions.add(dimension); + } + } + if(!duplicateDimensions.isEmpty()) { + this.plugin.getLogger().info("Duplicate dimensions detected: " + String.join(", ", duplicateDimensions + ". Only the first dimension will be loaded.")); + // return true; + } + //return false; + } + + public String getDimension(String world_name) { + String dimension = null; + ImmutableList invertedDimensions = this.dimensions.inverse().get(world_name).asList(); + + if(invertedDimensions.size() > 0) { + dimension = invertedDimensions.get(0); + } + + return dimension; + } +} diff --git a/src/main/java/nl/zandervdm/stayput/Utils/RuleManager.java b/src/main/java/nl/zandervdm/stayput/Utils/RuleManager.java index 2598438..8a4b609 100644 --- a/src/main/java/nl/zandervdm/stayput/Utils/RuleManager.java +++ b/src/main/java/nl/zandervdm/stayput/Utils/RuleManager.java @@ -1,8 +1,9 @@ package nl.zandervdm.stayput.Utils; -import nl.zandervdm.stayput.Main; +import com.onarandombox.MultiverseCore.api.MVWorldManager; +import nl.zandervdm.stayput.StayPut; +import nl.zandervdm.stayput.Utils.DimensionManager; import org.bukkit.Location; -import org.bukkit.Material; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent; @@ -11,9 +12,10 @@ public class RuleManager { - protected Main plugin; + private StayPut plugin; + private MVWorldManager worldManager; - public RuleManager(Main plugin) { + public RuleManager(StayPut plugin) { this.plugin = plugin; } @@ -21,38 +23,36 @@ public boolean shouldUpdateLocation(Player player, Location fromLocation, Locati World fromWorld = fromLocation.getWorld(); World toWorld = toLocation.getWorld(); - if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("Player teleporting: " + player.getName()); - if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("Player teleporting from world: " + fromWorld.getName()); - if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("Player teleporting to world: " + toWorld.getName()); + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Player teleporting: " + player.getName()); + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Player teleporting from world: " + fromWorld.getName()); + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Player teleporting to world: " + toWorld.getName()); //If the worlds are the same, ignore if(fromWorld.getName().equals(toWorld.getName())){ - if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("Ignoring player " + player.getName() + " because he did not switch worlds"); + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Ignoring player " + player.getName() + " because he did not switch worlds"); return false; } //If the player does not have the use permission, just ignore it and do nothing if(!player.hasPermission("stayput.use")){ - if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("Ignoring player " + player.getName() + " because he does not have permission"); + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Ignoring player " + player.getName() + " because he does not have permission"); return false; } - // //However if the player has the override permission, also ignore -// if(player.hasPermission("stayput.override") && !player.hasPermission("-stayput.override")){ -// if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("Ignore player " + player.getName() + " because he has the override permission"); -// return; -// } - return true; } - public Location shouldTeleportPlayer(Player player, Location fromLocation, Location toLocation){ - World fromWorld = fromLocation.getWorld(); + public Location shouldTeleportPlayer(Player player, Location toLocation){ World toWorld = toLocation.getWorld(); //If this world is inside the configs blacklist, ignore - if(this.worldIsBlacklisted(toWorld)){ - if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("Not teleport player because this world is blacklisted"); + if(this.worldIsBlackListed(toWorld)){ + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Not StayPut this player because this world is blacklisted"); + return null; + } + + if(!this.worldIsWhiteListed(toWorld)) { + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Not StayPut this player because this world is not whitelisted"); return null; } @@ -61,20 +61,21 @@ public Location shouldTeleportPlayer(Player player, Location fromLocation, Locat //If there is no previous location for this world, just ignore it if(previousLocation == null){ - if(Main.config.getBoolean("debug")) this.plugin.getLogger().info("Not teleporting player because there is no previous location found"); + if(StayPut.config.getBoolean("debug")) this.plugin.getLogger().info("Not teleporting player because there is no previous location found"); return null; } return previousLocation; } - protected boolean shouldTeleport(PlayerTeleportEvent.TeleportCause cause){ - return cause.name().equals(PlayerTeleportEvent.TeleportCause.COMMAND.name()) - || cause.name().equals(PlayerTeleportEvent.TeleportCause.PLUGIN.name()); + private boolean worldIsBlackListed(World world) { + List blacklistedWorlds = StayPut.config.getStringList("blacklisted-worlds"); + return blacklistedWorlds.size() != 0 && blacklistedWorlds.contains(world.getName()); } - public boolean worldIsBlacklisted(World world) { - List blacklistedWorlds = Main.config.getStringList("blacklisted-worlds"); - return blacklistedWorlds.size() != 0 && blacklistedWorlds.contains(world.getName()); + // + private boolean worldIsWhiteListed(World world) { + List white_listed_worlds = this.plugin.getConfig().getStringList("whitelisted-worlds"); + return white_listed_worlds.size() == 0 || white_listed_worlds.contains(world.getName()); } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index d49f05b..f71827e 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -2,18 +2,38 @@ type: sqlite # If your database type has been set to mysql fill out these details mysql: - host: "localhost" - port: 3306 - database: "stay_put" - username: "root" - password: "" + host: "localhost" + port: 3306 + database: "stay_put" + username: "root" + password: "" # Blacklisted worlds, which worlds should be excluded from the teleport actions? Default: [] # Example layout # blacklisted-worlds: -# - world -# - world_nether +# - world +# - world_nether blacklisted-worlds: [] +# Whitelisted worlds, will prevent all unlisted worlds from StayPut. +# leave this list blank to only use the blacklist. +whitelisted-worlds: [] + # Want to debug and see why certain actions are (not) executed? Set this to true. Default: false -debug: false \ No newline at end of file +debug: false + +# Set this to true to rebuild your db, only necessary when updating from 1.1 to 1.2. +rebuild-db: false + +# Dimensions are a grouping of worlds that are taken into consideration as one when being teleported to. +# No one world can be in multiple dimensions. +# Example layout +# dimensions: +# vanilla_dimension: +# - world +# - world_nether +# - world_the_end +# adventure_dimension: +# - crystal_worlds +# - super_hostile_the_kaizo_caverns +dimensions: \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index bdc7173..c945278 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,11 +1,12 @@ name: StayPut -version: 1.1 +version: 1.2 +api-version: 1.13 author: Zander van der Meer -main: nl.zandervdm.stayput.Main +main: nl.zandervdm.stayput.StayPut website: http://zandervdm.nl depend: [Multiverse-Core] commands: stayput: - description: Main command + description: StayPut command usage: /stayput aliases: [stay, sp] \ No newline at end of file diff --git a/stayput.iml b/stayput.iml index fc451da..e6ed4aa 100644 --- a/stayput.iml +++ b/stayput.iml @@ -1,38 +1,24 @@ - + - - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/target/StayPut.jar b/target/StayPut.jar deleted file mode 100644 index 59be9da..0000000 Binary files a/target/StayPut.jar and /dev/null differ diff --git a/target/classes/config.yml b/target/classes/config.yml deleted file mode 100644 index d49f05b..0000000 --- a/target/classes/config.yml +++ /dev/null @@ -1,19 +0,0 @@ -# Database type you want to use. Default: sqlite -type: sqlite -# If your database type has been set to mysql fill out these details -mysql: - host: "localhost" - port: 3306 - database: "stay_put" - username: "root" - password: "" - -# Blacklisted worlds, which worlds should be excluded from the teleport actions? Default: [] -# Example layout -# blacklisted-worlds: -# - world -# - world_nether -blacklisted-worlds: [] - -# Want to debug and see why certain actions are (not) executed? Set this to true. Default: false -debug: false \ No newline at end of file diff --git a/target/classes/nl/zandervdm/stayput/Commands/StayputCommand.class b/target/classes/nl/zandervdm/stayput/Commands/StayputCommand.class deleted file mode 100644 index 437dca1..0000000 Binary files a/target/classes/nl/zandervdm/stayput/Commands/StayputCommand.class and /dev/null differ diff --git a/target/classes/nl/zandervdm/stayput/Listeners/PlayerTeleportEventListener.class b/target/classes/nl/zandervdm/stayput/Listeners/PlayerTeleportEventListener.class deleted file mode 100644 index 8496024..0000000 Binary files a/target/classes/nl/zandervdm/stayput/Listeners/PlayerTeleportEventListener.class and /dev/null differ diff --git a/target/classes/nl/zandervdm/stayput/Main.class b/target/classes/nl/zandervdm/stayput/Main.class deleted file mode 100644 index 5b76c13..0000000 Binary files a/target/classes/nl/zandervdm/stayput/Main.class and /dev/null differ diff --git a/target/classes/nl/zandervdm/stayput/Models/Position.class b/target/classes/nl/zandervdm/stayput/Models/Position.class deleted file mode 100644 index bb17359..0000000 Binary files a/target/classes/nl/zandervdm/stayput/Models/Position.class and /dev/null differ diff --git a/target/classes/nl/zandervdm/stayput/Repositories/PositionRepository.class b/target/classes/nl/zandervdm/stayput/Repositories/PositionRepository.class deleted file mode 100644 index c188964..0000000 Binary files a/target/classes/nl/zandervdm/stayput/Repositories/PositionRepository.class and /dev/null differ diff --git a/target/classes/nl/zandervdm/stayput/Utils/ConfigManager.class b/target/classes/nl/zandervdm/stayput/Utils/ConfigManager.class deleted file mode 100644 index ae52884..0000000 Binary files a/target/classes/nl/zandervdm/stayput/Utils/ConfigManager.class and /dev/null differ diff --git a/target/classes/nl/zandervdm/stayput/Utils/RuleManager.class b/target/classes/nl/zandervdm/stayput/Utils/RuleManager.class deleted file mode 100644 index d8fdb0e..0000000 Binary files a/target/classes/nl/zandervdm/stayput/Utils/RuleManager.class and /dev/null differ diff --git a/target/classes/plugin.yml b/target/classes/plugin.yml deleted file mode 100644 index bdc7173..0000000 --- a/target/classes/plugin.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: StayPut -version: 1.1 -author: Zander van der Meer -main: nl.zandervdm.stayput.Main -website: http://zandervdm.nl -depend: [Multiverse-Core] -commands: - stayput: - description: Main command - usage: /stayput - aliases: [stay, sp] \ No newline at end of file diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties deleted file mode 100644 index 12f188a..0000000 --- a/target/maven-archiver/pom.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Generated by Maven -#Fri Jan 13 13:50:48 CET 2017 -version=1.0-SNAPSHOT -groupId=nl.zandervdm.stayput -artifactId=StayPut diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst deleted file mode 100644 index e69de29..0000000 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst deleted file mode 100644 index c46cb0d..0000000 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ /dev/null @@ -1,4 +0,0 @@ -/Users/Zander/Documents/Workspace/stayput/src/main/java/nl/zandervdm/stayput/Listeners/PlayerTeleportEventListener.java -/Users/Zander/Documents/Workspace/stayput/src/main/java/nl/zandervdm/stayput/Utils/ConfigManager.java -/Users/Zander/Documents/Workspace/stayput/src/main/java/nl/zandervdm/stayput/Models/Position.java -/Users/Zander/Documents/Workspace/stayput/src/main/java/nl/zandervdm/stayput/Main.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst deleted file mode 100644 index e69de29..0000000