Implementing fireball
Dieser Commit ist enthalten in:
Ursprung
7e1785f8df
Commit
17a1bda409
@ -20,10 +20,7 @@
|
||||
package de.steamwar.spectatesystem;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import de.steamwar.spectatesystem.elements.RArrow;
|
||||
import de.steamwar.spectatesystem.elements.REntity;
|
||||
import de.steamwar.spectatesystem.elements.RPlayer;
|
||||
import de.steamwar.spectatesystem.elements.RTnT;
|
||||
import de.steamwar.spectatesystem.elements.*;
|
||||
import de.steamwar.sql.NoClipboardException;
|
||||
import de.steamwar.sql.Schematic;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
@ -122,12 +119,18 @@ class PacketProcessor {
|
||||
((RPlayer)REntity.getEntity(entityId)).setItem(item, enchanted, slot);
|
||||
}
|
||||
|
||||
private void spawnArrow() throws IOException {
|
||||
private void arrowSpawn() throws IOException {
|
||||
int entityId = source.rInt();
|
||||
|
||||
new RArrow(entityId);
|
||||
}
|
||||
|
||||
private void fireballSpawn() throws IOException {
|
||||
int entityId = source.rInt();
|
||||
|
||||
new RFireball(entityId);
|
||||
}
|
||||
|
||||
private void send(ChatMessageType type) throws IOException {
|
||||
String message = source.rString();
|
||||
|
||||
@ -237,7 +240,10 @@ class PacketProcessor {
|
||||
playerItem();
|
||||
break;
|
||||
case 0x08:
|
||||
spawnArrow();
|
||||
arrowSpawn();
|
||||
break;
|
||||
case 0x09:
|
||||
fireballSpawn();
|
||||
break;
|
||||
case 0x30:
|
||||
block();
|
||||
|
@ -27,11 +27,6 @@ public class RArrow extends REntity {
|
||||
super(internalId, createArrow());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void spawnEntity(PlayerConnection connection) {
|
||||
connection.sendPacket(new PacketPlayOutSpawnEntity(entity));
|
||||
}
|
||||
|
||||
private static EntityTippedArrow createArrow() {
|
||||
return new EntityTippedArrow(world, 0, 0, 0);
|
||||
}
|
||||
|
@ -114,5 +114,7 @@ public abstract class REntity {
|
||||
((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(entity));
|
||||
}
|
||||
|
||||
protected abstract void spawnEntity(PlayerConnection connection);
|
||||
protected void spawnEntity(PlayerConnection connection){
|
||||
connection.sendPacket(new PacketPlayOutSpawnEntity(entity));
|
||||
}
|
||||
}
|
||||
|
32
src/de/steamwar/spectatesystem/elements/RFireball.java
Normale Datei
32
src/de/steamwar/spectatesystem/elements/RFireball.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.spectatesystem.elements;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.*;
|
||||
|
||||
public class RFireball extends REntity{
|
||||
public RFireball(int internalId) {
|
||||
super(internalId, createFireball());
|
||||
}
|
||||
|
||||
private static EntityFireball createFireball() {
|
||||
return new EntitySmallFireball(world, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
}
|
@ -20,8 +20,6 @@
|
||||
package de.steamwar.spectatesystem.elements;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.EntityTNTPrimed;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_15_R1.PlayerConnection;
|
||||
|
||||
public class RTnT extends REntity {
|
||||
|
||||
@ -29,11 +27,6 @@ public class RTnT extends REntity {
|
||||
super(internalId, createTnT());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void spawnEntity(PlayerConnection connection) {
|
||||
connection.sendPacket(new PacketPlayOutSpawnEntity(entity));
|
||||
}
|
||||
|
||||
private static EntityTNTPrimed createTnT() {
|
||||
return new EntityTNTPrimed(world, 0, 0, 0, null);
|
||||
}
|
||||
|
@ -28,6 +28,8 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.BlockExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
@ -80,4 +82,14 @@ public class ArenaListener extends BasicListener {
|
||||
public void onWorldLoad(WorldLoadEvent e){
|
||||
e.getWorld().setAutoSave(false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityExplosion(EntityExplodeEvent e){
|
||||
e.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockExplosion(BlockExplodeEvent e){
|
||||
e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren