Permalink
Browse files

Add a listener to remove black colour codes from the beginning of signs.

  • Loading branch information...
me4502 committed May 6, 2017
1 parent 8d9f88d commit 7b7d15030adf9b3afffb5f9622ea841710c96222
Showing with 12 additions and 0 deletions.
  1. +12 −0 src/main/java/com/sk89q/craftbook/bukkit/MechanicListenerAdapter.java
@@ -49,6 +49,7 @@
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
+import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleMoveEvent;
@@ -408,4 +409,15 @@ public void onVehicleEnter(VehicleEnterEvent event) {
}
}
}
+
+ @EventHandler(priority = EventPriority.LOWEST)
+ public void onSignChange(SignChangeEvent event) {
+ for (int i = 0; i < 4; i++) {
+ String line = event.getLine(i);
+ if (line.startsWith("&0")) {
+ line = line.substring(2);
+ event.setLine(i, line);
+ }
+ }
+ }
}

0 comments on commit 7b7d150

Please sign in to comment.