SteamWar/MissileWars
Archiviert
13
0

Improve Code Complexity

Dieser Commit ist enthalten in:
jojo 2020-12-19 13:04:49 +01:00
Ursprung 01a422f96d
Commit f1e19126a9
7 geänderte Dateien mit 5 neuen und 34 gelöschten Zeilen

Datei anzeigen

@ -21,4 +21,8 @@ package de.steamwar.misslewars.scripts;
public interface RunnableScript {
boolean execute(RunnableScriptEvent runnableScriptEvent);
interface ScriptFunction {
boolean execute(RunnableScriptEvent runnableScriptEvent, double... doubles);
}
}

Datei anzeigen

@ -52,10 +52,7 @@ public class RunnableScriptEvent {
if (locationType == LocationType.STATIC) return location;
// Dynamic Location if entity is not null
if (locationType == LocationType.DYNAMIC) {
if (entity != null) return entity.getLocation();
return location;
}
if (locationType == LocationType.DYNAMIC) return entity != null ? entity.getLocation() : location;
// Default Location is static if EventType is onClick otherwise dynamic
if (eventType == ScriptedItem.EventType.onClick) return location;

Datei anzeigen

@ -1,26 +0,0 @@
/*
*
* 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.misslewars.scripts;
public interface ScriptFunction {
boolean execute(RunnableScriptEvent runnableScriptEvent, double... doubles);
}

Datei anzeigen

@ -23,7 +23,6 @@ import com.google.gson.JsonObject;
import de.steamwar.misslewars.MissileWars;
import de.steamwar.misslewars.scripts.RunnableScript;
import de.steamwar.misslewars.scripts.RunnableScriptEvent;
import de.steamwar.misslewars.scripts.ScriptFunction;
import org.bukkit.Location;
import java.util.HashMap;

Datei anzeigen

@ -23,7 +23,6 @@ import com.google.gson.JsonObject;
import de.steamwar.misslewars.scripts.RunnableScript;
import de.steamwar.misslewars.scripts.RunnableScriptEvent;
import de.steamwar.misslewars.scripts.ScriptedItem;
import de.steamwar.misslewars.scripts.ScriptFunction;
import de.steamwar.misslewars.scripts.utils.EntityUtils;
import de.steamwar.misslewars.scripts.utils.EntityUtils.ScriptShortcut;
import org.bukkit.entity.Projectile;

Datei anzeigen

@ -23,7 +23,6 @@ import com.google.gson.JsonObject;
import de.steamwar.misslewars.scripts.RunnableScript;
import de.steamwar.misslewars.scripts.RunnableScriptEvent;
import de.steamwar.misslewars.scripts.RunnableScriptEvent.LocationType;
import de.steamwar.misslewars.scripts.ScriptFunction;
import org.bukkit.Location;
import java.util.HashMap;

Datei anzeigen

@ -22,7 +22,6 @@ package de.steamwar.misslewars.scripts.implemented;
import com.google.gson.JsonObject;
import de.steamwar.misslewars.scripts.RunnableScript;
import de.steamwar.misslewars.scripts.RunnableScriptEvent;
import de.steamwar.misslewars.scripts.ScriptFunction;
import de.steamwar.misslewars.scripts.utils.EntityUtils;
import de.steamwar.misslewars.scripts.utils.EntityUtils.ScriptShortcut;
import org.bukkit.entity.Entity;