Got Dungeon teleporting set up and working
This commit is contained in:
parent
c06f19d6e4
commit
1d3471f099
10 changed files with 116 additions and 22 deletions
|
@ -1,5 +0,0 @@
|
|||
UHCMatchState: "IDLE"
|
||||
magic:
|
||||
cannonbow:
|
||||
speedmultiplier: 1.5
|
||||
minforce: 0.2
|
|
@ -7,6 +7,8 @@ commands:
|
|||
description: creates wireless redstone
|
||||
cb:
|
||||
description: creates creative boundaries
|
||||
dungeons:
|
||||
description: handles the resource dungeons scattered around the map
|
||||
debug:
|
||||
description: debug commands
|
||||
flaircolour:
|
||||
|
|
|
@ -3,8 +3,11 @@ package buttondevteam.alipresents.components.dungeons;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import buttondevteam.alipresents.architecture.Component;
|
||||
import buttondevteam.alipresents.components.dungeons.commands.DisplayDebug;
|
||||
import buttondevteam.alipresents.components.dungeons.commands.Enter;
|
||||
import buttondevteam.alipresents.components.dungeons.commands.Exit;
|
||||
import buttondevteam.alipresents.components.dungeons.commands.SetEntrance;
|
||||
import buttondevteam.alipresents.components.dungeons.commands.SetExit;
|
||||
import buttondevteam.alipresents.components.dungeons.dungeons.GenericDungeonA1;
|
||||
|
||||
public class DungeonComponent extends Component {
|
||||
|
@ -12,9 +15,12 @@ public class DungeonComponent extends Component {
|
|||
@Override
|
||||
public void register(JavaPlugin plugin) {
|
||||
dungeonA1 = new GenericDungeonA1(plugin);
|
||||
|
||||
registerCommand(plugin, new DisplayDebug(this));
|
||||
registerCommand(plugin, new Enter(this));
|
||||
registerCommand(plugin, new Exit(this));
|
||||
|
||||
registerCommand(plugin, new SetEntrance(this));
|
||||
registerCommand(plugin, new SetExit(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
package buttondevteam.alipresents.components.dungeons.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||
|
||||
public class DisplayDebug extends ModCommand {
|
||||
|
||||
private DungeonComponent component;
|
||||
|
||||
public DisplayDebug(DungeonComponent component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
player.sendMessage("Entrance Location: "+component.dungeonA1.getDungeonEntrance().toString());
|
||||
player.sendMessage("Exit Location: "+component.dungeonA1.getDungeonExit().toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String GetCommandPath(){
|
||||
return "dungeons display debug";
|
||||
}
|
||||
|
||||
}
|
|
@ -13,11 +13,11 @@ public class Enter extends ModCommand{
|
|||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
component.dungeonA1.enterDungeon(player);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String GetCommandPath(){
|
||||
return "dungeon enter";
|
||||
return "dungeons enter";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,10 +14,11 @@ public class Exit extends PlayerCommand {
|
|||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
component.dungeonA1.exitDungeon(player);
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
public String getCommandPath(){
|
||||
return "dungeon exit";
|
||||
@Override
|
||||
public String GetCommandPath(){
|
||||
return "dungeons exit";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package buttondevteam.alipresents.components.dungeons.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||
|
||||
public class SetEntrance extends ModCommand {
|
||||
|
||||
private DungeonComponent component;
|
||||
public SetEntrance(DungeonComponent component) {
|
||||
this.component = component;
|
||||
}
|
||||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
player.sendMessage("Setting DungeonA1's Entrance!");
|
||||
component.dungeonA1.setEntrance(player.getLocation());
|
||||
player.sendMessage("Entrance Set!");
|
||||
return true;
|
||||
}
|
||||
public String GetCommandPath(){
|
||||
return "dungeons set entrance";
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package buttondevteam.alipresents.components.dungeons.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import buttondevteam.alipresents.architecture.commands.ModCommand;
|
||||
import buttondevteam.alipresents.components.dungeons.DungeonComponent;
|
||||
|
||||
public class SetExit extends ModCommand {
|
||||
|
||||
private DungeonComponent component;
|
||||
|
||||
public SetExit(DungeonComponent component) {
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean OnCommand(Player player, String alias, String[] args) {
|
||||
player.sendMessage("Setting DungeonA1's Exit!");
|
||||
component.dungeonA1.setExit(player.getLocation());
|
||||
player.sendMessage("DungeonA1's Exit Set!");
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public String GetCommandPath(){
|
||||
return "dungeons set exit";
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,8 @@ import org.bukkit.entity.Player;
|
|||
public abstract class Dungeon {
|
||||
public abstract Location getDungeonEntrance();
|
||||
public abstract Location getDungeonExit();
|
||||
public abstract void setEntrance(Location location);
|
||||
public abstract void setExit(Location location);
|
||||
public boolean enterDungeon(Player player){
|
||||
|
||||
if (getDungeonEntrance() == null){
|
||||
|
|
|
@ -4,13 +4,15 @@ import org.bukkit.Location;
|
|||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class GenericDungeonA1 extends Dungeon{
|
||||
private Location dungeonEntrance;
|
||||
private Location dungeonExit;
|
||||
private Location entrance;
|
||||
private Location exit;
|
||||
private JavaPlugin plugin;
|
||||
|
||||
public GenericDungeonA1(JavaPlugin plugin){
|
||||
if(!initDungeon(plugin)){
|
||||
plugin.getServer().broadcastMessage("DungeonA1 cant be initialized!");
|
||||
}
|
||||
this.plugin = plugin;
|
||||
}
|
||||
private boolean initDungeon(JavaPlugin plugin){
|
||||
if (plugin.getServer().getWorld("Dungeons") == null || plugin.getServer().getWorld("world") == null){
|
||||
|
@ -19,27 +21,32 @@ public class GenericDungeonA1 extends Dungeon{
|
|||
return false;
|
||||
}
|
||||
|
||||
dungeonEntrance = new Location(plugin.getServer().getWorld("Dungeons"), -7.5, 138.0, -91.5);
|
||||
dungeonExit = plugin.getServer().getWorld("world").getSpawnLocation().clone();
|
||||
entrance = new Location(plugin.getServer().getWorld("Dungeons"), -7.5, 138.0, -91.5);
|
||||
exit = plugin.getServer().getWorld("world").getSpawnLocation().clone();
|
||||
|
||||
if (dungeonEntrance == null || dungeonExit == null){
|
||||
if (entrance == null || exit == null){
|
||||
plugin.getServer().broadcastMessage("DungeonA1Error! Dungeon Entrance or Exit is null!");
|
||||
plugin.getServer().broadcastMessage("DungeonEnterance: " + dungeonEntrance.toString());
|
||||
plugin.getServer().broadcastMessage("Dungeon Exit: " + dungeonExit.toString());
|
||||
plugin.getServer().broadcastMessage("Dungeon Entrance: " + entrance.toString());
|
||||
plugin.getServer().broadcastMessage("Dungeon Exit: " + exit.toString());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void setDungeonEnterance(Location location){
|
||||
dungeonEntrance = location;
|
||||
public void setEntrance(Location location){
|
||||
plugin.getConfig().set("dungeons.dungeona1.entrance", entrance);
|
||||
plugin.saveConfig();
|
||||
entrance = location;
|
||||
}
|
||||
public void setExit(Location location){
|
||||
exit = location;
|
||||
}
|
||||
@Override
|
||||
public Location getDungeonEntrance() {
|
||||
return dungeonEntrance;
|
||||
return entrance;
|
||||
}
|
||||
@Override
|
||||
public Location getDungeonExit() {
|
||||
return dungeonExit;
|
||||
return exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue