Gates can now consist of any material.
You can left or right click the button to open a gate Gates are now initialized on sign placement, not more right clicking!
This commit is contained in:
parent
13dbf6e8f1
commit
916b6df55d
24
README
24
README
@ -13,7 +13,6 @@ Known Issues
|
|||||||
=============
|
=============
|
||||||
- Vehicle implementation is nowhere near done.
|
- Vehicle implementation is nowhere near done.
|
||||||
- Signs aren't always updating, I don't know what's causing this, I think it's a Bukkit thing.
|
- Signs aren't always updating, I don't know what's causing this, I think it's a Bukkit thing.
|
||||||
- You need to right-click the sign to initialize the gate, waiting on SIGN_CHANGE hook update.
|
|
||||||
|
|
||||||
=============
|
=============
|
||||||
Permissions
|
Permissions
|
||||||
@ -36,17 +35,16 @@ Building a gate:
|
|||||||
- Type a set destination name on the second line if desired.
|
- Type a set destination name on the second line if desired.
|
||||||
- Type a network name on the third line if desired.
|
- Type a network name on the third line if desired.
|
||||||
- Type any options on the 4th line if desired.
|
- Type any options on the 4th line if desired.
|
||||||
- Right click the sign block to initialize the gate as a Stargate. (Bug Alert: Sign may not update right away)
|
|
||||||
|
|
||||||
Sign Layout:
|
Sign Layout:
|
||||||
- Line 1: Gate Name (Max 12 characters)
|
- Line 1: Gate Name (Max 12 characters)
|
||||||
- Line 2: Destination Name (Max 12 characters, used for fixed-gates only)
|
- Line 2: Destination Name [Optional] (Max 12 characters, used for fixed-gates only)
|
||||||
- Line 3: Network name (Max 12 characters)
|
- Line 3: Network name [Optional] (Max 12 characters)
|
||||||
- Line 4: Options ('A' for always-on fixed gate, 'H' for hidden networked gate)
|
- Line 4: Options [Optional] ('A' for always-on fixed gate, 'H' for hidden networked gate)
|
||||||
|
|
||||||
Using a gate:
|
Using a gate:
|
||||||
- Right click the sign to choose a destination.
|
- Right click the sign to choose a destination.
|
||||||
- Right click the button to open up a portal.
|
- Right/left click the button to open up a portal.
|
||||||
- Step through.
|
- Step through.
|
||||||
|
|
||||||
Fixed gates:
|
Fixed gates:
|
||||||
@ -68,11 +66,23 @@ Hidden Gates:
|
|||||||
==============
|
==============
|
||||||
Configuration
|
Configuration
|
||||||
==============
|
==============
|
||||||
- To change the text shown during events edit stargates.txt
|
default-gate-network - The default gate network
|
||||||
|
not-selected-message - The message when no destination is selected
|
||||||
|
portal-destroy-message - The message when a gate is destroyed
|
||||||
|
portal-create-message - The message when a gate is created
|
||||||
|
not-owner-message - The message when you aren't allowed to push the gate button
|
||||||
|
other-side-blocked-message - The message when the gate you're dialing is open
|
||||||
|
teleport-message - The message when you are teleported
|
||||||
|
portal-save-location - The file your portal database is saved as
|
||||||
|
gate-folder - The folder containing your .gate files
|
||||||
|
|
||||||
=============
|
=============
|
||||||
Changes
|
Changes
|
||||||
=============
|
=============
|
||||||
|
[Version 0.08]
|
||||||
|
- Gates can now consist of any material.
|
||||||
|
- You can left or right click the button to open a gate
|
||||||
|
- Gates are now initialized on sign placement, not more right clicking!
|
||||||
[Version 0.07]
|
[Version 0.07]
|
||||||
- Fixed where the default gate is saved to.
|
- Fixed where the default gate is saved to.
|
||||||
[Version 0.06]
|
[Version 0.06]
|
||||||
|
@ -93,6 +93,8 @@ public class Blox {
|
|||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
|
//builder.append(world.getName());
|
||||||
|
//builder.append(',');
|
||||||
builder.append(x);
|
builder.append(x);
|
||||||
builder.append(',');
|
builder.append(',');
|
||||||
builder.append(y);
|
builder.append(y);
|
||||||
|
@ -311,7 +311,7 @@ public class Portal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVerified() {
|
public boolean isVerified() {
|
||||||
verified = verified || getBlockAt(1, 0).getType() == OBSIDIAN;
|
verified = verified || getBlockAt(1, 0).getBlock().getTypeId() == gate.getControlBlock();
|
||||||
return verified;
|
return verified;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,7 +584,7 @@ public class Portal {
|
|||||||
|
|
||||||
public static Portal createPortal(SignPost id, Player player) {
|
public static Portal createPortal(SignPost id, Player player) {
|
||||||
Block idParent = id.getParent();
|
Block idParent = id.getParent();
|
||||||
if (idParent.getType() != Material.OBSIDIAN) return null;
|
if (Gate.getGatesByControlBlock(idParent).length == 0) return null;
|
||||||
|
|
||||||
Blox parent = new Blox(player.getWorld(), idParent.getX(), idParent.getY(), idParent.getZ());
|
Blox parent = new Blox(player.getWorld(), idParent.getX(), idParent.getY(), idParent.getZ());
|
||||||
Blox topleft = null;
|
Blox topleft = null;
|
||||||
|
@ -20,6 +20,7 @@ import org.bukkit.event.block.BlockListener;
|
|||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.block.BlockRightClickEvent;
|
import org.bukkit.event.block.BlockRightClickEvent;
|
||||||
|
import org.bukkit.event.block.SignChangeEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleListener;
|
import org.bukkit.event.vehicle.VehicleListener;
|
||||||
@ -102,7 +103,7 @@ public class Stargate extends JavaPlugin implements Runnable {
|
|||||||
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.BLOCK_PLACED, blockListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.BLOCK_DAMAGED, blockListener, Priority.Normal, this);
|
||||||
pm.registerEvent(Event.Type.VEHICLE_MOVE, vehicleListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.VEHICLE_MOVE, vehicleListener, Priority.Normal, this);
|
||||||
//pm.registerEvent(Event.Type.SIGN_CHANGE, blockListener, Priority.Normal, this);
|
pm.registerEvent(Event.Type.SIGN_CHANGE, blockListener, Priority.Normal, this);
|
||||||
|
|
||||||
setInterval(160); // 8 seconds.
|
setInterval(160); // 8 seconds.
|
||||||
|
|
||||||
@ -294,6 +295,34 @@ public class Stargate extends JavaPlugin implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSignChange(SignChangeEvent event) {
|
||||||
|
Player player = event.getPlayer();
|
||||||
|
Block block = event.getBlock();
|
||||||
|
// Initialize a stargate
|
||||||
|
if (Stargate.Permissions.has(player, "stargate.create")) {
|
||||||
|
SignPost sign = new SignPost(new Blox(block));
|
||||||
|
// Set sign text so we can create a gate with it.
|
||||||
|
sign.setText(0, event.getLine(0));
|
||||||
|
sign.setText(1, event.getLine(1));
|
||||||
|
sign.setText(2, event.getLine(2));
|
||||||
|
sign.setText(3, event.getLine(3));
|
||||||
|
Portal portal = Portal.createPortal(sign, player);
|
||||||
|
if (portal == null) return;
|
||||||
|
|
||||||
|
if (!regMsg.isEmpty()) {
|
||||||
|
player.sendMessage(ChatColor.GREEN + regMsg);
|
||||||
|
}
|
||||||
|
log.info("Initialized stargate: " + portal.getName());
|
||||||
|
portal.drawSign(true);
|
||||||
|
// Set event text so our new sign is instantly initialized
|
||||||
|
event.setLine(0, sign.getText(0));
|
||||||
|
event.setLine(1, sign.getText(1));
|
||||||
|
event.setLine(2, sign.getText(2));
|
||||||
|
event.setLine(3, sign.getText(3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockRightClick(BlockRightClickEvent event) {
|
public void onBlockRightClick(BlockRightClickEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
@ -308,20 +337,6 @@ public class Stargate extends JavaPlugin implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the player is initializing a stargate
|
|
||||||
if (portal == null && Stargate.Permissions.has(player, "stargate.create")) {
|
|
||||||
SignPost sign = new SignPost(new Blox(block));
|
|
||||||
portal = Portal.createPortal(sign, player);
|
|
||||||
|
|
||||||
if (portal != null && !regMsg.isEmpty()) {
|
|
||||||
player.sendMessage(ChatColor.GREEN + regMsg);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (portal == null) return;
|
|
||||||
log.info("Initialized stargate: " + portal.getName());
|
|
||||||
portal.drawSign(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement right-click to toggle a stargate, gets around spawn protection problem.
|
// Implement right-click to toggle a stargate, gets around spawn protection problem.
|
||||||
@ -339,7 +354,20 @@ public class Stargate extends JavaPlugin implements Runnable {
|
|||||||
public void onBlockDamage(BlockDamageEvent event) {
|
public void onBlockDamage(BlockDamageEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
Block block = event.getBlock();
|
Block block = event.getBlock();
|
||||||
if (block.getType() != Material.WALL_SIGN && block.getType() != Material.OBSIDIAN && block.getType() != Material.STONE_BUTTON) {
|
// Check if we're pushing a button.
|
||||||
|
if (block.getType() == Material.STONE_BUTTON && event.getDamageLevel() == BlockDamageLevel.STOPPED) {
|
||||||
|
if (Stargate.Permissions.has(player, "stargate.use")) {
|
||||||
|
Portal portal = Portal.getByBlock(block);
|
||||||
|
if (portal != null) {
|
||||||
|
onButtonPressed(player, portal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Drop out if we're not breaking a block
|
||||||
|
if (event.getDamageLevel() != BlockDamageLevel.BROKEN) return;
|
||||||
|
|
||||||
|
if (block.getType() != Material.WALL_SIGN && block.getType() != Material.STONE_BUTTON && Gate.getGatesByControlBlock(block).length == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,13 +379,11 @@ public class Stargate extends JavaPlugin implements Runnable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getDamageLevel() == BlockDamageLevel.BROKEN) {
|
|
||||||
portal.unregister();
|
portal.unregister();
|
||||||
if (!dmgMsg.isEmpty()) {
|
if (!dmgMsg.isEmpty()) {
|
||||||
player.sendMessage(ChatColor.RED + dmgMsg);
|
player.sendMessage(ChatColor.RED + dmgMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: Stargate
|
name: Stargate
|
||||||
main: net.TheDgtl.Stargate.Stargate
|
main: net.TheDgtl.Stargate.Stargate
|
||||||
version: 0.07
|
version: 0.08
|
||||||
description: Stargate mod for Bukkit
|
description: Stargate mod for Bukkit
|
||||||
author: Drakia
|
author: Drakia
|
||||||
website: http://www.thedgtl.net
|
website: http://www.thedgtl.net
|
Loading…
x
Reference in New Issue
Block a user